From aa0410ec1c175a28f6481f67d4ce4b0cdf3e15ea Mon Sep 17 00:00:00 2001 From: hwj Date: Tue, 23 Jun 2026 17:42:55 +0800 Subject: [PATCH] =?UTF-8?q?style=EF=BC=9A=E5=87=BA=E5=BA=93=E5=8D=95?= =?UTF-8?q?=E6=8D=AE-=E7=89=A9=E6=96=99=E3=80=81=E5=A4=87=E4=BB=B6-?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E5=88=97=E5=80=BC=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stock/out/components/StockOutItemForm.vue | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/views/erp/stock/out/components/StockOutItemForm.vue b/src/views/erp/stock/out/components/StockOutItemForm.vue index 539175f6..aa6ea8b2 100644 --- a/src/views/erp/stock/out/components/StockOutItemForm.vue +++ b/src/views/erp/stock/out/components/StockOutItemForm.vue @@ -61,7 +61,7 @@ @@ -177,7 +177,7 @@ - @@ -1303,7 +1303,7 @@ const getRepairResultTagType = (value: any) => { } watch( - () => formData.value.map((row) => [row.inputCount, row.purchaseUnitConvertQuantity]), + () => formData.value.map((row) => row.inputCount), () => { if (!isProductMaterialStockOut.value) return formData.value.forEach((row) => { @@ -1316,28 +1316,34 @@ watch( { deep: true } ) +const toIntegerCount = (value: any) => { + const count = Number(value) + return Number.isFinite(count) ? Math.trunc(count) : undefined +} + const syncCountByInputCount = (row: any) => { if (!isProductMaterialStockOut.value) return - const inputCount = Number(row.inputCount) - const convertQuantity = Number(row.purchaseUnitConvertQuantity) - if (!Number.isFinite(inputCount)) { + const inputCount = toIntegerCount(row.inputCount) + if (inputCount === undefined) { row.count = undefined return } - if (isProductStockOut.value || (!row.purchaseUnitId && !row.purchaseUnitName)) { - row.count = inputCount - return - } - row.count = Number.isFinite(convertQuantity) ? inputCount * convertQuantity : inputCount + row.inputCount = inputCount + row.count = inputCount } const handleInputCountBlur = (row: any) => { if (!isProductMaterialStockOut.value) return - const inputCount = Number(row.inputCount) + const inputCount = toIntegerCount(row.inputCount) const stockCount = Number(row.stockCount) - if (!Number.isFinite(inputCount) || !Number.isFinite(stockCount)) return - if (inputCount <= stockCount) return - row.inputCount = stockCount + if (inputCount === undefined || !Number.isFinite(stockCount)) return + row.inputCount = inputCount + if (inputCount <= stockCount) { + syncCountByInputCount(row) + syncPalletPackageCounts(row) + return + } + row.inputCount = Math.trunc(stockCount) syncCountByInputCount(row) syncPalletPackageCounts(row) message.warning(t('ErpStock.Item.stockCountExceededWarning'))