feat:【infra】代码生成:字典筛选时,支持 key、name 两种类型

This commit is contained in:
YunaiV
2026-01-02 18:12:23 +08:00
parent 6d524906a3
commit 036ef294db
2 changed files with 47 additions and 3 deletions

View File

@@ -61,6 +61,24 @@ const dictTypeOptions = ref<SystemDictTypeApi.DictType[]>([]); // 字典类型
onMounted(async () => {
dictTypeOptions.value = await getSimpleDictTypeList();
});
/** 字典类型过滤:支持 type 或 name忽略大小写 */
function filterDictTypeOption(input: string, option: any) {
if (!option?.key) {
return false;
}
const searchValue = input.toLowerCase();
const dictType = dictTypeOptions.value.find(
(item) => item.type === option.key,
);
if (!dictType) {
return false;
}
return (
dictType.type.toLowerCase().includes(searchValue) ||
dictType.name.toLowerCase().includes(searchValue)
);
}
</script>
<template>
@@ -142,6 +160,7 @@ onMounted(async () => {
class="w-full"
allow-clear
show-search
:filter-option="filterDictTypeOption"
>
<Select.Option
v-for="option in dictTypeOptions"