import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import * as ItemApi from '@/api/wms/itembasic' import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' import * as SupplierApi from '@/api/wms/supplier' import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data' import { validateInteger,validateTwoNum } from '@/utils/validator' // 表单校验 export const InspectionMainRules = reactive({ requestStartTime: [required], itemCode: [required], requestEndTime: [required], batch: [required,{ validator:validateInteger, message: '请输入正确的整数', trigger: 'blur'}], requestInspectionNum: [required,{ validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'}], referenceCertificateRow: [{ validator:validateInteger, message: '请输入正确的整数', trigger: 'blur'}], inspectionType: [required], minPackageQty: [required], }) export const InspectionMain = useCrudSchemas(reactive([ { label: '申请编码', field: 'number', sort: 'custom', isSearch: true, table: { width: 200, fixed: 'left' }, form:{ componentProps:{ disabled:true } } }, { label: '申请日期', field: 'applicationDate', 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, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } }, table: { width: 175 } }, { label: '申请时间', field: 'applicationTime', 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, form: { component: 'DatePicker', componentProps: { type: 'datetime', valueFormat: 'x' } }, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, table: { width: 175 } }, { label: '要求开始时间', field: 'requestStartTime', 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' } }, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, table: { width: 175 } }, { label: '要求结束时间', field: 'requestEndTime', 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' } }, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, table: { width: 175 } }, { label: '完成时间', field: 'finishTime', 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' } }, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, table: { width: 175 } }, { label: '供应商编码', field: 'supplierCode', sort: 'custom', isSearch: false, table: { width: 175 }, form:{ componentProps: { isSearchList: true, // 开启查询弹窗 searchTitle: '供应商信息', // 查询弹窗标题 searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类 searchField: 'code', // 查询弹窗赋值字段 searchPage: SupplierApi.getSupplierPage, // 查询弹窗所需分页方法 multiple:false, searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false }] } } }, { label: '供应商名称', field: 'supplierName', sort: 'custom', isSearch: false, table: { width: 175 }, form:{ componentProps: { disabled:true } } }, { label: '物料编码', field: 'itemCode', sort: 'custom', isSearch: false, table: { width: 150 }, form:{ componentProps: { isSearchList: true, // 开启查询弹窗 searchTitle: '物料信息', // 查询弹窗标题 searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类 searchField: 'code', // 查询弹窗赋值字段 searchPage: ItemApi.getItembasicPage, // 查询弹窗所需分页方法 multiple:false, searchCondition: [{ key: 'available', value: 'TRUE', isMainValue: false }] } } }, { label: '物料名称', field: 'itemName', sort: 'custom', isSearch: false, table: { width: 150 }, form:{ componentProps: { disabled:true } } }, { label: '批次', field: 'batch', sort: 'custom', isSearch: false, table: { width: 150 } }, { label: '待检数量', field: 'requestInspectionNum', sort: 'custom', isSearch: false, table: { width: 150 } }, { label: '参考订单号', field: 'referenceOrderCode', sort: 'custom', isSearch: false, table: { width: 150 } }, { label: '参考订单行', field: 'referenceOrderRow', sort: 'custom', isSearch: false, form: { component: 'InputNumber', value: 0 }, table: { width: 150 } }, { label: '参考凭证号', field: 'referenceCertificateCode', sort: 'custom', isSearch: false, table: { width: 150 } }, { label: '参考凭证行', field: 'referenceCertificateRow', sort: 'custom', isSearch: false, form: { component: 'InputNumber', value: 0 }, table: { width: 150 } }, { label: '检验类型', field: 'inspectionType', sort: 'custom', isSearch: false, dictType: DICT_TYPE.INSPECTION_TYPE, dictClass: 'string', form: { componentProps: { } }, table: { width: 175 } }, { label: '小包装数', field: 'minPackageQty', sort: 'custom', isSearch: false, form: { component: 'InputNumber', value: 0 }, table: { width: 150 } }, { label: '检验水平', field: 'inspectionLevel', sort: 'custom', dictType: DICT_TYPE.INSPECTION_LEVEL, dictClass: 'string', table: { width: 150 }, isSearch: true, }, { label: 'aql', field: 'aql', sort: 'custom', dictType: DICT_TYPE.BASIC_AQL, dictClass: 'string', table: { width: 150 } }, { label: '操作', field: 'action', isForm: false, table: { width: 240, fixed: 'right' } } ])) // 表单校验 export const InspectionRequestPackageRules = reactive({ // packageCode: [required], // packageSpecificationCode: [required], amount: [required,{ validator:validateTwoNum, message: '小数点后最多2位', trigger: 'blur'}], measuringUnit: [required], }) /** * @returns {Array} 检验申请包装 */ export const InspectionRequestPackage = useCrudSchemas(reactive([ { label: '编码', field: 'number', sort: 'custom', isSearch: true, tableForm:{ disabled:true }, isTableForm:false, form:{ componentProps:{ disabled:true } } }, { label: '包装号', field: 'packageCode', sort: 'custom', isSearch: true, tableForm:{ disabled:false }, }, { label: '包装规格', field: 'packageSpecificationCode', sort: 'custom', isSearch: true, tableForm:{ disabled:false }, }, { label: '数量', field: 'amount', sort: 'custom', isSearch: false, form: { component: 'InputNumber', value: 0 }, tableForm:{ disabled:false }, }, { label: '计量单位', field: 'measuringUnit', sort: 'custom', isSearch: true, tableForm:{ disabled:false }, table:{ width:150 } } ]))