From 9f3bc47b98cbc51df7cfcea94d4aa0c35f40cbc5 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期二, 13 十月 2026 14:09:06 +0800
Subject: [PATCH] feat: 添加数字格式化工具,支持去掉小数末尾多余的 0 和四舍五入功能
---
src/views/productionManagement/workOrderManagement/index.vue | 31 ++++++++++++++++++++-----------
1 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/src/views/productionManagement/workOrderManagement/index.vue b/src/views/productionManagement/workOrderManagement/index.vue
index c89ed7b..de2edb1 100644
--- a/src/views/productionManagement/workOrderManagement/index.vue
+++ b/src/views/productionManagement/workOrderManagement/index.vue
@@ -336,16 +336,16 @@
slot: "completionStatus",
width: "140",
},
- {
- label: "璁″垝寮�濮嬫椂闂�",
- prop: "planStartTime",
- width: "140",
- },
- {
- label: "璁″垝缁撴潫鏃堕棿",
- prop: "planEndTime",
- width: "140",
- },
+ // {
+ // label: "璁″垝寮�濮嬫椂闂�",
+ // prop: "planStartTime",
+ // width: "140",
+ // },
+ // {
+ // label: "璁″垝缁撴潫鏃堕棿",
+ // prop: "planEndTime",
+ // width: "140",
+ // },
{
label: "瀹為檯寮�濮嬫椂闂�",
prop: "actualStartTime",
@@ -533,6 +533,12 @@
},
});
const { searchForm } = toRefs(data);
+ // 鏁伴噺杩愮畻淇濈暀6浣嶅皬鏁帮紝閬垮厤娴偣鍑忔硶鍑虹幇 7.199999999999999 杩欑被绮惧害璇樊
+ const toQuantity = val => {
+ const n = Number(val);
+ if (!Number.isFinite(n)) return 0;
+ return parseFloat(n.toFixed(6));
+ };
const toProgressPercentage = val => {
const n = Number(val);
if (!Number.isFinite(n)) return 0;
@@ -664,7 +670,10 @@
currentReportRowData.value = row;
const planQuantity = Number(row.planQuantity || 0);
const completeQuantity = Number(row.completeQuantity || 0);
- const remainingQuantity = Math.max(0, planQuantity - completeQuantity);
+ const remainingQuantity = Math.max(
+ 0,
+ toQuantity(planQuantity - completeQuantity)
+ );
reportForm.planQuantity = remainingQuantity;
reportForm.quantity =
row.quantity !== undefined && row.quantity !== null ? row.quantity : null;
--
Gitblit v1.9.3