a88c1bb155b619e5f49d7bc8ec27d307b4dae1bf.svn-base 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <el-row>
  3. <el-col :span="4" >
  4. <el-card :body-style="{'padding':'0'}">
  5. <export-tree-list-with-check-box-ry
  6. :pid="pid"
  7. :type="type"
  8. :style="{'max-height':dxdcAsideHeight+'px'}"
  9. @treeCheckedDataChange="treeCheckedDataChange"
  10. ></export-tree-list-with-check-box-ry>
  11. </el-card>
  12. </el-col>
  13. <el-col :span="20">
  14. <el-card :body-style="{'padding-top':'0'}">
  15. <el-checkbox :indeterminate="isIndeterminate"
  16. v-model="checkAll"
  17. @change="handleCheckAllChange"
  18. style="margin-top: 10px"
  19. >全选</el-checkbox>
  20. <el-checkbox :indeterminate="isIndeterminate"
  21. v-model="checkSum"
  22. @change="handleCheckSumChange"
  23. style="margin-top: 10px"
  24. >合并</el-checkbox>
  25. <el-checkbox-group v-model="checkTable">
  26. <el-checkbox v-for="table in tables"
  27. :label="table"
  28. :key="table"
  29. style="margin-top: 10px;"
  30. >{{table}}
  31. </el-checkbox>
  32. <el-button type="primary" icon="el-icon-check" style="float: right" @click="createExecl">导出</el-button>
  33. </el-checkbox-group>
  34. </el-card>
  35. <el-card :body-style="{'height':dxdcMainHeight + 'px'}">
  36. <div style="width: 100%;height: 100%;overflow-y: auto" v-show="showDiv" v-loading="loadDiv" id="myDiv" ref="myDiv" >
  37. </div>
  38. </el-card>
  39. </el-col>
  40. </el-row>
  41. </template>
  42. <script>
  43. const tableOptions = [
  44. '暗访调研行政村统计表',
  45. '村内农村饮水工程设施运行维护情况表',
  46. '用水户情况表',
  47. '农村饮水工程运行管理情况表',
  48. '千人以上供水工程水源地保护情况表',
  49. '管理责任体系落实情况表'
  50. ];
  51. import request from '../../utils/gw_ajax_request.js';
  52. import exportTreeListWithCheckBoxRy from './exportTreeListWithCheckBox_ry'
  53. export default {
  54. name: "generalExport",
  55. components: {
  56. exportTreeListWithCheckBoxRy:exportTreeListWithCheckBoxRy,
  57. },
  58. data() {
  59. return {
  60. ids:[],
  61. tableIds:[],
  62. pid:'000',
  63. type:'002',
  64. tables: tableOptions,
  65. checkAll:false,
  66. checkSum:false,
  67. checkSumState:0,
  68. checkTable:['暗访调研行政村统计表'],
  69. dxdcMainHeight: window.innerHeight-250,
  70. dxdcAsideHeight: window.innerHeight-90,
  71. showDiv:true,
  72. loadDiv:false,
  73. }
  74. },
  75. mounted() {
  76. },
  77. computed: {
  78. userId: function () {
  79. return localStorage.getItem("userid")
  80. ? localStorage.getItem("userid")
  81. : "1098101939614724096";
  82. }
  83. },
  84. methods: {
  85. //树节点选中事件
  86. treeCheckedDataChange(params){
  87. // 如果是选中状态,把元素id加入到ids里
  88. if(params.newStatus){
  89. params.newCheckedArray.forEach((element,index) => {
  90. let id = element.id;
  91. if(id != null && id !== undefined && id !=='' && id.length == 32){
  92. this.ids.push(id)
  93. }
  94. });
  95. }else {
  96. // 删除取消的元素id
  97. params.changedItem.forEach((element,index) => {
  98. let id = element.id;
  99. let inx = this.ids.indexOf(id);
  100. if(inx > -1) {
  101. delete this.ids[inx]
  102. }
  103. });
  104. }
  105. // 去重
  106. this.ids = Array.from(new Set(this.ids));
  107. },
  108. //表格点击选中事件
  109. handleCheckAllChange(val) {
  110. //
  111. this.checkTable = val ? tableOptions : [];
  112. this.isIndeterminate = false;
  113. },
  114. handleCheckSumChange(val){
  115. if(val){
  116. this.checkSumState = 1;
  117. }else{
  118. this.checkSumState = 0;
  119. }
  120. this.isIndeterminate = false;
  121. },
  122. //创建Excel事件
  123. createExecl(){
  124. this.$refs.myDiv.innerHTML = "";
  125. this.loadDiv = true;
  126. let _tableIds = [];
  127. this.checkTable.forEach((element,index) => {
  128. let tableName = "";
  129. switch (element){
  130. case "暗访调研行政村统计表" :
  131. tableName = "01";
  132. break;
  133. case "村内农村饮水工程设施运行维护情况表" :
  134. tableName = "02";
  135. break;
  136. case "用水户情况表" :
  137. tableName = "03";
  138. break;
  139. case "农村饮水工程运行管理情况表" :
  140. tableName = "04";
  141. break;
  142. case "千人以上供水工程水源地保护情况表" :
  143. tableName = "05";
  144. break;
  145. case "管理责任体系落实情况表" :
  146. tableName = "06";
  147. break;
  148. }
  149. _tableIds.push(tableName);
  150. });
  151. this.tableIds = _tableIds;
  152. let params = {
  153. 'engIds':this.ids.toString(),
  154. 'tableIds':this.tableIds.toString(),
  155. 'sumState':this.checkSumState,
  156. 'adCodes':''//已不需要传
  157. }
  158. request.post('/dc/gd/base/create', params).then((res) => {
  159. this.$refs.myDiv.innerHTML = res;
  160. this.loadDiv = false;
  161. })
  162. },
  163. },
  164. watch:{
  165. }
  166. }
  167. </script>
  168. <style scoped>
  169. </style>