diff --git a/src/views/wms/purchasereceiptManage/purchasereturnspare/purchasereturnRequestSpareMain/purchasereturnRequestSpareMainNew.data.ts b/src/views/wms/purchasereceiptManage/purchasereturnspare/purchasereturnRequestSpareMain/purchasereturnRequestSpareMainNew.data.ts new file mode 100644 index 000000000..052e61c77 --- /dev/null +++ b/src/views/wms/purchasereceiptManage/purchasereturnspare/purchasereturnRequestSpareMain/purchasereturnRequestSpareMainNew.data.ts @@ -0,0 +1,809 @@ +import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { dateFormatter, dateFormatter2 } from '@/utils/formatTime' +const { t } = useI18n() // 国际化 +import * as getRequestsettingApi from '@/api/wms/requestsetting/index' +import { + PurchasereceiptRecordDetail, + PurchasereceiptRecordMain +} from '../../purchasereceipt/purchasereceiptRecordMain/purchasereceiptRecordMain.data' +import * as PurchasereceiptRecordDetailApi from '@/api/wms/purchasereceiptRecordDetail' +import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data' +import * as SupplierApi from '@/api/wms/supplier' +import { Itempackaging } from '@/views/wms/basicDataManage/itemManage/itempackage/itempackage.data' +import * as ItemPackageApi from '@/api/wms/itempackage/index' +import * as LocationApi from '@/api/wms/location' +import { Location } from '@/views/wms/basicDataManage/factoryModeling/location/location.data' +import * as BalanceApi from '@/api/wms/balance' +import { Balance } from '@/views/wms/inventoryManage/balance/balance.data' + +import * as InspectionQ2Api from '@/api/qms/inspectionQ2' +import { Q2 } from '@/views/qms/inspectionQ2/inspectionQ2.data' + +import * as ItembasicApi from '@/api/wms/itembasic' +import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data' + +// let locationList = await LocationApi.selectBusinessTypeOutLocationAll({ +// businessType:'PurchaseReturn', +// isIn:'out' +// }) +// locationList = locationList.list.map(item=>({ +// label :item.code, +// value :item.code +// })) + +// console.log('locationList',locationList) + + +// 获取当前操作人的部门 +import { useUserStore } from '@/store/modules/user' +import { TableColumn } from '@/types/table' +const userStore = useUserStore() +const userDept = userStore.userSelfInfo.dept +// id 转str 否则form回显匹配不到 +userDept.id = userDept.id.toString() +const userDeptArray: any = [userDept] + +/** + * @returns {Array} 采购退货申请主表 + */ +export const PurchasereturnRequestMainNew = useCrudSchemas( + reactive([ + // { + // label: '物料代码', + // field: 'itemCode', + // sort: 'custom', + // isSearch: true, + // table:{ + // width: 150 + // }, + // form: { + // // labelMessage: '信息提示说明!!!', + // componentProps: { + // enterSearch:true, + // isSearchList: true, // 开启查询弹窗 + // searchListPlaceholder: '请选择物料代码', // 输入框占位文本 + // searchField: 'code', // 查询弹窗赋值字段 + // searchTitle: '物料基础信息', // 查询弹窗标题 + // searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类 + // searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法 + // searchCondition: [{ + // key: 'available', + // value: 'TRUE', + // action: '==', + // isSearch: true, + // isMainValue: false + // }], + // verificationParams: [{ + // key: 'code', + // action: '==', + // value: '', + // isMainValue: false, + // isSearch: 'true', + // isFormModel: true + // }], // 失去焦点校验参数 + // } + // } + // }, + // { + // label: '物料名称', + // field: 'itemName', + // sort: 'custom', + // table: { + // width: 150 + // }, + // tableForm:{ + // disabled:true + // }, + // form: { + // componentProps:{ + // disabled:true + // } + // } + // }, + { + label: '供应商', + field: 'supplierCode', + sort: 'custom', + table: { + width: 150 + + }, + // form: { + // component: 'Select', + // componentProps: { + // options: [], + // optionsAlias: { + // labelField: 'supplierCode', + // valueField: 'supplierCode' + // }, + // filterable: true, + // } + // } + form: { + // labelMessage: '信息提示说明!!!', + componentProps: { + enterSearch:true, + isSearchList: true, // 开启查询弹窗 + searchListPlaceholder: '请选择供应商', // 输入框占位文本 + searchField: 'code', // 查询弹窗赋值字段 + searchTitle: '供应商信息', // 查询弹窗标题 + searchAllSchemas: Supplier.allSchemas, // 查询弹窗所需类 + searchPage: SupplierApi.getSupplierPage, // 查询弹窗所需分页方法 + searchCondition: [{ + key: 'available', + value: 'TRUE', + action: '==', + isSearch: false, + isMainValue: false + }], + verificationParams: [{ + key: 'code', + action: '==', + value: '', + isMainValue: false, + isSearch: 'true', + isFormModel: true + }], // 失去焦点校验参数 + } + } + }, + { + label: '供应商名称', + field: 'supplierName', + sort: 'custom', + table: { + width: 180, + }, + isForm: true, + form: { + componentProps:{ + disabled:true + } + } + }, + { + label: ' ', + field: 'hahaha', + table: { + width: 180 + }, + isTable:false, + isDetail:false, + form: { + componentProps: { + type: 'slot', + } + }, + }, + { + label: ' ', + field: 'hehehe', + table: { + width: 180 + }, + isTable:false, + isDetail:false, + form: { + componentProps: { + type: 'slot', + } + }, + }, + { + label: '采购订单号', + field: 'poNumber', + sort: 'custom', + table: { + width: 150 + }, + tableForm:{ + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + }, + // { + // label: '采购订单行', + // field: 'poLine', + // sort: 'custom', + // table: { + // width: 150 + // }, + // tableForm:{ + // disabled:true + // }, + // form: { + // componentProps:{ + // disabled:true + // } + // } + // }, + { + label: '收货单号', + field: 'receiptNumber', + sort: 'custom', + table: { + width: 150 + }, + tableForm:{ + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + }, + { + label: '发货单号', + field: 'asnNumber', + sort: 'custom', + table: { + width: 150 + }, + tableForm:{ + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + }, + { + label: '状态', + field: 'status', + dictType: DICT_TYPE.INVENTORY_STATUS, + dictClass: 'string', + isSearch: true, + isTable: true, + isForm: false, + sort: 'custom', + table: { + width: 150 + }, + sortTableDefault: 1, + form: { + value: '1', + componentProps: { + disabled: true + } + } + }, + { + label: '退货库位', + field: 'locationCode', + sort: 'custom', + form: { + // labelMessage: '信息提示说明!!!', + componentProps: { + enterSearch: true, + isSearchList: true, // 开启查询弹窗 + searchListPlaceholder: '请选择库位代码', // 输入框占位文本 + searchField: 'code', // 查询弹窗赋值字段 + searchTitle: '库位信息', // 查询弹窗标题 + searchAllSchemas: Location.allSchemas, // 查询弹窗所需类 + searchPage: LocationApi.selectBusinessTypeToLocation, // 查询弹窗所需分页方法 + searchCondition: [{ + key: 'available', + value: 'TRUE', + isMainValue: false + },{ + key: 'businessType', + value: 'PurchaseReceiptSpare', + isMainValue: false + },{ + key: 'isIn', + value: 'in', + isMainValue: false + }], + verificationParams: [{ + key: 'code', + action: '==', + value: '', + isMainValue: false, + isSearch: true, + isFormModel: true, + }], // 失去焦点校验参数 + } + }, + tableForm: { + enterSearch: true, + isInpuFocusShow: true, + searchListPlaceholder: '请选择库位代码', // 输入框占位文本 + searchField: 'code', // 查询弹窗赋值字段 + searchTitle: '库位信息', // 查询弹窗标题 + searchAllSchemas: Location.allSchemas, // 查询弹窗所需类 + searchPage: LocationApi.selectBusinessTypeToLocation, // 查询弹窗所需分页方法 + searchCondition: [{ + key: 'available', + value: 'TRUE', + isMainValue: false + },{ + key: 'businessType', + value: 'PurchaseReceiptSpare', + isMainValue: false + },{ + key: 'isIn', + value: 'in', + isMainValue: false + }], + verificationParams: [{ + key: 'code', + action: '==', + value: '', + isMainValue: false, + isSearch: true, + isFormModel: true, + }], // 失去焦点校验参数 + }, + }, + // { + // label: 'Q2通知单号', + // field: 'q2Number', + // sort: 'custom', + // isSearch: false, + // isDetail: true, + // table: { + // width: 150 + // }, + // form: { + // // labelMessage: '信息提示说明!!!', + // componentProps: { + // enterSearch: true, + // // multiple: true, + // isSearchList: true, // 开启查询弹窗 + // searchListPlaceholder: '请选择Q2通知单号', // 输入框占位文本 + // searchField: 'number', // 查询弹窗赋值字段 + // searchTitle: 'Q2通知单号', // 查询弹窗标题 + // searchAllSchemas: Q2.allSchemas, // 查询弹窗所需类 + // searchPage: InspectionQ2Api.getQ2Page, // 查询弹窗所需分页方法 + // searchCondition: [ + // { + // key: 'available', + // value: 'TRUE', + // isMainValue: false + // }, + // { + // key: 'status', + // value: '0', + // isMainValue: false + // }, + // { + // key: 'supplierCode', + // value: 'supplierCode', + // isMainValue: true + // } + // ], + // verificationParams: [ + // { + // key: 'number', + // action: '==', + // value: '', + // isMainValue: false, + // isSearch: true, + // isFormModel: true + // } + // ] // 失去焦点校验参数 + // } + // } + // }, + { + label: '操作', + field: 'action', + isDetail: false, + isForm: false, + table: { + width: 300, + fixed: 'right' + } + } + ]) +) +//表单校验 +export const PurchasereturnRequestMainRulesNew = reactive({ + // itemCode: [ + // { required: true, message: '请输入供应商代码', trigger: 'blur' } + // ], + supplierCode: [ + { required: true, message: '请输入供应商代码', trigger: 'blur' } + ], + poNumber: [ + { required: true, message: '请选择采购订单号', trigger: 'blur' } + ], + // poLine: [ + // { required: true, message: '请选择订单行', trigger: 'blur' } + // ], + locationCode: [ + { required: true, message: '请选择收货单明细', trigger: 'blur' } + ] +}) + + + + + +/** + * @returns {Array} 采购退货申请子表 + */ +export const PurchasereturnRequestDetailNew = useCrudSchemas(reactive([ + { + label: '物料代码', + field: 'itemCode', + sort: 'custom', + table: { + width: 150 + }, + tableForm:{ + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + // tableForm:{ + // multiple:true, + // disabled:true, + // // isInpuFocusShow: true, // 开启查询弹窗 + // searchListPlaceholder: '请选择包装号', + // searchField: 'packingNumber', + // searchTitle: '库存余额信息', + // searchAllSchemas: Balance.allSchemas, + // searchPage: BalanceApi.getBalancePageSpare, + // searchCondition: [{ + // key: 'available', + // value: 'TRUE', + // action: '==', + // isSearch: true, + // isMainValue: false + // },{ + // key: 'businessType', + // value: 'PurchaseReturnSpare', + // action: '==', + // isSearch: true, + // isMainValue: false + // },{ + // key: 'inOrOut', + // value: 'out', + // action: '==', + // isSearch: true, + // isMainValue: false + // }] + // }, + // form: { + // // labelMessage: '信息提示说明!!!', + // componentProps: { + // disabled:true, + // isSearchList: true, // 开启查询弹窗 + // searchListPlaceholder: '请选择包装号', + // searchField: 'packingNumber', + // searchTitle: '库存余额信息', + // searchAllSchemas: Balance.allSchemas, + // searchPage: BalanceApi.getBalancePageSpare, + // searchCondition: [{ + // key: 'available', + // value: 'TRUE', + // action: '==', + // isSearch: true, + // isMainValue: false + // },{ + // key: 'businessType', + // value: 'PurchaseReturnSpare', + // action: '==', + // isSearch: true, + // isMainValue: false + // },{ + // key: 'inOrOut', + // value: 'out', + // action: '==', + // isSearch: true, + // isMainValue: false + // }] + // } + // } + }, + { + label: '物料名称', + field: 'itemName', + sort: 'custom', + table: { + width: 150 + }, + tableForm:{ + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + }, + { + label: '物料描述1', + field: 'itemDesc1', + sort: 'custom', + table: { + width: 150 + }, + isTableForm:true, + isTable:false, + hiddenInMain: true, + isForm: false, + tableForm:{ + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + }, + { + label: '物料描述2', + field: 'itemDesc2', + sort: 'custom', + table: { + width: 150 + }, + isTableForm:true, + isTable:false, + hiddenInMain: true, + isForm: false, + tableForm:{ + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + }, + { + label: '订单行', + field: 'poLine', + sort: 'custom', + table: { + width: 150 + }, + tableForm:{ + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + }, + { + label: '批次', + field: 'batch', + sort: 'custom', + table: { + width: 150 + }, + tableForm:{ + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + }, + { + label: '状态', + field: 'inventoryStatus', + dictType: DICT_TYPE.INVENTORY_STATUS, + sort: 'custom', + table: { + width: 150 + }, + tableForm:{ + type: 'Select', + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + }, + { + label: '库存数量', + field: 'balanceQty', + sort: 'custom', + table: { + width: 150 + }, + form: { + component: 'InputNumber', + componentProps: { + disabled: true, + min: 0, + precision: 6 + } + }, + tableForm:{ + disabled:true, + hidden:false,//控制列是否展示 + type:'InputNumber', + min:0, + precision: 6 + }, + hiddenInMain: true, + isTable: false, + isDetail: false, + }, + { + label: '退货数量', + field: 'qty', + sort: 'custom', + table: { + width: 150 + }, + form: { + component: 'InputNumber', + componentProps: { + min: 0, + precision: 6, + disabled:false + } + }, + isTable:false, + isTableForm:true, + tableForm:{ + type:'InputNumber', + min:0, + precision: 6 + } + }, + { + label: '备注', + field: 'remark', + sort: 'custom', + table: { + width: 150 + }, + isTable: false, + }, + { + label: '操作', + hiddenInMain:true, + field: 'action', + isDetail: false, + isForm: false , + table: { + width: 150, + fixed: 'right' + }, + isTableForm:false, + } +])) + +//表单校验 +export const PurchasereturnRequestDetailRulesNew = reactive({ +}) + + + +export const PurchasereturnPurchasereceiptRecordNew = useCrudSchemas( + reactive([ + { + label: '收货日期', + field: 'currentDeliveryDate', + isTable: true, + 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: 'receiptNumber', + sort: 'custom', + tableForm:{ + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + }, + { + label: '发货单号', + field: 'asnNumber', + sort: 'custom', + tableForm:{ + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + }, + { + label: '订单号', + field: 'poNumber', + sort: 'custom', + table: { + width: 150 + }, + tableForm:{ + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + }, + { + label: '订单行', + field: 'poLine', + sort: 'custom', + table: { + width: 150 + }, + tableForm:{ + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + }, + { + label: '批次', + field: 'batch', + sort: 'custom', + table: { + width: 150 + }, + tableForm:{ + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + }, + { + label: '数量', + field: 'qty', + sort: 'custom', + table: { + width: 150 + }, + tableForm:{ + disabled:true + }, + form: { + componentProps:{ + disabled:true + } + } + } + ]) +) +