e1d0fcd53a700c126eaf206d8e971a100f36b7e0.svn-base 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <el-row>
  3. <el-col :span="leftCol" ref="elw">
  4. <el-card :body-style="{'padding':'0'}">
  5. <export-tree-list-with-check-box-sk
  6. :pid="pid"
  7. :type="type"
  8. :pidNodes="pidNodes"
  9. @treeCheckedDataChange="treeCheckedDataChange"
  10. :height="dxdcAsideHeight"
  11. :width="treeWidth"
  12. @changeYear="changeYear"
  13. ></export-tree-list-with-check-box-sk>
  14. </el-card>
  15. </el-col>
  16. <el-col :span="rightCol">
  17. <el-card :body-style="{'padding-top':'10px'}">
  18. <div class="block">
  19. <el-button type="primary" icon="el-icon-download"
  20. style="float: right;margin:0 5px"
  21. @click="exportExecl">导出</el-button>
  22. <el-button type="primary" icon="el-icon-search" style="float: right;margin:0 5px" @click="searchExecl">查询</el-button>
  23. </div>
  24. </el-card>
  25. <el-card :body-style="{'height':dxdcMainHeight + 'px','padding':'0'}">
  26. <form ref="forMainFb2" id="forMainFb2" target="frameMainFb2" :action="reportSrc" method="post">
  27. <input type="hidden" name="width" v-model="windowWidth">
  28. <input type="hidden" name="height" v-model="windowHeight">
  29. <input type="hidden" name="ids" v-model="ids">
  30. <input type="hidden" name="excelName" v-model="excelName">
  31. <input type="hidden" name="dt" v-model="monthValue">
  32. <input type="hidden" name="sttm" v-model="sttm">
  33. <input type="hidden" name="ettm" v-model="ettm">
  34. <input type="hidden" name="persid" v-model="userId">
  35. <input type="hidden" name="year" v-model="newYear">
  36. </form>
  37. <div style="width: 100%;height: 100%;" v-loading="loading">
  38. <iframe ref="frameMainFb2" id="frameMainFb2" name="frameMainFb2" src="" frameborder="0" width="100%" height="100%" style="overflow: auto"></iframe>
  39. </div>
  40. </el-card>
  41. </el-col>
  42. </el-row>
  43. </template>
  44. <script>
  45. import exportTreeListWithCheckBoxSk from './exportTreeListWithCheckBox_sk'
  46. import {dateFormat} from '../../utils/gw_date.js'
  47. import {reportUrl} from '@util/global_variable.js'
  48. export default {
  49. components: {
  50. exportTreeListWithCheckBoxSk:exportTreeListWithCheckBoxSk,
  51. },
  52. data() {
  53. return {
  54. ids:[],
  55. pid:'000',
  56. pidNodes:[],
  57. type:'003',
  58. dxdcMainHeight: window.innerHeight-190,
  59. dxdcAsideHeight: window.innerHeight-180,
  60. windowHeight:window.innerHeight - 200,
  61. windowWidth:window.innerWidth - 350,
  62. radioTable:1,
  63. loading:false,
  64. leftCol:4,
  65. rightCol:20,
  66. excelName:'防洪工程设施水毁修复督查问题汇总表',
  67. monthValue:dateFormat(new Date(), 'yyyy-MM'),
  68. sttm:'',
  69. ettm:'',
  70. treeWidth: 250,
  71. newYear: ""
  72. }
  73. },
  74. mounted() {
  75. this.treeWidth = this.$refs.elw.$el.clientWidth;
  76. },
  77. computed: {
  78. userId: function () {
  79. return localStorage.getItem("userid")
  80. ? localStorage.getItem("userid")
  81. : "1098101939614724096";
  82. },
  83. reportSrc(){
  84. return `/JsReport/reportFiles/reportjsp/showReport_pages.jsp?raq=sh02.raq`
  85. }
  86. },
  87. methods: {
  88. //树节点选中或取消事件
  89. treeCheckedDataChange(params){
  90. // 如果是选中状态,把元素id加入到ids里
  91. if(params.newStatus){
  92. params.newCheckedArray.forEach((element,index) => {
  93. let id = element.id;
  94. if(id != null && id !== undefined && id !=='' ){
  95. this.ids.push(id)
  96. }
  97. });
  98. }else {
  99. // 删除取消的元素id
  100. params.changedItem.forEach((element,index) => {
  101. let id = element.id;
  102. let inx = this.ids.indexOf(id);
  103. if(inx > -1) {
  104. delete this.ids[inx]
  105. }
  106. });
  107. }
  108. // 去重
  109. this.ids = Array.from(new Set(this.ids));
  110. console.log("ids:" + this.ids)
  111. },
  112. // 获取Excel数据
  113. searchExecl(){
  114. this.loading = true;
  115. // 使用form表单post提交,彻底解决参数值过长的问题
  116. this.$refs.forMainFb2.submit();
  117. // 使用_this
  118. let _this = this;
  119. this.$refs.frameMainFb2.onload = function(){
  120. _this.loading = false;
  121. };
  122. },
  123. // 导出Excel数据
  124. exportExecl(){
  125. v = window.frames["frameMainFb2"];
  126. // v.contentWindow.report1_saveAsExcel();
  127. v.report1_saveAsExcel();
  128. },
  129. changeYear(val) {
  130. this.newYear = val;
  131. this.ids = [];
  132. },
  133. },
  134. watch:{
  135. monthValue(n,o){
  136. if(n == null){
  137. this.monthValue = "";
  138. }
  139. },
  140. sttm(n,o){
  141. if(n == null){
  142. this.sttm = "";
  143. }
  144. },
  145. ettm(n,o){
  146. if(n == null){
  147. this.ettm = "";
  148. }
  149. }
  150. },
  151. activated() {
  152. this.searchExecl();
  153. }
  154. }
  155. </script>
  156. <style scoped>
  157. </style>