From f94df233cfa51e17ed64507a7d6f39a7cf3a823a Mon Sep 17 00:00:00 2001 From: zhaoyongnian <541231643@qq.com> Date: Fri, 22 Apr 2022 17:36:27 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=85=9A=E5=91=98=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/plugins/power/kernelhousehold.vue | 177 ++++++++++++++ .../plugins/power/kernelhouseholdForm.vue | 180 +++++++++++++++ .../plugins/power/kernelhouseholdTable.vue | 217 ++++++++++++++++++ 3 files changed, 574 insertions(+) create mode 100644 src/views/modules/plugins/power/kernelhousehold.vue create mode 100644 src/views/modules/plugins/power/kernelhouseholdForm.vue create mode 100644 src/views/modules/plugins/power/kernelhouseholdTable.vue diff --git a/src/views/modules/plugins/power/kernelhousehold.vue b/src/views/modules/plugins/power/kernelhousehold.vue new file mode 100644 index 00000000..a1cca68a --- /dev/null +++ b/src/views/modules/plugins/power/kernelhousehold.vue @@ -0,0 +1,177 @@ + + + + + + + diff --git a/src/views/modules/plugins/power/kernelhouseholdForm.vue b/src/views/modules/plugins/power/kernelhouseholdForm.vue new file mode 100644 index 00000000..2d41973a --- /dev/null +++ b/src/views/modules/plugins/power/kernelhouseholdForm.vue @@ -0,0 +1,180 @@ + + + + + + + + diff --git a/src/views/modules/plugins/power/kernelhouseholdTable.vue b/src/views/modules/plugins/power/kernelhouseholdTable.vue new file mode 100644 index 00000000..2038220f --- /dev/null +++ b/src/views/modules/plugins/power/kernelhouseholdTable.vue @@ -0,0 +1,217 @@ + + + + + + + From d86deddcfbdf974a3f866a8357bebc8d48c4db17 Mon Sep 17 00:00:00 2001 From: zhaoyongnian <541231643@qq.com> Date: Fri, 22 Apr 2022 18:06:19 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=85=9A=E5=91=98=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/plugins/power/kernelhousehold.vue | 182 ++++++++++++------ .../plugins/power/kernelhouseholdForm.vue | 2 +- .../plugins/power/kernelhouseholdTable.vue | 2 +- 3 files changed, 125 insertions(+), 61 deletions(-) diff --git a/src/views/modules/plugins/power/kernelhousehold.vue b/src/views/modules/plugins/power/kernelhousehold.vue index a1cca68a..1c4e691b 100644 --- a/src/views/modules/plugins/power/kernelhousehold.vue +++ b/src/views/modules/plugins/power/kernelhousehold.vue @@ -1,31 +1,48 @@ @@ -34,14 +51,13 @@ import CDialog from '@c/CDialog' import kernelhouseholdTable from './kernelhouseholdTable' import { requestPost } from "@/js/dai/request"; import { mapGetters } from 'vuex' -import { Loading } from 'element-ui' // 引入Loading服务 - -let loading // 加载动画 export default { data () { return { + agencytree: [], // 所属组织 + agencyId: '', filterText: '', - treeLoading: true, + treeLoading: false, treeData: [], defaultProps: { children: 'children', @@ -53,37 +69,42 @@ export default { } }, async mounted () { - this.treeLoading = true - await this.loadTree() - this.treeLoading = false + // this.treeLoading = true + // await this.loadTree() + await this.getAgencyTree() + // this.treeLoading = false }, computed: { rowHeight () { - return this.$store.state.inIframe ? this.clientHeight - 120 + this.iframeHeight + 'px' : this.clientHeight - 120 + 'px' + return this.$store.state.inIframe ? this.clientHeight - 230 + this.iframeHeight + 'px' : this.clientHeight - 230 + 'px' }, treeHeight () { - return this.$store.state.inIframe ? this.clientHeight - 200 + this.iframeHeight + 'px' : this.clientHeight - 200 + 'px' + return this.$store.state.inIframe ? this.clientHeight - 310 + this.iframeHeight + 'px' : this.clientHeight - 310 + 'px' }, - ...mapGetters(['clientHeight', 'iframeHeight']) + ...mapGetters(['clientHeight', 'iframeHeight']), + + dataRule () { + return { + deptName:[ + { required: true, message: "请选择", trigger: "blur" } + ] + } + } }, methods: { - async loadTree (isRefresh) { + async loadTree () { + if (this.agencyId.length === 0 || !this.agencyId) { + return this.$message.error('请选择所属组织') + } + this.treeLoading = true const url = "/pli/power/data/axis/structTree" let params = { - agencyId: '1495655378069753857' + agencyId: this.agencyId[this.agencyId.length-1] } const { data, code, msg } = await requestPost(url, params) + this.treeLoading = false if (code === 0) { this.treeData = data - if (!isRefresh && data.length > 0) { - this.selTreeObj = data[0] - if (!this.selTreeObj.latitude) { - this.selTreeObj.latitude = this.centerPoint[0] - } - if (!this.selTreeObj.longitude) { - this.selTreeObj.longitude = this.centerPoint[1] - } - } } else { this.$message.error(msg) } @@ -95,20 +116,55 @@ export default { if (!value) return true; return data.name.indexOf(value) !== -1; }, - // 开启加载动画 - startLoading () { - loading = Loading.service({ - lock: true, // 是否锁定 - text: '正在加载……', // 加载中需要显示的文字 - background: 'rgba(0,0,0,.7)' // 背景颜色 - }) + // 获取组织列表 + async getAgencyTree(){ + const url = '/data/aggregator/org/agencytree' + + let params = { + agencyId:this.agencyId, + client:'gov' + } + + const { data, code, msg } = await requestPost(url,params) + + if (code === 0) { + let _data + if (data) { + _data = this.removeByOrgType(data, 'agency') + if (_data) { + this.agencytree = this.removeEmptySubOrgList(_data) + } + } + } else { + this.$message.error(msg) + } }, - // 结束加载动画 - endLoading () { - // clearTimeout(timer); - if (loading) { - loading.close() - } + removeByOrgType (orgArray, orgType) { + if (orgArray && orgArray.length > 0) { + for (let p = orgArray.length - 1; p >= 0; p--) { + let orgInfo = orgArray[p] + if (orgInfo) { + if (orgInfo.orgType !== orgType) { + orgArray.splice(p, 1) + } else { + this.removeByOrgType(orgInfo.subOrgList, orgType) + } + } + } + } + return orgArray + }, + removeEmptySubOrgList (orgArray) { + orgArray.forEach((orgInfo) => { + if (orgInfo && orgInfo.subOrgList) { + if (orgInfo.subOrgList.length === 0) { + orgInfo.subOrgList = undefined + } else { + this.removeEmptySubOrgList(orgInfo.subOrgList) + } + } + }) + return orgArray; } }, watch: { @@ -122,7 +178,15 @@ export default { }