consumerwaterflowyearreport.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <div>
  3. <el-row>
  4. <el-col :span="4">
  5. <div class="box">
  6. <el-scrollbar>
  7. <basic-container>
  8. <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick">
  9. <span class="el-tree-node__label" slot-scope="{ node, data }">
  10. <span>
  11. <i class="el-icon-office-building"></i>
  12. {{ (node || {}).label }}
  13. </span>
  14. </span>
  15. </avue-tree>
  16. </basic-container>
  17. </el-scrollbar>
  18. </div>
  19. </el-col>
  20. <el-col :span="20">
  21. <basic-container>
  22. <avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" v-model="form"
  23. :page.sync="page" :permission="permissionList" @search-change="searchChange"
  24. @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
  25. @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
  26. <template slot-scope="scope" slot="menu">
  27. <el-button type="text" icon="el-icon-view" size="small"
  28. @click.stop="handlePreview(scope.row)">查看年报
  29. </el-button>
  30. </template>
  31. </avue-crud>
  32. </basic-container>
  33. </el-col>
  34. </el-row>
  35. <el-drawer :visible.sync="monthCounDialog" v-if="monthCounDialog" title="年报" direction="rtl" size="60%"
  36. append-to-body="true">
  37. <consumerwaterflowyearcountdetailVue ref="consumerwaterflowyearcountdetail" :wiuCd="wiuCd">
  38. </consumerwaterflowyearcountdetailVue>
  39. </el-drawer>
  40. </div>
  41. </template>
  42. <script>
  43. import { getPage } from "@/api/baseinfo/wateruseconsumer.js";
  44. import { getTree } from "@/api/baseinfo/org";
  45. import { mapGetters } from "vuex";
  46. import consumerwaterflowyearcountdetailVue from './consumerwaterflowyearcountdetail.vue'
  47. export default {
  48. components: {
  49. consumerwaterflowyearcountdetailVue
  50. },
  51. data() {
  52. return {
  53. form: {},
  54. selectionList: [],
  55. query: {},
  56. loading: true,
  57. monthCounDialog: false,
  58. page: {
  59. pageSize: 10,
  60. currentPage: 1,
  61. total: 0
  62. },
  63. wiuCd: '',
  64. treeCode: '',
  65. treeParentCode: '',
  66. treeData: [],
  67. treeOption: {
  68. nodeKey: "id",
  69. defaultExpandedKeys: [],
  70. lazy: false,
  71. // treeLoad: function (node, resolve) {
  72. // const parentCode = (node.level === 0) ? "" : node.data.id;
  73. // getLazyDeptTree(parentCode, {}).then(res => {
  74. // resolve(res.data.data.map(item => {
  75. // return {
  76. // ...item,
  77. // leaf: !item.hasChildren
  78. // }
  79. // }))
  80. // });
  81. // },
  82. addBtn: false,
  83. menu: true,
  84. size: "small",
  85. props: {
  86. labelText: "标题",
  87. label: "title",
  88. value: "value",
  89. children: "children",
  90. },
  91. },
  92. option: {
  93. labelWidth: 140,
  94. viewLabelWidth: 140,
  95. searchLabelWidth: 140,
  96. height: 'auto',
  97. calcHeight: 30,
  98. tip: false,
  99. searchShow: true,
  100. searchMenuSpan: 6,
  101. border: true,
  102. index: true,
  103. selection: true,
  104. viewBtn: false,
  105. menu: true,
  106. dialogClickModal: false,
  107. column: [
  108. {
  109. label: "取用水户代码",
  110. prop: "wiuCd",
  111. search: true,
  112. span: 24,
  113. },
  114. {
  115. label: "取用水户名称",
  116. prop: "wiuNm",
  117. search: true,
  118. span: 24,
  119. },
  120. {
  121. label: "行政区",
  122. prop: "orgName",
  123. span: 24,
  124. },
  125. {
  126. label: "法人代表",
  127. prop: "lrNm",
  128. span: 24,
  129. },
  130. ]
  131. },
  132. data: []
  133. };
  134. },
  135. computed: {
  136. ...mapGetters(["userInfo", "permission"]),
  137. permissionList() {
  138. return {
  139. addBtn: false,
  140. viewBtn: false,
  141. delBtn: false,
  142. editBtn: false
  143. };
  144. },
  145. ids() {
  146. let ids = [];
  147. this.selectionList.forEach(ele => {
  148. ids.push(ele.id);
  149. });
  150. return ids.join(",");
  151. }
  152. },
  153. created() {
  154. this.initTree();
  155. },
  156. methods: {
  157. initTree() {
  158. this.treeData = [];
  159. getTree().then(res => {
  160. this.treeData = res.data.data.map(item => {
  161. return {
  162. ...item,
  163. leaf: !item.hasChildren
  164. }
  165. })
  166. this.treeOption.defaultExpandedKeys.push(this.treeData[0].id);
  167. this.treeCode = this.treeData[0].id;
  168. this.query = {};
  169. this.query['orgId'] = this.treeCode;
  170. });
  171. },
  172. nodeClick(data) {
  173. this.treeCode = data.id;
  174. this.excludeCode = data.exclude;
  175. this.treeParentCode = data.parentId;
  176. this.query = {};
  177. this.query['orgId'] = this.treeCode;
  178. this.page.currentPage = 1;
  179. var params = {};
  180. this.onLoad(this.page, params);
  181. },
  182. handlePreview(row) {
  183. this.wiuCd = row.wiuCd;
  184. this.monthCounDialog = true;
  185. this.$nextTick(() => {
  186. this.$refs["consumerwaterflowyearcountdetail"].init();
  187. });
  188. },
  189. searchReset() {
  190. this.query = {};
  191. this.onLoad(this.page);
  192. },
  193. searchChange(params, done) {
  194. this.query = params;
  195. this.page.currentPage = 1;
  196. this.onLoad(this.page, params);
  197. done();
  198. },
  199. selectionChange(list) {
  200. this.selectionList = list;
  201. },
  202. selectionClear() {
  203. this.selectionList = [];
  204. this.$refs.crud.toggleSelection();
  205. },
  206. currentChange(currentPage) {
  207. this.page.currentPage = currentPage;
  208. },
  209. sizeChange(pageSize) {
  210. this.page.pageSize = pageSize;
  211. },
  212. refreshChange() {
  213. this.onLoad(this.page, this.query);
  214. },
  215. onLoad(page, params = {}) {
  216. this.loading = true;
  217. getPage(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
  218. const data = res.data.data;
  219. this.page.total = data.total;
  220. this.data = data.records;
  221. this.loading = false;
  222. this.selectionClear();
  223. });
  224. }
  225. }
  226. };
  227. </script>
  228. <style></style>