mirror of https://github.com/halo-dev/halo
feat: add support for multiple roles during user creation (#7381)
#### What type of PR is this? /kind feature /area ui /milestone 2.20.x #### What this PR does / why we need it: Add support for multiple roles during user creation #### Which issue(s) this PR fixes: Fixes #7325 #### Does this PR introduce a user-facing change? ```release-note 新建用户时支持设置多个角色 ```pull/7386/head
parent
7a315302a8
commit
4235fd1eda
|
@ -31,7 +31,6 @@ const formState = ref<CreateUserRequest>({
|
|||
password: "",
|
||||
roles: [],
|
||||
});
|
||||
const selectedRole = ref("");
|
||||
const isSubmitting = ref(false);
|
||||
|
||||
onMounted(() => {
|
||||
|
@ -42,10 +41,6 @@ const handleCreateUser = async () => {
|
|||
try {
|
||||
isSubmitting.value = true;
|
||||
|
||||
if (selectedRole.value) {
|
||||
formState.value.roles = [selectedRole.value];
|
||||
}
|
||||
|
||||
await consoleApiClient.user.createUser({
|
||||
createUserRequest: formState.value,
|
||||
});
|
||||
|
@ -122,10 +117,12 @@ const handleCreateUser = async () => {
|
|||
matches: $t('core.formkit.validation.password'),
|
||||
}"
|
||||
></FormKit>
|
||||
<!-- @vue-ignore -->
|
||||
<FormKit
|
||||
v-model="selectedRole"
|
||||
v-model="formState.roles"
|
||||
:label="$t('core.user.grant_permission_modal.fields.role.label')"
|
||||
type="roleSelect"
|
||||
multiple
|
||||
validation="required"
|
||||
></FormKit>
|
||||
<FormKit
|
||||
|
|
Loading…
Reference in New Issue