From 9e86b9cb1b39c93ea3bcf916dc1b66791fb2da30 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Tue, 3 Aug 2021 18:49:19 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=B7=BB=E5=8A=A0=E6=88=90?= =?UTF-8?q?=E5=91=98=E6=97=B6=E5=8F=AF=E6=A0=B9=E6=8D=AEid=E6=88=96name?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/settings/common/AddMember.vue | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/frontend/src/business/components/settings/common/AddMember.vue b/frontend/src/business/components/settings/common/AddMember.vue index 42309a0bab..e30aa93521 100644 --- a/frontend/src/business/components/settings/common/AddMember.vue +++ b/frontend/src/business/components/settings/common/AddMember.vue @@ -9,6 +9,7 @@ v-model="form.userIds" multiple filterable + :filter-method="userFilter" :popper-append-to-body="false" class="select-width" :placeholder="$t('member.please_choose_member')"> @@ -63,6 +64,7 @@ export default { ] }, userList: [], + copyUserList: [], result: {} } }, @@ -96,6 +98,7 @@ export default { this.dialogVisible = true; this.result = this.$get('/user/list/', response => { this.userList = response.data; + this.copyUserList = response.data; }) this.result = this.$post('/user/group/list', {type: this.groupType, resourceId: this.groupScopeId}, response => { this.$set(this.form, "groups", response.data); @@ -104,6 +107,17 @@ export default { close() { this.dialogVisible = false; this.form = {}; + }, + userFilter(val) { + if (val) { + this.userList = this.copyUserList.filter((item) => { + if (!!~item.id.indexOf(val) || (item.name && !!~item.name.indexOf(val))) { + return true; + } + }) + } else { + this.userList = this.copyUserList; + } } } }