From eb73bf315c9f7fe464145353534f8278e496a041 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期三, 05 八月 2026 19:54:17 +0800
Subject: [PATCH] fix: 精度计算问题
---
src/views/productionPlan/productionPlan/index.vue | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/views/productionPlan/productionPlan/index.vue b/src/views/productionPlan/productionPlan/index.vue
index fd56e89..c29530a 100644
--- a/src/views/productionPlan/productionPlan/index.vue
+++ b/src/views/productionPlan/productionPlan/index.vue
@@ -739,13 +739,14 @@
// 璁$畻鎬诲埗閫犳暟閲� (榛樿qtyRequired鐨勫拰)
const totalAssignedQuantity = selectedRows.value.reduce((sum, row) => {
return sum + Number(row.qtyRequired || 0) - Number(row.quantityIssued || 0);
- }, 0);
- sumAssignedQuantity.value = totalAssignedQuantity;
- console.log(totalAssignedQuantity);
+ }, 0); // 閬垮厤娴偣鏁扮簿搴﹂棶棰橈紙濡� 37.800000000000004锛�
+ const fixedTotal = Math.round(totalAssignedQuantity * 100) / 100;
+ sumAssignedQuantity.value = fixedTotal;
+ console.log(fixedTotal);
// 璁剧疆琛ㄥ崟鏁版嵁
mergeForm.productName = productName;
mergeForm.model = firstRow.model || "";
- mergeForm.totalAssignedQuantity = totalAssignedQuantity;
+ mergeForm.totalAssignedQuantity = fixedTotal;
mergeForm.planCompleteTime = firstRow.requiredDate || "";
mergeForm.productId = firstRow.productId || "";
mergeForm.ids = selectedRows.value.map(row => row.id);
--
Gitblit v1.9.3