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: 'type', }, ]; // 表单列定义 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', 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: 'remark', component: 'InputTextArea', componentProps: { placeholder: '请输入备注', }, }, ]; // 表单详情查看 export const viewSchema: DescItem[] = [ { label: '门户编码', field: 'code', }, { label: '门户名称', field: 'name', }, { label: '门户类型', field: 'type', }, { label: '备注', field: 'remark', }, ];