From f72543723a6e8b7f70a18d4407391f06d543e1ec Mon Sep 17 00:00:00 2001 From: luyan Date: Wed, 25 Oct 2023 18:22:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=8B=E4=BB=B6=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E7=9A=84=E5=BC=82=E5=B8=B8=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../regionalParty/activitys.vue | 8 ----- .../event/cpts/process-form-designate.vue | 25 ++++++++++++- .../event/cpts/process-form-replay-end.vue | 27 ++++++++++---- .../event/cpts/process-form-replay.vue | 35 ++++++++++--------- 4 files changed, 63 insertions(+), 32 deletions(-) diff --git a/src/views/modules/communityParty/regionalParty/activitys.vue b/src/views/modules/communityParty/regionalParty/activitys.vue index 2ff7c01e0..bbd1009ae 100644 --- a/src/views/modules/communityParty/regionalParty/activitys.vue +++ b/src/views/modules/communityParty/regionalParty/activitys.vue @@ -366,28 +366,20 @@ export default { async loadUnit () { const url = "/actual/base/icpartyunit/option" - // const url = "http://yapi.elinkservice.cn/mock/245/heart/icpartyunit/option" - let params = { agencyId: this.agencyId } - const { data, code, msg } = await requestPost(url, params) - if (code === 0) { this.unitList = data - } else { this.$message.error(msg) } - }, //获取服务事项下拉框 async loadService () { const url = "/actual/base/serviceitem/dict-list" - - let params = { // parentCategoryCode: '1010' } diff --git a/src/views/modules/shequzhili/event/cpts/process-form-designate.vue b/src/views/modules/shequzhili/event/cpts/process-form-designate.vue index fdd39d220..14e4e6488 100644 --- a/src/views/modules/shequzhili/event/cpts/process-form-designate.vue +++ b/src/views/modules/shequzhili/event/cpts/process-form-designate.vue @@ -177,6 +177,29 @@ export default { } else { this.$message.error(msg); } + if (this.eventDetailCopy.parentCategoryId) { + const pids = this.eventDetailCopy.parentCategoryId.split(','); + pids.push(this.eventDetailCopy.categoryId); + let nodes = this.casOptions; + for (let i = 0; i < pids.length; i++) { + nodes = this.buildNode(nodes, pids[i]) + } + if (nodes) { + this.formData.categoryList.push(nodes) + this.selCateObj = nodes + } + } + }, + buildNode(nodes, treeId) { + for (let i = 0; i < nodes.length; i++) { + if (nodes[i].id === treeId) { + if (nodes[i].children) { + return nodes[i].children + } else { + return nodes[i] + } + } + } }, handleChangeAgency(val) { let obj = this.$refs["agencyIdArray"].getCheckedNodes()[0].data @@ -223,7 +246,7 @@ export default { this.$message.error("请选择事件分类"); return false; } - if(this.fileList){ + if (this.fileList) { this.formData.files = this.fileList } this.formData.status = "processing"; diff --git a/src/views/modules/shequzhili/event/cpts/process-form-replay-end.vue b/src/views/modules/shequzhili/event/cpts/process-form-replay-end.vue index 570051c5a..77e7d39ad 100644 --- a/src/views/modules/shequzhili/event/cpts/process-form-replay-end.vue +++ b/src/views/modules/shequzhili/event/cpts/process-form-replay-end.vue @@ -128,15 +128,28 @@ export default { } else { this.$message.error(msg); } + if (this.eventDetailCopy.parentCategoryId) { + const pids = this.eventDetailCopy.parentCategoryId.split(','); + pids.push(this.eventDetailCopy.categoryId); + let nodes = this.casOptions; + for (let i = 0; i < pids.length; i++) { + nodes = this.buildNode(nodes, pids[i]) + } + if (nodes) { + this.formData.categoryList.push(nodes) + } + } }, - buildTree(nodes, treeId) { - nodes.forEach(item => { - if (treeId === item.id) { - return item; - } else { - this.buildTree(item.children, treeId) + buildNode(nodes, treeId) { + for (let i = 0; i < nodes.length; i++) { + if (nodes[i].id === treeId) { + if (nodes[i].children) { + return nodes[i].children + } else { + return nodes[i] + } } - }) + } }, handleChangeCate() { if (this.selCateObj = this.$refs['myCascader'].getCheckedNodes()[0]) { diff --git a/src/views/modules/shequzhili/event/cpts/process-form-replay.vue b/src/views/modules/shequzhili/event/cpts/process-form-replay.vue index e0b84438c..72a923867 100644 --- a/src/views/modules/shequzhili/event/cpts/process-form-replay.vue +++ b/src/views/modules/shequzhili/event/cpts/process-form-replay.vue @@ -122,24 +122,27 @@ export default { this.$message.error(msg); } if (this.eventDetailCopy.parentCategoryId) { - let pids = this.eventDetailCopy.parentCategoryId.split(','); - pids.push(this.eventDetailCopy.categoryId) - pids.forEach(id => { - let node = this.buildTree(this.casOptions, toString(id)); - this.selCategoryArray.push(node) - }); - let node = this.buildTree(this.casOptions, this.eventDetailCopy.categoryId); - this.selCategoryArray.push(node); + const pids = this.eventDetailCopy.parentCategoryId.split(','); + pids.push(this.eventDetailCopy.categoryId); + let nodes = this.casOptions; + for (let i = 0; i < pids.length; i++) { + nodes = this.buildNode(nodes,pids[i]) + } + if(nodes){ + this.formData.categoryList.push(nodes) + } } }, - buildTree(nodes, treeId) { - nodes.forEach(item => { - if (treeId === item.id) { - return item; - } else { - this.buildTree(item.children, treeId) + buildNode(nodes, treeId) { + for(let i = 0; i < nodes.length; i++){ + if (nodes[i].id === treeId) { + if(nodes[i].children){ + return nodes[i].children + }else { + return nodes[i] + } } - }) + } }, handleChangeCate(value) { if (this.selCateObj = this.$refs['myCascader'].getCheckedNodes()[0]) { @@ -148,7 +151,7 @@ export default { } else { this.selCateObj = {} } - if(!value) return + if (!value) return this.selCategoryArray = value }, //重构树,去除网格