import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter2 } from '@/utils/formatTime' import { validateHanset, validateEmail } from '@/utils/validator' import { dateFormatter } from '@/utils/formatTime' const { t } = useI18n() // 国际化 /** * @returns {Array} 检验任务主表 */ export const InspectionJobMain = useCrudSchemas(reactive([ { label: '编码', field: 'number', sort: 'custom', isSearch: true, }, { label: '申请单号', field: 'requestNumber', sort: 'custom', isSearch: true, }, { label: '供应商编码', field: 'supplierCode', sort: 'custom', isSearch: true, }, { label: '物料编码', field: 'materialCode', sort: 'custom', isSearch: true, }, { label: '物料批次', field: 'materialBatch', sort: 'custom', isSearch: false, }, { label: '订单号', field: 'orderCode', sort: 'custom', isSearch: false, }, { label: '订单行', field: 'orderRow', sort: 'custom', isSearch: false, form: { component: 'InputNumber', value: 0 }, }, { label: '凭证号', field: 'certificateCode', sort: 'custom', isSearch: false, }, { label: '凭证行', field: 'certificateRow', sort: 'custom', isSearch: false, form: { component: 'InputNumber', value: 0 }, }, { label: '检验方案编码', field: 'inspectionSchemeCode', sort: 'custom', isSearch: false, }, { label: '检验方案Json', field: 'inspectionSchemeJson', sort: 'custom', isSearch: false, }, { label: '检验批次', field: 'inspectionBatch', sort: 'custom', isSearch: false, }, { label: '检验批数量', field: 'inspectionBatchAmount', sort: 'custom', isSearch: false, }, { label: '采样总数量', field: 'sampleTatalAmount', sort: 'custom', isSearch: false, }, { label: '检验类型', field: 'inspectionType', sort: 'custom', isSearch: false, form: { component: 'Select' }, }, { label: '检验批来源', field: 'inspectionBatchSource', sort: 'custom', isSearch: false, }, { label: '检验阶段', field: 'inspectionStage', sort: 'custom', isSearch: false, form: { component: 'InputNumber', value: 0 }, }, { label: '检验严格性', field: 'inspectionStringency', sort: 'custom', isSearch: false, }, { label: '检验任务包装列表', field: 'inspectionTaskPackageCode', sort: 'custom', isSearch: false, }, { label: '检验任务工序列表', field: 'inspectionTaskProcessCode', sort: 'custom', isSearch: false, }, { label: '计划开始时间', field: 'planStartTime', 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')] } }, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } }, }, { label: '计划结束时间', field: 'planEndTime', 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')] } }, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } }, }, { label: '检验水平', field: 'inspectionLevel', sort: 'custom', isSearch: false, }, { label: 'AQL值', field: 'aqlValue', sort: 'custom', isSearch: false, }, { label: '是否可用', field: 'available', sort: 'custom', isSearch: false, }, { label: '操作', field: 'action', isDetail: false, isForm: false, table: { width: 200, fixed: 'right' } } ])) //表单校验 export const InspectionJobMainRules = reactive({ number: [required], inspectionCode: [required], supplierCode: [required], materialCode: [required], materialBatch: [required], orderCode: [required], certificateRow: [required], inspectionSchemeCode: [required], inspectionSchemeJson: [required], inspectionBatch: [required], inspectionBatchAmount: [required], sampleTatalAmount: [required], inspectionType: [required], inspectionBatchSource: [required], inspectionStage: [required], inspectionStringency: [required], inspectionLevel: [required], available: [required], }) /** * @returns {Array} 备件申请子表 */ export const InspectionJobDetail = useCrudSchemas(reactive([ { label: '单据号', field: 'number', sort: 'custom', isSearch: true, }, { label: '任务编码', field: 'taskCode', sort: 'custom', isSearch: true, }, { label: '工序编码', field: 'processCode', sort: 'custom', isSearch: true, }, { label: '工序描述', field: 'processDescribe', sort: 'custom', isSearch: true, }, { label: '顺序号', field: 'sequenceCode', sort: 'custom', isSearch: true, form: { component: 'InputNumber', value: 0 }, }, { label: '检验特性编号', field: 'inspectionFeatureCode', sort: 'custom', isSearch: true, }, { label: '是否可用', field: 'available', sort: 'custom', isSearch: true, }, { label: '操作', field: 'action', isDetail: false, isForm: false, table: { width: 150, fixed: 'right' }, isTableForm: false, } ])) //表单校验 export const InspectionJobDetailRules = reactive({ taskCode: [required], processCode: [required], sequenceCode: [required], available: [required], })