import { listDictModel } from '/@/api/common'; import { DescItem } from '/@/components/Description'; import { BasicColumn, FormSchema } from '/@/components/Table'; import { validateStr } from '/@/utils/validate'; export const columns: BasicColumn[] = [ { title: '策略编码', dataIndex: 'code', }, { title: '策略名称', dataIndex: 'name', }, { title: '编号前缀', dataIndex: 'prefix', }, { title: '生成模式', dataIndex: 'type', }, { title: '流水号长度', dataIndex: 'limitLen', }, { title: '填充字符', dataIndex: 'fillChar', }, ]; // 表单列定义 export const searchFormSchema: FormSchema[] = [ { label: '策略编码', field: 'code', component: 'Input', componentProps: { placeholder: '请输入策略编码', }, }, { label: '策略名称', field: 'name', component: 'Input', componentProps: { placeholder: '请输入策略名称', }, }, ]; // 表单新增编辑 export const dataFormSchema: FormSchema[] = [ { label: '策略编码', field: 'code', required: true, component: 'Input', componentProps: { placeholder: '请输入策略编码', }, dynamicRules: () => { return [ { required: true, validator: async (_, value) => { if (!value) { return Promise.reject('字典项编码不能为空'); } if (validateStr(value)) { return Promise.reject('字典项编码为字母或数字组成'); } return Promise.resolve(); }, }, ]; }, }, { label: '策略名称', field: 'name', required: true, component: 'Input', componentProps: { placeholder: '请输入策略名称', }, }, { label: '流水号(递增)', field: 'nextNum', required: true, component: 'Input', componentProps: { placeholder: '请输入流水号(递增)', }, }, { label: '流水号长度', field: 'limitLen', required: true, component: 'Input', componentProps: { placeholder: '请输入流水号长度', }, }, { label: '填充字符', field: 'fillChar', required: true, component: 'Input', componentProps: { placeholder: '请输入填充字符', }, }, { label: '编号前缀', field: 'prefix', component: 'Input', componentProps: { placeholder: '请输入编号前缀', }, }, { label: '生成模式', field: 'type', component: 'ApiSelect', required: true, componentProps: { api: listDictModel, params: { dictCode: 'sys_numbering_type', }, }, }, { label: '备注', field: 'remark', component: 'InputTextArea', componentProps: { placeholder: '请输入备注', }, }, ]; // 表单详情查看 export const viewSchema: DescItem[] = [ { label: '策略编码', field: 'code', }, { label: '策略名称', field: 'name', }, { label: '编号前缀', field: 'prefix', }, { label: '生成模式', field: 'type', }, { label: '流水号(递增)', field: 'nextNum', }, { label: '流水号长度', field: 'limitLen', }, { label: '填充字符', field: 'fillChar', }, { label: '备注', field: 'remark', }, { label: '下一个编号', field: 'nextFormatNum', }, ];