import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' // 表单校验 export const EquipmentSpotCheckRecordDetailRules = reactive({ number: [required], masterId: [required], name: [required], concurrencyStamp: [required] }) export const EquipmentSpotCheckRecordDetail = useCrudSchemas(reactive([ { label: 'id', field: 'id', sort: 'custom', isForm: false }, { label: '点检工单号', field: 'number', sort: 'custom', isSearch: true }, { label: '主表', field: 'masterId', sort: 'custom', isSearch: true, form: { component: 'InputNumber', value: 0 } }, { label: '完成时间', field: 'completionTime', sort: 'custom', formatter: dateFormatter, isSearch: true, search: { component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD HH:mm:ss', type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] } }, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } } }, { label: '未完成原因', field: 'uncompletedCause', sort: 'custom', isSearch: true }, { label: '结果枚举', field: 'result', sort: 'custom', dictType: DICT_TYPE.IS_COMPLETED, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 isSearch: true }, { label: '名称自动带出', field: 'name', sort: 'custom', isSearch: true }, { label: '点检内容自动带出', field: 'content', sort: 'custom', isSearch: true, form: { component: 'Editor', componentProps: { valueHtml: '', height: 200 } } }, { label: '点检部位自动带出', field: 'equipmentParts', sort: 'custom', isSearch: true }, { label: '点检方法自动带出', field: 'methods', sort: 'custom', isSearch: true }, { label: '创建时间', field: 'createTime', sort: 'custom', formatter: dateFormatter, isSearch: true, search: { component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD HH:mm:ss', type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] } }, isForm: false }, { label: '部门', field: 'departmentCode', sort: 'custom', isSearch: true }, { label: '备注', field: 'remark', sort: 'custom', isSearch: true }, { label: '地点', field: 'siteId', sort: 'custom', isSearch: true }, { label: '是否可用', field: 'available', sort: 'custom', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 isSearch: true, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } } }, { label: '删除时间', field: 'deletionTime', sort: 'custom', formatter: dateFormatter, isSearch: true, search: { component: 'DatePicker', componentProps: { valueFormat: 'YYYY-MM-DD HH:mm:ss', type: 'daterange', defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] } }, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } } }, { label: '删除人', field: 'deleterId', sort: 'custom', isSearch: true }, { label: '并发乐观锁', field: 'concurrencyStamp', sort: 'custom', isSearch: true, form: { component: 'InputNumber', value: 0 } }, { label: '操作', field: 'action', isForm: false, table: { width: 150, fixed: 'right' } } ]))