import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' const { t } = useI18n() // 国际化 import * as getRequestsettingApi from '@/api/wms/requestsetting/index' // 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值 const queryParams = { pageSize:10, pageNo:1, code:'InspectRequest' } const data = await getRequestsettingApi.getRequestsettingPage(queryParams) const requestsettingData =data?.list[0]||{} // 获取当前操作人的部门 import { useUserStore } from '@/store/modules/user' const userStore = useUserStore() const userDept = userStore.userSelfInfo.dept import * as PurchaseMainApi from '@/api/wms/purchaseMain' import * as PurchaseDetailApi from '@/api/wms/purchaseDetail' import * as PurchasereceiptRecordMainApi from '@/api/wms/purchasereceiptRecordMain' import { PurchasereceiptRecordMain } from '../../purchasereceipt/purchasereceiptRecordMain/purchasereceiptRecordMain.data' import * as ItembasicApi from '@/api/wms/itembasic' import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' import { PurchaseDetail, PurchaseMain } from '../../supplierdeliver/purchaseMain/purchaseMain.data' import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' import * as LocationApi from '@/api/wms/location' /** * @returns {Array} 检验申请主表 */ export const InspectRequestMain = useCrudSchemas(reactive([ { label: '采购收货记录单号', field: 'purchaseReceiptRecordNumber', sort: 'custom', table: { width: 150 }, isSearch: true, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择采购收货记录单号', // 输入框占位文本 searchField: 'number', // 查询弹窗赋值字段 searchTitle: '采购收货记录', // 查询弹窗标题 searchAllSchemas: PurchasereceiptRecordMain.allSchemas, // 查询弹窗所需类 searchPage: PurchasereceiptRecordMainApi.getPurchasereceiptRecordMainPage // 查询弹窗所需分页方法 } } }, { label: '供应商代码', field: 'supplierCode', sort: 'custom', table: { width: 150 }, isSearch: true, form:{ componentProps:{ disabled:true } } }, { label: '单据号', field: 'number', sort: 'custom', table: { width: 150, fixed: 'left' }, isForm: false, isSearch: true, }, { label: '业务类型', field: 'businessType', sort: 'custom', table: { width: 150 }, form: { value: 'Inspect', componentProps: { disabled: true } } }, { label: '从仓库代码', field: 'fromWarehouseCode', sort: 'custom', table: { width: 150 }, isForm: false, }, { label: '从库区代码范围', field: 'fromAreaCodes', sort: 'custom', table: { width: 150 }, isForm: false, }, { label: '从库位类型范围', field: 'fromLocationTypes', dictType: DICT_TYPE.LOCATION_TYPE, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, isForm: false, }, { label: '备注', field: 'remark', sort: 'custom', table: { width: 150 }, isTable: false, }, { label: '创建者', field: 'creator', sort: 'custom', table: { width: 150 }, isForm: false, }, { label: '创建时间', field: 'createTime', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, isForm: false, }, { label: '申请时间', field: 'requestTime', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, isForm: false, }, { label: '截止时间', field: 'dueTime', formatter: dateFormatter, detail: { dateFormat: 'YYYY-MM-DD HH:mm:ss' }, sort: 'custom', table: { width: 180 }, form: { component: 'DatePicker', componentProps: { style: {width:'100%'}, type: 'datetime', dateFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'x', } }, }, { label: '部门', field: 'departmentCode', sort: 'custom', table: { width: 150 }, form: { value: userDept.name, componentProps: { disabled: true } } }, { label: '状态', field: 'status', dictType: DICT_TYPE.REQUEST_STATUS, dictClass: 'string', isSearch: true, isTable: true, sort: 'custom', table: { width: 150 }, form: { value: '1', componentProps: { disabled: true } } }, { label: '订单号', field: 'poNumber', sort: 'custom', table: { width: 150 }, tableForm:{ isInpuFocusShow: true, searchListPlaceholder: '请选择订单号', searchField: 'number', searchTitle: '采购订单信息', searchAllSchemas: PurchaseMain.allSchemas, searchPage: PurchaseMainApi.getPurchaseMainPage }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, searchListPlaceholder: '请选择订单号', searchField: 'number', searchTitle: '采购订单信息', searchAllSchemas: PurchaseMain.allSchemas, searchPage: PurchaseMainApi.getPurchaseMainPage } } }, { label: '订单行', field: 'poLine', sort: 'custom', table: { width: 150 }, tableForm:{ isInpuFocusShow: true, searchListPlaceholder: '请选择订单行', searchField: 'lineNumber', searchTitle: '采购订单信息', searchAllSchemas: PurchaseDetail.allSchemas, searchPage: PurchaseDetailApi.getPurchaseDetailPage }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, searchListPlaceholder: '请选择订单行', searchField: 'lineNumber', searchTitle: '采购订单信息', searchAllSchemas: PurchaseDetail.allSchemas, searchPage: PurchaseDetailApi.getPurchaseDetailPage } } }, { label: '批次', field: 'batch', sort: 'custom', table: { width: 150 }, }, { label: '物品代码', field: 'itemCode', sort: 'custom', table: { width: 150 }, tableForm:{ isInpuFocusShow: true, searchListPlaceholder: '请选择物品代码', searchField: 'code', searchTitle: '物品基础信息', searchAllSchemas: Itembasic.allSchemas, searchPage: ItembasicApi.getItembasicPage }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, searchListPlaceholder: '请选择物品代码', searchField: 'code', searchTitle: '物品基础信息', searchAllSchemas: Itembasic.allSchemas, searchPage: ItembasicApi.getItembasicPage } } }, { label: '检验类型', field: 'inspectType', dictType: DICT_TYPE.INSPECT_TYPE, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, isForm: false }, { label: '下一步检验动作', field: 'nextAction', dictType: DICT_TYPE.NEXT_ACTION, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, isForm: false }, { label: '抽检方式', field: 'sampleMethod', dictType: DICT_TYPE.SAMPLE_METHOD, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, isForm: false }, { label: '计量单位', field: 'uom', dictType: DICT_TYPE.UOM, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, }, { label: '收货数量', field: 'receiveQty', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 }, }, isForm: false }, { label: '样品数量', field: 'sampleQty', sort: 'custom', table: { width: 150 }, form: { component: 'InputNumber', componentProps: { min: 1, precision: 6 }, }, isForm: false }, { label: '货主代码', field: 'ownerCode', sort: 'custom', table: { width: 150 }, isForm: false }, { label: '自动提交', field: 'autoCommit', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: requestsettingData.autoCommit, componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE', disabled: true } } }, { label: '自动通过', field: 'autoAgree', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: requestsettingData.autoAgree, componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE', disabled: true } } }, { label: '自动执行', field: 'autoExecute', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: requestsettingData.autoExecute, componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE', disabled: true } } }, { label: '直接生成记录', field: 'directCreateRecord', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, form: { component: 'Switch', value: requestsettingData.directCreateRecord, componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE', disabled: true } } }, { label: '操作', field: 'action', isDetail: false, isForm: false, table: { width: 300, fixed: 'right' }, } ])) //表单校验 export const InspectRequestMainRules = reactive({ purchaseReceiptRecordNumber: [ { required: true, message: '请输入采购收货记录单号', trigger: 'blur' } ], supplierCode: [ { required: true, message: '请输入供应商代码', trigger: 'blur' } ], fromWarehouseCode: [ { required: true, message: '请输入从仓库代码', trigger: 'blur' } ], fromLocationTypes: [ { required: true, message: '请选择从库位类型范围', trigger: 'change' } ], poNumber: [ { required: true, message: '请输入订单号', trigger: 'blur' } ], poLine: [ { required: true, message: '请输入订单行', trigger: 'blur' } ], batch: [ { required: true, message: '请输入批次', trigger: 'blur' } ], inspectType: [ { required: true, message: '请选择检验类型', trigger: 'change' } ], nextAction: [ { required: true, message: '请选择下一步检验动作', trigger: 'change' } ], receiveQty: [ { required: true, message: '请输入收货数量', trigger: 'blur' } ], sampleQty: [ { required: true, message: '请输入样品数量', trigger: 'blur' } ], departmentCode: [ { required: true, message: '请输入部门', trigger: 'blur' } ], autoCommit: [ { required: true, message: '请选择是否自动提交', trigger: 'change' } ], autoAgree: [ { required: true, message: '请选择是否自动通过', trigger: 'change' } ], autoExecute: [ { required: true, message: '请选择是否自动执行', trigger: 'change' } ], directCreateRecord: [ { required: true, message: '请选择是否跳过任务直接生成记录', trigger: 'change' } ], businessType: [ { required: true, message: '请输入业务类型', trigger: 'blur' } ], }) /** * @returns {Array} 检验申请子表 */ export const InspectRequestDetail = useCrudSchemas(reactive([ { label: '包装号', field: 'packingNumber', sort: 'custom', table: { width: 150 }, isTableForm: false, isForm: false, }, { label: '器具号', field: 'containerNumber', sort: 'custom', table: { width: 150 }, isTableForm: false, isForm: false, }, { label: '库存状态', field: 'inventoryStatus', dictType: DICT_TYPE.INVENTORY_STATUS, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, tableForm: { type: 'Select' } }, { label: '从库位代码', field: 'fromLocationCode', sort: 'custom', table: { width: 150 }, tableForm:{ isInpuFocusShow: true, searchListPlaceholder: '请选择从库位代码', searchField: 'code', searchTitle: '库位基础信息', searchAllSchemas: Location.allSchemas, searchPage: LocationApi.getLocationPage }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, searchListPlaceholder: '请选择从库位代码', searchField: 'code', searchTitle: '库位基础信息', searchAllSchemas: Location.allSchemas, searchPage: LocationApi.getLocationPage } } }, { label: '物品代码', field: 'itemCode', sort: 'custom', table: { width: 150 }, tableForm:{ isInpuFocusShow: true, searchListPlaceholder: '请选择物品代码', searchField: 'code', searchTitle: '物品基础信息', searchAllSchemas: Itembasic.allSchemas, searchPage: ItembasicApi.getItembasicPage }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, searchListPlaceholder: '请选择物品代码', searchField: 'code', searchTitle: '物品基础信息', searchAllSchemas: Itembasic.allSchemas, searchPage: ItembasicApi.getItembasicPage } } }, { label: '物品名称', field: 'itemName', sort: 'custom', table: { width: 150 }, isTableForm: false, isForm: false, }, { label: '物品描述1', field: 'itemDesc1', sort: 'custom', table: { width: 150 }, isTableForm: false, isForm: false, }, { label: '物品描述2', field: 'itemDesc2', sort: 'custom', table: { width: 150 }, isTableForm: false, isForm: false, }, { label: '项目代码', field: 'projectCode', sort: 'custom', table: { width: 150 }, isTableForm: false, isForm: false, }, { label: '数量', field: 'qty', sort: 'custom', table: { width: 150 }, tableForm: { type: 'InputNumber', min: 1, precision: 6 } }, { label: '计量单位', field: 'uom', dictType: DICT_TYPE.UOM, dictClass: 'string', isTable: true, sort: 'custom', table: { width: 150 }, tableForm: { type: 'Select' } } ])) //表单校验 export const InspectRequestDetailRules = reactive({ packingNumber: [ { required: true, message: '请输入包装号', trigger: 'blur' } ], inventoryStatus: [ { required: true, message: '请选择库存状态', trigger: 'change' } ], fromLocationCode: [ { required: true, message: '请输入库位代码', trigger: 'blur' } ], itemCode: [ { required: true, message: '请输入物品代码', trigger: 'blur' } ], })