From c351a2b551e9d567b988121d9dc73903d17e233e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=82=E7=B3=96?= Date: Fri, 14 Nov 2025 10:31:55 +0800 Subject: [PATCH] =?UTF-8?q?refactor(wms):=20=E4=BC=98=E5=8C=96=E9=92=A2?= =?UTF-8?q?=E5=8D=B7=E6=93=8D=E4=BD=9C=E8=A1=A8=E5=8D=95=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用对象展开运算符简化表单数据初始化与提交逻辑 添加质量状态、包装要求等新字段 移除冗余的watch和重复的仓库名称获取逻辑 --- klp-ui/src/views/wms/coil/merge.vue | 19 ++++++-------- klp-ui/src/views/wms/coil/split.vue | 15 +++++------ klp-ui/src/views/wms/coil/typing.vue | 38 +++++----------------------- 3 files changed, 21 insertions(+), 51 deletions(-) diff --git a/klp-ui/src/views/wms/coil/merge.vue b/klp-ui/src/views/wms/coil/merge.vue index caafafd0..d04ec4c7 100644 --- a/klp-ui/src/views/wms/coil/merge.vue +++ b/klp-ui/src/views/wms/coil/merge.vue @@ -246,7 +246,11 @@ export default { grossWeight: null, netWeight: null, warehouseId: null, - actualWarehouseId: null + actualWarehouseId: null, + qualityStatus: '', + packagingRequirement: '', + packingStatus: '', + trimmingRequirement: '' }, loading: false, // 钢卷选择器可见性 @@ -407,7 +411,8 @@ export default { materialName: data.materialName || (data.rawMaterial ? data.rawMaterial.rawMaterialName : ''), productName: data.productName || (data.product ? data.product.productName : ''), specification: data.rawMaterial?.specification || data.product?.specification || '', - bomItems: data.bomItemList || [] + bomItems: data.bomItemList || [], + }, { coilId: null, @@ -782,16 +787,8 @@ export default { .join(','); const mergeData = { + ...this.targetCoil, enterCoilNo: enterCoilNos, // 拼接的入场钢卷号 - currentCoilNo: this.targetCoil.currentCoilNo, - team: this.targetCoil.team, - materialType: this.targetCoil.materialType, - itemType: this.targetCoil.itemType, - itemId: this.targetCoil.itemId, - grossWeight: this.targetCoil.grossWeight, - netWeight: this.targetCoil.netWeight, - warehouseId: this.targetCoil.warehouseId, - actualWarehouseId: this.targetCoil.actualWarehouseId, hasMergeSplit: 2, // 2表示合卷 newCoils: this.sourceCoils.map(item => ({ coilId: item.coilId, diff --git a/klp-ui/src/views/wms/coil/split.vue b/klp-ui/src/views/wms/coil/split.vue index 997bab7c..e137d172 100644 --- a/klp-ui/src/views/wms/coil/split.vue +++ b/klp-ui/src/views/wms/coil/split.vue @@ -577,7 +577,11 @@ export default { grossWeight: null, netWeight: null, warehouseId: null, - actualWarehouseId: null + actualWarehouseId: null, + qualityStatus: '', + packagingRequirement: '', + packingStatus: '', + trimmingRequirement: '' }); }, @@ -653,16 +657,9 @@ export default { currentCoilNo: this.motherCoil.currentCoilNo, hasMergeSplit: 1, // 1表示分条 newCoils: this.splitList.map(item => ({ - enterCoilNo: this.motherCoil.enterCoilNo, // 子卷继承母卷的入场钢卷号 - currentCoilNo: item.currentCoilNo, - team: item.team, - materialType: item.materialType, + ...item, itemType: item.itemType || this.motherCoil.itemType, itemId: item.itemId || this.motherCoil.itemId, - grossWeight: item.grossWeight, - netWeight: item.netWeight, - warehouseId: item.warehouseId, - actualWarehouseId: item.actualWarehouseId, hasMergeSplit: 1 })) }; diff --git a/klp-ui/src/views/wms/coil/typing.vue b/klp-ui/src/views/wms/coil/typing.vue index 6cd1bbf8..edbcac80 100644 --- a/klp-ui/src/views/wms/coil/typing.vue +++ b/klp-ui/src/views/wms/coil/typing.vue @@ -260,7 +260,11 @@ export default { netWeight: null, warehouseId: null, actualWarehouseId: null, - remark: '' + remark: '', + qualityStatus: '', + packagingRequirement: '', + packingStatus: '', + trimmingRequirement: '' }, rules: { currentCoilNo: [ @@ -344,9 +348,6 @@ export default { return []; } }, - watch: { - // 不再需要watch,直接用@change事件处理 - }, async created() { // 先加载库区列表 await this.loadWarehouses(); @@ -400,27 +401,11 @@ export default { // 填充当前信息(左侧) this.currentInfo = { - coilId: data.coilId, - enterCoilNo: data.enterCoilNo || '', - currentCoilNo: data.currentCoilNo || '', - supplierCoilNo: data.supplierCoilNo || '', - team: data.team || '', - itemType: data.itemType || null, - itemId: data.itemId || null, + ...data, itemName: this.getItemName(data), - grossWeight: data.grossWeight, - netWeight: data.netWeight, - warehouseId: data.warehouseId, - actualWarehouseId: data.actualWarehouseId, nextWarehouseName: this.getWarehouseName(data.warehouseId), - remark: data.remark || '' }; - // 重新获取库区名称(确保warehouseList已加载) - if (data.warehouseId) { - this.currentInfo.nextWarehouseName = this.getWarehouseName(data.warehouseId); - } - // 加载对应类型的物品列表 if (data.itemType) { await this.loadItemList(data.itemType); @@ -684,19 +669,10 @@ export default { // 构造更新数据(使用标准update接口,直接更新原记录) const updateData = { + ...this.updateForm, coilId: this.currentInfo.coilId, enterCoilNo: this.currentInfo.enterCoilNo, supplierCoilNo: this.currentInfo.supplierCoilNo, - currentCoilNo: this.updateForm.currentCoilNo, - team: this.updateForm.team, - materialType: this.updateForm.materialType, - itemType: this.updateForm.itemType, - itemId: this.updateForm.itemId, - grossWeight: this.updateForm.grossWeight, - netWeight: this.updateForm.netWeight, - warehouseId: this.updateForm.warehouseId, - actualWarehouseId: this.updateForm.actualWarehouseId, - remark: this.updateForm.remark // 注意:不要传newCoils,否则会走批量更新逻辑 };