detail.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <Modal
  3. v-model="contentShow"
  4. :title="contentTitle"
  5. class="report-detail-window"
  6. width="80%"
  7. :styles="{top: '35px', paddingBottom: '35px'}"
  8. footerHide>
  9. <report-content :content="contentText"></report-content>
  10. </Modal>
  11. </template>
  12. <script>
  13. import ReportContent from "../content";
  14. export default {
  15. components: {ReportContent},
  16. data() {
  17. return {
  18. reportid: 0,
  19. reporttitle: '',
  20. contentShow: false,
  21. contentTitle: '',
  22. contentText: '',
  23. }
  24. },
  25. beforeCreate() {
  26. let doms = document.querySelectorAll('.report-detail-window');
  27. for (let i = 0; i < doms.length; ++i) {
  28. if (doms[i].parentNode != null) doms[i].parentNode.removeChild(doms[i]);
  29. }
  30. },
  31. mounted() {
  32. this.getDetail();
  33. },
  34. watch: {
  35. reportid() {
  36. this.getDetail();
  37. }
  38. },
  39. methods: {
  40. getDetail() {
  41. this.contentShow = true;
  42. this.contentTitle = this.reporttitle;
  43. this.contentText = this.$L('详细内容加载中.....');
  44. $A.apiAjax({
  45. url: 'report/content?id=' + this.reportid,
  46. error: () => {
  47. alert(this.$L('网络繁忙,请稍后再试!'));
  48. this.contentShow = false;
  49. },
  50. success: (res) => {
  51. if (res.ret === 1) {
  52. this.contentText = res.data.content;
  53. } else {
  54. this.contentShow = false;
  55. this.$Modal.error({title: this.$L('温馨提示'), content: res.msg});
  56. }
  57. }
  58. });
  59. },
  60. }
  61. }
  62. </script>