import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' // 表单校验 export const InspectionMethodRules = reactive({ description: [required] }) export const InspectionMethod = useCrudSchemas( reactive<CrudSchema[]>([ { label: '编码', field: 'code', sort: 'custom', isSearch: true, isForm: false, table: { fixed: 'left' } }, { label: '描述', field: 'description', sort: 'custom' }, { label: '版本', field: 'version', sort: 'custom' }, { label: '操作指导', field: 'operationGuidance', sort: 'custom' }, { label: '文件', field: 'videoAddress', sort: 'custom', isTable: false, table: {}, form: { component: 'UploadFile', componentProps: { upData: { tableName: 'basicInspectionMethod', tableId: '' }, fileType: ['doc', 'xls', 'ppt', 'txt'], modelValue: [] } } }, { label: '是否可用', field: 'available', sort: 'custom', isSearch: true, isForm: false, dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 search: { value: 'TRUE' }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } }, table: { width: 110 } }, { label: '创建时间', field: 'createTime', isForm: false, table: { width: 180 }, formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, form: { component: 'DatePicker', componentProps: { style: { width: '100%' }, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x' } } }, { label: '创建者', field: 'creator', table: { width: 130 }, isForm: false, isTable: true }, { label: '最后更新时间', field: 'updateTime', sort: 'custom', isDetail: true, isForm: false, isTable: false, formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: { width: '100%' }, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x' } } }, { label: '最后更新者', field: 'updater', isDetail: true, isForm: false, isTable: false, table: { width: 150 } }, { label: '操作', field: 'action', isForm: false, isDetail: false, table: { width: 150, fixed: 'right' } } ]) )