chore: 字典数据

This commit is contained in:
dap 2024-10-07 17:45:34 +08:00
parent 81e2fa856a
commit 7140374a12

View File

@ -1,15 +1,36 @@
import type { FormSchemaGetter, VxeGridProps } from '#/adapter'; import type { FormSchemaGetter, VxeGridProps } from '#/adapter';
import { reactive } from 'vue';
import { getPopupContainer } from '@vben/utils'; import { getPopupContainer } from '@vben/utils';
import { dictOptionSelectList } from '#/api/system/dict/dict-type';
import { renderDictTag } from '#/utils/render'; import { renderDictTag } from '#/utils/render';
/**
* updateSchema无法赋值
* TODO: 使用updateSchema重构
*/
const dictTypeOptions = reactive<{ label: string; value: string }[]>([]);
(async () => {
const resp = await dictOptionSelectList();
const options = resp.map((item) => ({
label: item.dictName,
value: item.dictType,
}));
dictTypeOptions.push(...options);
})();
export const querySchema: FormSchemaGetter = () => [ export const querySchema: FormSchemaGetter = () => [
{ {
component: 'Select', component: 'Select',
dependencies: {
show: () => false,
triggerFields: [''],
},
componentProps: { componentProps: {
placeholder: 'TODO: 字典类型',
getPopupContainer, getPopupContainer,
options: dictTypeOptions,
}, },
fieldName: 'dictType', fieldName: 'dictType',
label: '字典类型', label: '字典类型',