From 686186d7d699fa7654580ce2def93a178ce684fe Mon Sep 17 00:00:00 2001 From: yueli Date: Fri, 17 Jul 2026 14:50:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Create/Update=20=E6=88=90=E6=9C=AC?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=88=86=E7=A6=BB=20=E2=80=94=20Create=20?= =?UTF-8?q?=E4=BF=9D=E7=95=99=20BOM=20=E8=87=AA=E5=8A=A8=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E5=80=BC=EF=BC=8CUpdate=20=E6=8C=89=20hasFormFieldPermission?= =?UTF-8?q?=20=E5=89=A5=E7=A6=BB=E6=95=8F=E6=84=9F=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inventory-web/src/views/stock/inbound/product.vue | 8 ++++++++ inventory-web/src/views/stock/inbound/semi.vue | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/inventory-web/src/views/stock/inbound/product.vue b/inventory-web/src/views/stock/inbound/product.vue index 70af968..645a09d 100644 --- a/inventory-web/src/views/stock/inbound/product.vue +++ b/inventory-web/src/views/stock/inbound/product.vue @@ -1418,6 +1418,14 @@ const submitForm = async () => { production_end_time: form.production_time_range?.[1] } delete payload.production_time_range + // Update 模式:无成本/售价权限则剥离敏感字段,防止库管修改已入库的数据 + // Create 模式:保留成本字段,确保 BOM 自动计算的值能正确提交 + if (dialogStatus.value === 'update') { + if (!hasFormFieldPermission('raw_material_cost')) delete payload.raw_material_cost + if (!hasFormFieldPermission('unit_total_cost')) delete payload.unit_total_cost + if (!hasFormFieldPermission('total_price')) delete payload.total_price + if (!hasFormFieldPermission('sale_price')) delete payload.sale_price + } try { if(dialogStatus.value === 'create') { const res: any = await createProductInbound(payload) diff --git a/inventory-web/src/views/stock/inbound/semi.vue b/inventory-web/src/views/stock/inbound/semi.vue index aed6a32..e3dd44c 100644 --- a/inventory-web/src/views/stock/inbound/semi.vue +++ b/inventory-web/src/views/stock/inbound/semi.vue @@ -1507,6 +1507,13 @@ const submitForm = async () => { production_end_time: form.production_time_range?.[1] || null } delete payload.production_time_range + // Update 模式:无成本权限则剥离成本字段,防止库管修改已入库的成本数据 + // Create 模式:保留成本字段,确保 BOM 自动计算的值能正确提交 + if (dialogStatus.value === 'update') { + if (!hasFormFieldPermission('raw_material_cost')) delete payload.raw_material_cost + if (!hasFormFieldPermission('unit_total_cost')) delete payload.unit_total_cost + if (!hasFormFieldPermission('total_price')) delete payload.total_price + } try { if (dialogStatus.value === 'create') { const res: any = await createSemiInbound(payload)