From 88bfa894cd5a8feaca5d09b889113b93a7c11303 Mon Sep 17 00:00:00 2001 From: shenzhouyu Date: Fri, 23 May 2025 17:09:08 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=93=E6=A1=88=E4=BA=BA=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../machine/modules/machineProjectCloseAuthForm.vue | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/views/modules/machine/modules/machineProjectCloseAuthForm.vue b/src/views/modules/machine/modules/machineProjectCloseAuthForm.vue index 606fd97..50f7f64 100644 --- a/src/views/modules/machine/modules/machineProjectCloseAuthForm.vue +++ b/src/views/modules/machine/modules/machineProjectCloseAuthForm.vue @@ -108,7 +108,7 @@ export default { /** * 查询可用角色 */ - authGroupBusinessSearch() { + authGroupBusinessSearch() { let obj = { site: this.$store.state.user.site, username: this.searchAuthBusinessData.username, @@ -241,17 +241,24 @@ export default { } this.isAuthBusinessList.push(obj) } + //去除选中所有userId相同的,确保唯一 + let newArray = this.isAuthBusinessList.filter( + (item, index, self) => + index === self.findIndex((t) => t.userId === item.userId) + ) + this.isAuthBusinessList = newArray + //将选中的user提取出来,去除可选人选中对应的user let ids = [] for (let i = 0; i < this.isAuthBusinessList.length; i++) { ids.push(this.isAuthBusinessList[i].userId) } - + for (let i = 0; i < ids.length; i++) { let index = this.allAuthBusinessList.findIndex( (obj) => obj.userId == ids[i] ) if (index != -1) { - this.allAuthBusinessList.splice(index, 1) + this.allAuthBusinessList.splice(index, 1) } } } else {