From e5ca6d6ddc37243494be79df9be92afd666c9140 Mon Sep 17 00:00:00 2001 From: qq787203167 <787203167@qq.com> Date: Wed, 24 Aug 2022 14:38:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A6=85=E9=81=93=E5=B7=B2?= =?UTF-8?q?=E7=9F=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/PersonnelSelection/index.vue | 62 ++++++++++--------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/jero-web/src/components/PersonnelSelection/index.vue b/jero-web/src/components/PersonnelSelection/index.vue index 476db1404..223a07302 100644 --- a/jero-web/src/components/PersonnelSelection/index.vue +++ b/jero-web/src/components/PersonnelSelection/index.vue @@ -89,7 +89,7 @@ this.searchModel = '' this.userIds = [] this.userName = [] - this.queryDepartUserTreeList() + this.queryDepartUserTreeList(1) this.visible = true }, standardDelete() { @@ -146,7 +146,7 @@ }) }) } - if (this.userName.length > 0){ + if (this.userName.length > 0) { for (let i = 0; i < this.userName.length; i++) { for (let j = i + 1; j < this.userName.length; j++) { if (this.userName[i] == this.userName[j]) { @@ -171,7 +171,6 @@ } let userIds = JSON.parse(JSON.stringify(this.userIds)) let userName = JSON.parse(JSON.stringify(this.userName)) - console.log(userName) this.$emit('input', userName.join(',')) this.$emit('change', this.query.db_field_name, userIds.join(','), this.query.subscript) this.visible = false @@ -195,7 +194,8 @@ if (e) { this.getUserAndDepart() } else { - this.queryDepartUserTreeList() + this.treeVisible = false + this.queryDepartUserTreeList(2) } }, getUserAndDepart() { @@ -214,12 +214,12 @@ if (this.departId == val.node.value) { } else { this.departId = val.node.value - this.queryDepartUserTreeList() + this.queryDepartUserTreeList(2) } } } }, - queryDepartUserTreeList() { + queryDepartUserTreeList(num) { let gData = JSON.parse(JSON.stringify(this.gData)) if (gData && gData.length > 0) { gData = JSON.stringify(gData) @@ -236,32 +236,34 @@ if (res.success) { this.gData = res.result this.defaultExpandedKeys = [this.departId] - if (this.userName && this.userName.length == 0) { - if (this.personneQuery[this.query.db_field_name + 'Name']) { - this.userName = this.personneQuery[this.query.db_field_name + 'Name'].split(',') - } else if (this.personneQuery[this.query.db_field_name]) { - this.userName = this.personneQuery[this.query.db_field_name].split(',') - } else { - this.userName = [] + if (num == 1) { + if (this.userName && this.userName.length == 0) { + if (this.personneQuery[this.query.db_field_name + 'Name']) { + this.userName = this.personneQuery[this.query.db_field_name + 'Name'].split(',') + } else if (this.personneQuery[this.query.db_field_name]) { + this.userName = this.personneQuery[this.query.db_field_name].split(',') + } else { + this.userName = [] + } } - } - if (this.userIds && this.userIds.length == 0) { - if (this.personneQuery[this.query.db_field_name + '_id']) { - this.userIds = this.personneQuery[this.query.db_field_name + '_id'].split(',') - } else if (this.personneQuery[this.query.db_field_name]) { - this.userIds = this.personneQuery[this.query.db_field_name].split(',') - } else { - this.userIds = [] + if (this.userIds && this.userIds.length == 0) { + if (this.personneQuery[this.query.db_field_name + '_id']) { + this.userIds = this.personneQuery[this.query.db_field_name + '_id'].split(',') + } else if (this.personneQuery[this.query.db_field_name]) { + this.userIds = this.personneQuery[this.query.db_field_name].split(',') + } else { + this.userIds = [] + } } - } - this.defaultCheckedKeys = this.userIds - this.defaultCheckedKeysName = [] - if (this.defaultCheckedKeys.length > 0) { - for (let i = 0; i < this.defaultCheckedKeys.length; i++) { - this.defaultCheckedKeysName.push({ - id: this.defaultCheckedKeys[i], - name: this.userName[i] - }) + this.defaultCheckedKeys = this.userIds + this.defaultCheckedKeysName = [] + if (this.defaultCheckedKeys.length > 0) { + for (let i = 0; i < this.defaultCheckedKeys.length; i++) { + this.defaultCheckedKeysName.push({ + id: this.defaultCheckedKeys[i], + name: this.userName[i] + }) + } } } this.treeVisible = true