From 0e046a1b4875d1e4d26eaa06930fa5c34119a855 Mon Sep 17 00:00:00 2001 From: jiangyy Date: Thu, 23 Sep 2021 14:23:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E5=B8=83=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 1 + src/views/form/editor/RightPanel.vue | 6 + src/views/form/index.vue | 287 ++++++----- src/views/form/publish/index.vue | 184 ++++--- src/views/form/statistics/analysis.vue | 346 ++++++------- src/views/form/statistics/chart.vue | 650 +++++++++++++------------ src/views/form/statistics/list.vue | 596 ++++++++++++----------- src/views/form/statistics/public.vue | 310 ++++++------ 8 files changed, 1236 insertions(+), 1144 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 29d4cb5..6b11109 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -52,6 +52,7 @@ router.beforeEach((to, from, next) => { console.log('ro.query', to.query) localStorage.setItem('loginSource', 'epmet') + localStorage.setItem('customerId', to.query.customerId) store.dispatch('user/getUserInfo', to.query.token) store.dispatch('user/setTokens', to.query.token) next() diff --git a/src/views/form/editor/RightPanel.vue b/src/views/form/editor/RightPanel.vue index a936fb9..17e4ce8 100644 --- a/src/views/form/editor/RightPanel.vue +++ b/src/views/form/editor/RightPanel.vue @@ -971,6 +971,7 @@ export default { loading: null, currentTab: "field", currentNode: null, + currentPID: Number, dialogVisible: false, iconsVisible: false, currentIconModel: null, @@ -1215,6 +1216,7 @@ export default { }, addTreeItem () { ++this.idGlobal; + this.currentPID = 0 this.dialogVisible = true; this.currentNode = this.activeData.options; }, @@ -1238,10 +1240,12 @@ export default { ); }, append (data) { + if (!data.children) { this.$set(data, "children", []); } this.dialogVisible = true; + this.currentPID = data.id this.currentNode = data.children; }, remove (node, data) { @@ -1252,6 +1256,8 @@ export default { children.splice(index, 1); }, addNode (data) { + debugger + data.pid = this.currentPID this.currentNode.push(data); }, setOptionValue (item, val) { diff --git a/src/views/form/index.vue b/src/views/form/index.vue index 952b050..ee8da10 100644 --- a/src/views/form/index.vue +++ b/src/views/form/index.vue @@ -1,6 +1,6 @@ diff --git a/src/views/form/publish/index.vue b/src/views/form/publish/index.vue index a8dc3f0..7ae76bf 100644 --- a/src/views/form/publish/index.vue +++ b/src/views/form/publish/index.vue @@ -4,34 +4,40 @@
- + - - 居民端 - 工作端 + + 居民端 + 工作端 - + :default-expand-all="true" />
-
+
开始发布 +

恭喜您,发布成功!

- +
+ +
- + + @@ -115,71 +121,112 @@ export default { clientType: 'resi', props: { - // label: 'name', - // children: 'zones' + label: 'orgName', + children: 'subOrgList' }, count: 1, data: [{ - id: 1, - label: '一级 1', - children: [{ - id: 4, - label: '二级 1-1', - children: [{ - id: 9, - label: '三级 1-1-1' + orgId: 1, + orgName: '一级 1', + subOrgList: [{ + orgId: 4, + orgName: '二级 1-1', + subOrgList: [{ + orgId: 9, + orgName: '三级 1-1-1' }, { - id: 10, - label: '三级 1-1-2' + orgId: 10, + orgName: '三级 1-1-2' }] }] }, { - id: 2, - label: '一级 2', - children: [{ - id: 5, - label: '二级 2-1' + orgId: 2, + orgName: '一级 2', + subOrgList: [{ + orgId: 5, + orgName: '二级 2-1' }, { - id: 6, - label: '二级 2-2' + orgId: 6, + orgName: '二级 2-2' }] }, { - id: 3, - label: '一级 3', - children: [{ - id: 7, - label: '二级 3-1' + orgId: 3, + orgName: '一级 3', + subOrgList: [{ + orgId: 7, + orgName: '二级 3-1' }, { - id: 8, - label: '二级 3-2' + orgId: 8, + orgName: '二级 3-2' }] - }] + }], + + selAgencyList: [], + agencyArrayCopy: [] } }, mounted () { this.projectKey = this.$route.query.key let url = window.location.protocol + '//' + window.location.host this.writeLink = `${url}/s/${this.projectKey}` + this.getProjectStatus() }, methods: { - currentChange (data, node) { - console.log(data, node) - }, - check () { + clientChange (label) { + this.clientType = label + this.loadAgencyList() }, - handleCheckChange (data, checked, indeterminate) { - data.select = true - console.log(data, checked, indeterminate) - // console.log('树'); - // console.log(this.data) + + loadAgencyList () { + const customerId = localStorage.getItem('customerId') + let params = { + client: this.clientType, + agencyId: customerId + } + this.$api.post(`/data/aggregator/org/agencytree`, params).then((res) => { + debugger + }) }, - nodeClick (a, b, c) { - console.log(a, b, c) + + //解析树选择的数据 + resolveAgency () { + let selAll = this.$refs.tree.getCheckedNodes(false, false) + // console.log(selAll) + + this.selAgencyList = [] + this.agencyArrayCopy = JSON.parse(JSON.stringify(this.data)) + + selAll.forEach(element => { + // debugger + let orgId = element.orgId + this.resursionTree(this.agencyArrayCopy, orgId) + }); + + console.log(this.selAgencyList) }, - handleNodeClick (data) { - // console.log(data); + + //递归树 + resursionTree (orgArray, orgId) { + for (let i = 0; i < orgArray.length; i++) { + let item = orgArray[i] + // debugger + if (item && item.orgId === orgId) { + // debugger + this.selAgencyList.push(orgArray[i]) + orgArray[i] = {} + break + + } else if (item.subOrgList && item.subOrgList.length > 0) { + // debugger + this.resursionTree(item.subOrgList, orgId) + + } + } + // console.log(this.agencyArrayCopy) + + }, getProjectStatus () { @@ -188,16 +235,16 @@ export default { this.publishStatus = true } else { this.publishStatus = false + this.loadAgencyList() } }) }, publishProject () { - const aaa = this.$refs.tree.getCheckedNodes(false, false) - console.log(aaa) - // this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/publish`, { key: this.projectKey }).then(() => { - // this.publishStatus = true - // this.msgSuccess('发布成功') - // }) + + this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/publish`, { key: this.projectKey }).then(() => { + this.publishStatus = true + this.msgSuccess('发布成功') + }) }, stopPublishProject () { this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/stop`, { 'key': this.projectKey }).then(res => { @@ -284,4 +331,7 @@ export default { font-size: 14px; } } +.form_item { + padding-left: 20px; +} diff --git a/src/views/form/statistics/analysis.vue b/src/views/form/statistics/analysis.vue index 6270f6a..ba73c12 100644 --- a/src/views/form/statistics/analysis.vue +++ b/src/views/form/statistics/analysis.vue @@ -1,192 +1,192 @@ diff --git a/src/views/form/statistics/chart.vue b/src/views/form/statistics/chart.vue index d8cc329..f5e29ff 100644 --- a/src/views/form/statistics/chart.vue +++ b/src/views/form/statistics/chart.vue @@ -1,55 +1,63 @@ diff --git a/src/views/form/statistics/list.vue b/src/views/form/statistics/list.vue index dc46c0b..db083b6 100644 --- a/src/views/form/statistics/list.vue +++ b/src/views/form/statistics/list.vue @@ -1,326 +1,331 @@ @@ -380,5 +385,4 @@ export default { ::v-deep .el-drawer__container ::-webkit-scrollbar { display: none; } - diff --git a/src/views/form/statistics/public.vue b/src/views/form/statistics/public.vue index f62b2ad..1d6f88f 100644 --- a/src/views/form/statistics/public.vue +++ b/src/views/form/statistics/public.vue @@ -1,40 +1,36 @@