feat: 字典

This commit is contained in:
dap
2024-10-05 22:56:44 +08:00
parent fdd1d19c8e
commit d7d8784bb4
7 changed files with 441 additions and 93 deletions

View File

@@ -1,11 +1,14 @@
import type { FormSchemaGetter } from '#/adapter';
import type { FormSchemaGetter, VxeGridProps } from '#/adapter';
import { getPopupContainer } from '@vben/utils';
import { renderDictTag } from '#/utils/render';
export const querySchema: FormSchemaGetter = () => [
{
component: 'Select',
componentProps: {
placeholder: 'TODO: 字典类型',
getPopupContainer,
},
fieldName: 'dictType',
@@ -18,6 +21,43 @@ export const querySchema: FormSchemaGetter = () => [
},
];
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '字典标签',
field: 'cssClass',
slots: {
default: ({ row }) => {
const { dictValue } = row;
return renderDictTag(dictValue, [row as any]);
},
},
},
{
title: '字典键值',
field: 'dictValue',
},
{
title: '字典排序',
field: 'dictSort',
},
{
title: '备注',
field: 'remark',
},
{
title: '创建时间',
field: 'createTime',
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 180,
},
];
export const drawerSchema: FormSchemaGetter = () => [
{
component: 'Input',