import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' // 表单校验 export const ItemMaintenanceRules = reactive({ number: [required], itemNumber: [required], qty: [required], concurrencyStamp: [required], }) export const ItemMaintenance = useCrudSchemas(reactive([ { label: '维修工单编号', field: 'number', sort: 'custom', isSearch: true, }, { label: '备件编号', field: 'itemNumber', sort: 'custom', isSearch: true, }, { label: '数量', field: 'qty', sort: 'custom', }, { label: '事务类型', field: 'result', dictType: DICT_TYPE.RESULT, dictClass: 'string', isSearch: false, isTable: true, sort: 'custom', table: { width: 150 }, tableForm: { type: 'Select', inactiveValue: 'FALSE', disabled: true }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } } }, { label: '创建时间', field: 'createTime', sort: 'custom', formatter: dateFormatter, isSearch: false, 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: 'reasons', sort: 'custom', }, { label: '是否可用', field: 'available', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: false, isTable: true, sort: 'custom', table: { width: 150 }, tableForm: { type: 'Select', inactiveValue: 'FALSE', disabled: true }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } } }, { label: '操作', field: 'action', isForm: false, table: { width: 150, fixed: 'right' } } ]))