diff --git a/frontend/src/business/components/settings/components/PersonRouter.vue b/frontend/src/business/components/settings/components/PersonRouter.vue index 3207f6a922..96af4c6fd5 100644 --- a/frontend/src/business/components/settings/components/PersonRouter.vue +++ b/frontend/src/business/components/settings/components/PersonRouter.vue @@ -29,7 +29,6 @@ - diff --git a/frontend/src/business/components/settings/system/EditUser.vue b/frontend/src/business/components/settings/system/EditUser.vue index 4893121099..9befce7785 100644 --- a/frontend/src/business/components/settings/system/EditUser.vue +++ b/frontend/src/business/components/settings/system/EditUser.vue @@ -27,7 +27,7 @@ :prop="'groups.' + index + '.type'" :rules="{required: true, message: $t('user.select_group'), trigger: 'change'}" > - + class="edit-user-select" @change="updateWorkSpace(group.index,group.type)"> + class="edit-user-select" @change="setWorkSpaceIds(group.ids,group.projects)"> { let data = res.data; @@ -349,9 +358,17 @@ export default { roleInfo.selects.push(id); }) roleInfo.type = "ws_member+WORKSPACE"; - roleInfo.ids = []; + if (this.currentGroupWSIds.size > 0) { + roleInfo.ids = []; + this.currentGroupWSIds.forEach(item =>{ + roleInfo.ids.push(item); + }) + } else { + roleInfo.ids = []; + } let groups = this.form.groups; groups.push(roleInfo); + this.currentWSGroupIndex = index+1; this._setResource(data, index+1, 'WORKSPACE'); } }) @@ -359,6 +376,28 @@ export default { getLabel(index) { let a = index + 1; return this.$t('commons.group') + a; + }, + setWorkSpaceIds(ids,projects){ + projects.forEach(project => { + ids.forEach(item =>{ + if(item === project.id){ + this.currentGroupWSIds.add(project.workspaceId); + if(this.form.groups[this.currentWSGroupIndex].ids.indexOf(project.workspaceId) === -1){ + this.form.groups[this.currentWSGroupIndex].ids.push(project.workspaceId); + } + } + }) + }); + }, + updateWorkSpace(index,type){ + let _type = type.split("+")[1]; + if (_type === 'WORKSPACE') { + this.currentGroupWSIds.forEach(item =>{ + this.form.groups[index].ids.push(item); + }) + }else { + this.form.groups[index].ids = []; + } } } }