Merge "fix: fix project manage user group"

This commit is contained in:
Zuul 2022-06-16 06:15:30 +00:00 committed by Gerrit Code Review
commit 1cebcc97bc

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,
},