fix: repair user role select
This commit is contained in:
parent
86e398f96f
commit
246697871c
@ -1,5 +1,5 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive, ref, watch } from 'vue';
|
import { computed, reactive, ref, watch } from 'vue';
|
||||||
|
|
||||||
import type { LegacyUser } from '#/api/legacy/system';
|
import type { LegacyUser } from '#/api/legacy/system';
|
||||||
import { addUser, getRoles, updateUser } from '#/api/legacy/system';
|
import { addUser, getRoles, updateUser } from '#/api/legacy/system';
|
||||||
@ -11,7 +11,6 @@ import {
|
|||||||
FormItem,
|
FormItem,
|
||||||
Input,
|
Input,
|
||||||
Select,
|
Select,
|
||||||
SelectOption,
|
|
||||||
Space,
|
Space,
|
||||||
message,
|
message,
|
||||||
} from 'antdv-next';
|
} from 'antdv-next';
|
||||||
@ -29,6 +28,12 @@ const emit = defineEmits<{
|
|||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const roleLoading = ref(false);
|
const roleLoading = ref(false);
|
||||||
const roles = ref<Array<Record<string, any>>>([]);
|
const roles = ref<Array<Record<string, any>>>([]);
|
||||||
|
const roleOptions = computed(() =>
|
||||||
|
roles.value.map((item) => ({
|
||||||
|
label: item.roleName,
|
||||||
|
value: item.id,
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
|
||||||
const form = reactive<Record<string, any>>({
|
const form = reactive<Record<string, any>>({
|
||||||
email: '',
|
email: '',
|
||||||
@ -175,21 +180,14 @@ async function handleSubmit() {
|
|||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="角色">
|
<FormItem label="角色">
|
||||||
<Select option-label-prop="children"
|
<Select
|
||||||
v-model:value="form.roleIds"
|
v-model:value="form.roleIds"
|
||||||
:disabled="loading"
|
:disabled="loading"
|
||||||
:loading="roleLoading"
|
:loading="roleLoading"
|
||||||
mode="multiple"
|
mode="multiple"
|
||||||
|
:options="roleOptions"
|
||||||
placeholder="请选择角色"
|
placeholder="请选择角色"
|
||||||
>
|
/>
|
||||||
<SelectOption
|
|
||||||
v-for="item in roles"
|
|
||||||
:key="item.id"
|
|
||||||
:value="item.id"
|
|
||||||
>
|
|
||||||
{{ item.roleName }}
|
|
||||||
</SelectOption>
|
|
||||||
</Select>
|
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user