| | |
| | | }; |
| | | |
| | | const userOptions = ref<SystemUserApi.User[]>([]); // 用户列表 |
| | | |
| | | /** |
| | | * 用户下拉的搜索过滤:按昵称模糊匹配(忽略大小写)。 |
| | | */ |
| | | function filterUserOption(input: string, option: any) { |
| | | const keyword = (input || '').trim().toLowerCase(); |
| | | if (!keyword) { |
| | | return true; |
| | | } |
| | | const label = String(option?.label ?? option?.nickname ?? ''); |
| | | return label.toLowerCase().includes(keyword); |
| | | } |
| | | |
| | | onMounted(async () => { |
| | | // 获得用户列表 |
| | | userOptions.value = await getSimpleUserList(); |
| | |
| | | v-model:value="assignEmptyUserIds" |
| | | allow-clear |
| | | mode="multiple" |
| | | show-search |
| | | option-filter-prop="label" |
| | | :filter-option="filterUserOption" |
| | | placeholder="请输入用户名称搜索" |
| | | style="width: 100%" |
| | | @change="updateAssignEmptyUserIds" |
| | | > |
| | | <SelectOption |
| | | v-for="item in userOptions" |
| | | :key="item.id" |
| | | :label="item.nickname" |
| | | :value="item.id" |
| | | > |
| | | {{ item.nickname }} |