3b937228fb8c5915d5a3f7b5de243e93373dfaa3.svn-base 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <el-container>
  3. <el-aside width="260px">
  4. <el-tree
  5. ref="trees"
  6. :data="nodeInfos"
  7. :props="defaultProps"
  8. node-key="id"
  9. @node-click="handleNodeClick">
  10. </el-tree>
  11. </el-aside>
  12. <!-- <el-row style="width:80%">-->
  13. <!-- <el-col :span="24">-->
  14. <!-- <el-card :body-style="{'padding-top':'10px'}">-->
  15. <el-container>
  16. <el-main id="dxdcListMain" style="padding:5px 0 0;">
  17. <h3>水库安全运行管理督查进度表</h3>
  18. <!-- <el-button
  19. type="primary"
  20. icon="el-icon-download"
  21. style="float:right;"
  22. @click="exportExecl"
  23. >导出
  24. </el-button> -->
  25. <div :style="{'width': '100%','height': iframeHeight + 'px'}">
  26. <iframe ref="frameMain" id="frameMain" name="frameMain" :src="tableSrc" frameborder="0" width="100%"
  27. height="100%" style="overflow: auto"></iframe>
  28. </div>
  29. </el-main>
  30. </el-container>
  31. </el-container>
  32. </template>
  33. <script>
  34. import request from "@util/gw_ajax_request.js";
  35. import {getTrees} from "@util/gw_formatTree.js"
  36. import {getRyNodeProvincial} from '@api/reportApi.js'
  37. import {reportHosturl} from '@util/global_variable.js'
  38. import {hasPriv} from '../../../utils/gw_hasPriv';
  39. import {dateFormat, getFirstDayOfMonth} from '../../../utils/gw_date.js';
  40. import {getRyNodeProvincialNogroup} from '@api/reportApi.js'
  41. export default {
  42. components: {},
  43. props: [],
  44. data() {
  45. return {
  46. iframeHeight: window.innerHeight - 230,
  47. nodeInfos: [],
  48. defaultProps: {
  49. children: 'children',
  50. label: 'pnm'
  51. },
  52. perstype: hasPriv('manage') ? 0 : 1,
  53. searchObj: {
  54. "engScal": '2'
  55. },
  56. tableSrc: '',
  57. };
  58. },
  59. computed: {
  60. persId() {
  61. return localStorage.getItem("userid")
  62. ? localStorage.getItem("userid")
  63. : "1098101939614724096";
  64. },
  65. },
  66. mounted() {
  67. this.tableSrc = `${reportHosturl}/demo/reportJsp/showReport.jsp?rpx=gcjstj.rpx&presid=${this.persId}&perstype=${this.perstype}&ids=${this.gcId}`
  68. this.getLeftTreeData();
  69. var _this = this
  70. const iframe = document.querySelector('#frameMain')
  71. // 处理兼容行问题
  72. if (iframe.attachEvent) {
  73. iframe.attachEvent('onload', function () {
  74. // iframe加载完毕以后执行操作
  75. this.title = document.getElementById('#frameMain').contentWindow.document.getElementById('#report1');
  76. console.log(this.title, 'title')
  77. console.log('iframe已加载完毕')
  78. })
  79. } else {
  80. iframe.onload = function () {
  81. this.title = iframe.contentWindow.document
  82. // iframe加载完毕以后执行操作
  83. console.log('iframe已加载完毕')
  84. }
  85. }
  86. },
  87. methods: {
  88. getLeftTreeData() {
  89. let params = {
  90. userId: this.persId,
  91. orgType: '004',
  92. level: '3'
  93. }
  94. getRyNodeProvincial(params).then(res => {
  95. if (res.success) {
  96. this.nodeInfos = getTrees(res.data)
  97. }
  98. })
  99. },
  100. handleNodeClick(data) {
  101. let paramObj = {
  102. type: "empwt",
  103. presId: this.persId,
  104. plnaId: data.id
  105. }
  106. Object.assign(this.searchObj, paramObj)
  107. this.loading = true;
  108. request.post(`/dc/insp/rsvrRgstr/list/tree`, this.searchObj)
  109. .then(res => {
  110. if (res.success) {
  111. if (res.data) {
  112. this.gcId = ''
  113. res.data.forEach(element => {
  114. this.gcId += element['id'] + ','
  115. });
  116. }
  117. this.tableSrc = `${reportHosturl}/demo/reportJsp/showReport.jsp?rpx=gcjstj.rpx&presid=${this.persId}&perstype=${this.perstype}&ids=${this.gcId}`
  118. }
  119. this.loading = false;
  120. });
  121. },
  122. // 获取Excel数据
  123. searchExecl() {
  124. this.loading = true;
  125. this.tableSrc = `${reportHosturl}/demo/reportJsp/showReport.jsp?rpx=gcjstj.rpx&presid=${this.persId}&perstype=${this.perstype}&ids=${this.gcId}`
  126. this.loading = false;
  127. },
  128. // 导出Excel数据
  129. exportExecl() {
  130. v = window.frames["frameMain"];
  131. // 调用子页面的js方法
  132. // v.contentWindow.report1_saveAsExcel();
  133. v.report1_saveAsExcel();
  134. },
  135. },
  136. watch: {
  137. },
  138. activated() {
  139. this.searchExecl();
  140. },
  141. };
  142. </script>
  143. <style scoped>
  144. h3 {
  145. margin: 5px 0;
  146. text-align: center;
  147. }
  148. </style>