import type { VbenFormSchema } from '#/adapter/form'; import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import { DICT_TYPE } from '#/utils/dict'; /** 表单配置 */ export function useFormSchema(): VbenFormSchema[] { return [ { fieldName: 'id', component: 'Input', dependencies: { triggerFields: [''], show: () => false, }, }, { fieldName: 'name', label: '模板名称', component: 'Input', componentProps: { placeholder: '请输入模板名称', }, rules: 'required', }, { fieldName: 'remark', label: '备注', component: 'Textarea', componentProps: { placeholder: '请输入备注', rows: 4, }, }, { fieldName: 'previewPicUrls', component: 'ImageUpload', label: '预览图', componentProps: { maxNumber: 10, multiple: true, }, }, ]; } /** 列表的搜索表单 */ export function useGridFormSchema(): VbenFormSchema[] { return [ { fieldName: 'name', label: '模板名称', component: 'Input', componentProps: { placeholder: '请输入模板名称', clearable: true, }, }, { fieldName: 'createTime', label: '创建时间', component: 'RangePicker', componentProps: { placeholder: ['开始时间', '结束时间'], clearable: true, valueFormat: 'YYYY-MM-DD HH:mm:ss', }, }, ]; } /** 列表的字段 */ export function useGridColumns(): VxeTableGridOptions['columns'] { return [ { field: 'id', title: '编号', minWidth: 80, }, { field: 'previewPicUrls', title: '预览图', minWidth: 120, cellRender: { name: 'CellImages', }, }, { field: 'name', title: '模板名称', minWidth: 150, }, { field: 'used', title: '是否使用', minWidth: 100, cellRender: { name: 'CellDict', props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING }, }, }, { field: 'remark', title: '备注', minWidth: 200, }, { field: 'createTime', title: '创建时间', minWidth: 180, formatter: 'formatDateTime', }, { title: '操作', width: 250, fixed: 'right', slots: { default: 'actions' }, }, ]; }