d4fda0213ed36d4bed2b3b1b7567ff7fa93613d6.svn-base 6.7 KB

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