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: "",
|
password: "",
|
||||||
roles: [],
|
roles: [],
|
||||||
});
|
});
|
||||||
const selectedRole = ref("");
|
|
||||||
const isSubmitting = ref(false);
|
const isSubmitting = ref(false);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -42,10 +41,6 @@ const handleCreateUser = async () => {
|
||||||
try {
|
try {
|
||||||
isSubmitting.value = true;
|
isSubmitting.value = true;
|
||||||
|
|
||||||
if (selectedRole.value) {
|
|
||||||
formState.value.roles = [selectedRole.value];
|
|
||||||
}
|
|
||||||
|
|
||||||
await consoleApiClient.user.createUser({
|
await consoleApiClient.user.createUser({
|
||||||
createUserRequest: formState.value,
|
createUserRequest: formState.value,
|
||||||
});
|
});
|
||||||
|
@ -122,10 +117,12 @@ const handleCreateUser = async () => {
|
||||||
matches: $t('core.formkit.validation.password'),
|
matches: $t('core.formkit.validation.password'),
|
||||||
}"
|
}"
|
||||||
></FormKit>
|
></FormKit>
|
||||||
|
<!-- @vue-ignore -->
|
||||||
<FormKit
|
<FormKit
|
||||||
v-model="selectedRole"
|
v-model="formState.roles"
|
||||||
:label="$t('core.user.grant_permission_modal.fields.role.label')"
|
:label="$t('core.user.grant_permission_modal.fields.role.label')"
|
||||||
type="roleSelect"
|
type="roleSelect"
|
||||||
|
multiple
|
||||||
validation="required"
|
validation="required"
|
||||||
></FormKit>
|
></FormKit>
|
||||||
<FormKit
|
<FormKit
|
||||||
|
|
Loading…
Reference in New Issue