diff --git a/src/pages/regulatoryRepository/enterpriseStandardPlan/index.vue b/src/pages/regulatoryRepository/enterpriseStandardPlan/index.vue index a48a0c3ba..6440abd35 100644 --- a/src/pages/regulatoryRepository/enterpriseStandardPlan/index.vue +++ b/src/pages/regulatoryRepository/enterpriseStandardPlan/index.vue @@ -1100,32 +1100,36 @@ this.modalshowflag2 = true }, checkedRole2 (data) { + let idList = '' let nameList = '' - let bmIdList = '' - let bmNameList = '' data.forEach( item => { if (nameList.length > 0) { nameList += ',' idList += ',' - bmIdList += ',' - bmNameList += ',' } idList += item.id nameList += item.name - bmIdList += item.topUnitId - bmNameList += item.topUnit }) + if (this.type === 'resPerson') { this.addForm.resPerson = idList this.addForm.resPersonName = nameList } else if (this.type === 'drafter') { this.addForm.drafter = idList this.addForm.drafterName = nameList - this.addForm.unitName = bmNameList - this.addForm.unit = bmIdList + if(data && data.length > 0){ + const institutionIdList = this.unique(data.map(item => item.topUnitId)).join(",") + const institutionNameList = this.unique(data.map(item => item.topUnit)).join(",") + this.addForm.unitName = institutionNameList + this.addForm.unit = institutionIdList + } } }, + unique(newArr) { + const res = new Map(); + return newArr.filter((newArr) => !res.has(newArr) && res.set(newArr, 1)); + }, addDrawerSubmit () { this.$refs['addForm'].validate((valid) => { if (valid) {