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'}], referenceOrderCode: [required], referenceOrderRow: [required,{ validator:validateInteger, message: '请输入正确的整数', trigger: 'blur'}], referenceCertificateCode: [required], referenceCertificateRow: [required,{ validator:validateInteger, message: '请输入正确的整数', trigger: 'blur'}], inspectionType: [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: 150 } }, { 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: 150 } }, { 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: 150 } }, { 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: 150 } }, { 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: 150 } }, { label: '供应商编码', field: 'supplierCode', sort: 'custom', isSearch: false, table: { width: 150 }, form:{ componentProps: { isSearchList: true, // 开启查询弹窗 searchTitle: '供应商信息', // 查询弹窗标题 searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类 searchField: 'code', // 查询弹窗赋值字段 searchPage: SupplierApi.getSupplierPage, // 查询弹窗所需分页方法 multiple:false, } } }, { label: '供应商名称', field: 'supplierName', sort: 'custom', isSearch: false, table: { width: 150 }, 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, } } }, { 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: 'inspectionSchemeCode', // sort: 'custom', // isSearch: false, // table: { // width: 150 // } // }, { label: '检验类型', field: 'inspectionType', sort: 'custom', isSearch: false, dictType: DICT_TYPE.INSPECTION_TYPE, dictClass: 'string', form: { componentProps: { } }, table: { width: 150 } }, // { // label: '检验阶段', // field: 'inspectionStage', // sort: 'custom', // isSearch: false, // form: { // component: 'InputNumber', // value: 0, // componentProps: { // disabled: true // } // }, // table: { // width: 130 // } // }, // { // label: '检验严格性', // field: 'inspectionStringency', // sort: 'custom', // isSearch: false, // dictType: DICT_TYPE.INSPECTION_SEVERITY, // dictClass: 'string', // form: { // componentProps: { // disabled: true // } // }, // table: { // width: 150 // } // }, // { // label: '检验申请包装列表', // field: 'applicationPackageCode', // sort: 'custom', // isSearch: false, // table: { // width: 150 // } // }, // { // label: '检验水平', // field: 'inspectionLevel', // dictType: DICT_TYPE.INSPECTION_LEVEL, // sort: 'custom', // isSearch: false, // table: { // width: 150 // } // }, // { // label: 'AQL值', // field: 'aqlValue', // sort: 'custom', // isSearch: false, // dictType: DICT_TYPE.BASIC_AQL, // table: { // width: 150 // } // }, // { // label: '是否可用', // field: 'available', // sort: 'custom', // isSearch: false, // dictType: DICT_TYPE.TRUE_FALSE, // 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 }, table:{ width:200 }, isTableForm:false }, { label: '包装号', field: 'packageCode', sort: 'custom', isSearch: true, tableForm:{ disabled:false }, table:{ width:200 } }, { label: '包装规格', field: 'packageSpecificationCode', sort: 'custom', isSearch: true, tableForm:{ disabled:false }, table:{ width:180 } }, { label: '数量', field: 'amount', sort: 'custom', isSearch: false, form: { component: 'InputNumber', value: 0 }, tableForm:{ disabled:false }, table:{ width:150 } }, { label: '计量单位', field: 'measuringUnit', sort: 'custom', isSearch: true, tableForm:{ disabled:false }, table:{ width:150 } }, ]))