import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' // 表单校验 export const ProductionitemcodeSpareitemcodeRules = reactive({ productionItemCode: [required], available: [required], }) export const ProductionitemcodeSpareitemcode = useCrudSchemas(reactive([ { label: '量产件', field: 'productionItemCode', sort: 'custom', isSearch: true, }, { label: '备件', field: 'spareItemCode', sort: 'custom', isSearch: true, }, { label: '是否可用', field: 'available', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } } }, { label: '备注', field: 'remark', 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: 'action', isForm: false, table: { width: 150, fixed: 'right' } } ]))