d302c645c581ce666b5fc9f5010404bdeb708cd9.svn-base 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <el-row>
  3. <el-col :span="4" >
  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. :style="{'max-height':dxdcAsideHeight+'px'}"
  10. @treeCheckedDataChange="treeCheckedDataChange"
  11. ></export-tree-list-with-check-box-sk>
  12. </el-card>
  13. </el-col>
  14. <el-col :span="20">
  15. <el-card :body-style="{'padding-top':'0'}">
  16. <el-checkbox :indeterminate="isIndeterminate"
  17. v-model="checkAll"
  18. @change="handleCheckAllChange"
  19. style="margin-top: 10px"
  20. >全选</el-checkbox>
  21. <!--<el-checkbox :indeterminate="isIndeterminate"-->
  22. <!--v-model="checkSum"-->
  23. <!--@change="handleCheckSumChange"-->
  24. <!--style="margin-top: 10px"-->
  25. <!--&gt;合并</el-checkbox>-->
  26. <el-checkbox-group v-model="checkTable">
  27. <el-checkbox v-for="table in tables"
  28. :label="table"
  29. :key="table"
  30. style="margin-top: 10px;"
  31. >{{table}}
  32. </el-checkbox>
  33. <el-button type="primary" icon="el-icon-check" style="float: right" @click="createExecl">导出</el-button>
  34. </el-checkbox-group>
  35. </el-card>
  36. <el-card :body-style="{'height':dxdcMainHeight + 'px','padding':'0'}">
  37. <div style="width: 100%;height: 100%;overflow-y: auto" v-show="showDiv" v-loading="loadDiv" id="myDiv" ref="myDiv" >
  38. </div>
  39. </el-card>
  40. </el-col>
  41. </el-row>
  42. </template>
  43. <script>
  44. const tableOptions = [
  45. '小水库督查情况表'
  46. ];
  47. import request from '../../utils/gw_ajax_request.js';
  48. import exportTreeListWithCheckBoxSk from './exportTreeListWithCheckBox_sk'
  49. export default {
  50. name: "generalExport_shuiku",
  51. components: {
  52. exportTreeListWithCheckBoxSk:exportTreeListWithCheckBoxSk,
  53. },
  54. data() {
  55. return {
  56. tableIds:[],
  57. ids:[],
  58. pid:'000',
  59. pidNodes:[],
  60. type:'001',
  61. tables: tableOptions,
  62. checkAll:false,
  63. checkSum:false,
  64. checkSumState:0,
  65. checkTable:['小水库督查情况表'],
  66. dxdcMainHeight: window.innerHeight-160,
  67. dxdcAsideHeight: window.innerHeight-90,
  68. showDiv:true,
  69. loadDiv:false,
  70. }
  71. },
  72. mounted() {
  73. },
  74. computed: {
  75. userId: function () {
  76. return localStorage.getItem("userid")
  77. ? localStorage.getItem("userid")
  78. : "1098101939614724096";
  79. }
  80. },
  81. methods: {
  82. //树节点选中事件
  83. treeCheckedDataChange(params){
  84. //
  85. // 如果是选中状态,把元素id加入到ids里
  86. if(params.newStatus){
  87. params.newCheckedArray.forEach((element,index) => {
  88. let id = element.id;
  89. if(id != null && id !== undefined && id !=='' ){
  90. this.ids.push(id)
  91. }
  92. });
  93. }else {
  94. // 删除取消的元素id
  95. params.changedItem.forEach((element,index) => {
  96. let id = element.id;
  97. let inx = this.ids.indexOf(id);
  98. if(inx > -1) {
  99. delete this.ids[inx]
  100. }
  101. });
  102. }
  103. // 去重
  104. this.ids = Array.from(new Set(this.ids));
  105. },
  106. //表格点击选中事件
  107. handleCheckAllChange(val) {
  108. //
  109. this.checkTable = val ? tableOptions : [];
  110. this.isIndeterminate = false;
  111. },
  112. //合并按钮点击选中事件
  113. handleCheckSumChange(val){
  114. if(val){
  115. this.checkSumState = 1;
  116. }else{
  117. this.checkSumState = 0;
  118. }
  119. this.isIndeterminate = false;
  120. },
  121. //创建Excel事件
  122. createExecl(){
  123. this.$refs.myDiv.innerHTML = "";
  124. this.loadDiv = true;
  125. let _tableIds = [];
  126. this.checkTable.forEach((element,index) => {
  127. let tableName = "";
  128. switch (element){
  129. case "小水库督查情况表" :
  130. tableName = "08";
  131. break;
  132. }
  133. _tableIds.push(tableName);
  134. });
  135. this.tableIds = _tableIds;
  136. let params = {
  137. "type":"rsvr",
  138. "presId":this.userId,
  139. "pType":"1",
  140. "tableIds":this.tableIds.toString(),
  141. "ids":this.ids.toString()
  142. }
  143. request.post('/dc/gd/base/create/sk', params).then((res) => {
  144. this.$refs.myDiv.innerHTML = res;
  145. this.loadDiv = false;
  146. })
  147. },
  148. },
  149. watch:{
  150. }
  151. }
  152. </script>
  153. <style scoped>
  154. </style>