import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' // 表单校验 export const EquipmentMaintenanceRecordMainRules = reactive({ number: [required], equipmentCode: [required], planNumber: [required], status: [required], factoryAreaCode: [required], concurrencyStamp: [required] }) export const EquipmentMaintenanceRecordMain = useCrudSchemas(reactive([ { label: '保养编号', field: 'number', sort: 'custom', isSearch: true }, { label: '描述', field: 'describing', sort: 'custom', isSearch: true }, { label: '设备编号', field: 'equipmentCode', sort: 'custom', isSearch: true }, { label: '设备类别', field: 'category', sort: 'custom', dictType: DICT_TYPE.DEVICE_TYPE, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 isSearch: true, form: { component: 'SelectV2' } }, { label: '班次枚举', field: 'classes', sort: 'custom', // dictType: DICT_TYPE.SHIFT_TYPE, // dictClass: 'string', // 默认都是字符串类型其他暂不考虑 isSearch: true, }, { label: '保养计划工单', field: 'planNumber', sort: 'custom', isSearch: true }, { label: '故障类型枚举', field: 'faultType', sort: 'custom', dictType: DICT_TYPE.FAILURE_REASON, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 isSearch: true, form: { component: 'SelectV2' } }, { label: '保养周期', field: 'cycle', sort: 'custom', dictType: DICT_TYPE.MAINTENANCE_CYCLE, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 isSearch: true }, { label: '保养次数', field: 'times', sort: 'custom', isSearch: true }, { label: '验证人', field: 'verifyer2', sort: 'custom', isSearch: true, form: { component: 'InputNumber', value: 0 } }, { label: '验证内容', field: 'verifyContent2', sort: 'custom', isSearch: true }, { label: '验证时间', field: 'verifyTime2', sort: 'custom', isSearch: true }, { label: '保养人', field: 'maintenancer', sort: 'custom', isSearch: true, form: { component: 'InputNumber', value: 0 } }, { label: '保养人联系电话', field: 'maintenancePhone', sort: 'custom', isSearch: true }, { label: '结果枚举', field: 'completeResult', sort: 'custom', isSearch: true }, { label: '完成时间', field: 'completionTime2', sort: 'custom', isSearch: true }, { label: '保养时间', field: 'maintenanceTime', 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: 'status', sort: 'custom', dictType: DICT_TYPE.JOB_STATUS, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 isSearch: true, form: { component: 'Radio' } }, { label: '所属厂区编号', field: 'factoryAreaCode', sort: 'custom', isSearch: true }, { label: '车间编号', field: 'workshopCode', sort: 'custom', isSearch: true }, { label: '工段编号', field: 'workshopSectionCode', sort: 'custom', isSearch: true }, { label: '备注', field: 'remark', 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: 'action', isForm: false, table: { width: 150, fixed: 'right' } } ]))