fix: fix project manage user group

Fix project remove user group

Change-Id: I4f80998c859d1ee10978fc19c6dd42fcf25a69a6
This commit is contained in:
Jingwei.Zhang 2022-06-16 11:21:03 +08:00
parent 0896ebc917
commit 5ca7528ef2

View File

@ -152,6 +152,21 @@ export class ManageUserGroup extends ModalAction {
this.setState({ groupRoles });
};
onChangeUserGroup = (value) => {
const { groupRoles } = this.state;
(value || []).forEach((groupId) => {
if (!groupRoles[groupId]) {
groupRoles[groupId] = this.defaultRoles(groupId);
}
});
Object.keys(groupRoles).forEach((groupId) => {
if (!(value || []).includes(groupId)) {
delete groupRoles[groupId];
}
});
this.setState(groupRoles);
};
get defaultValue() {
const { name, domainName } = this.item;
const data = {
@ -186,6 +201,7 @@ export class ManageUserGroup extends ModalAction {
showSearch: true,
oriTargetKeys: groups ? Object.keys(groups) : [],
filterOption: transferFilterOption,
onChange: this.onChangeUserGroup,
wrapperCol: this.wrapperCol,
loading: this.userGroupStore.list.isLoading,
},