From 4d9ce4d87bcae1f27cffe03befaeb50eea69dde1 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期日, 13 九月 2026 12:35:07 +0800
Subject: [PATCH] fix: 将数量字段的输入精度更新为8位小数
---
src/views/productionManagement/workOrderManagement/index.vue | 48 +++++++++++++++++++++++-------------------------
1 files changed, 23 insertions(+), 25 deletions(-)
diff --git a/src/views/productionManagement/workOrderManagement/index.vue b/src/views/productionManagement/workOrderManagement/index.vue
index b721de6..de2edb1 100644
--- a/src/views/productionManagement/workOrderManagement/index.vue
+++ b/src/views/productionManagement/workOrderManagement/index.vue
@@ -133,7 +133,7 @@
<el-input v-model.number="reportForm.quantity"
type="number"
min="0"
- step="1"
+ step="0.001"
style="width: 300px"
placeholder="璇疯緭鍏ョ敓浜у悎鏍兼暟閲�"
@input="handleQuantityInput" />
@@ -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",
@@ -446,7 +446,7 @@
}
const num = Number(value);
// 鏁存暟涓斿ぇ浜庣瓑浜�1
- if (isNaN(num) || !Number.isInteger(num) || num < 0) {
+ if (isNaN(num) || num < 0) {
callback(new Error("鐢熶骇鍚堟牸鏁伴噺蹇呴』澶т簬绛変簬0"));
return;
}
@@ -461,7 +461,7 @@
}
const num = Number(value);
// 鏁存暟涓斿ぇ浜庣瓑浜�0
- if (isNaN(num) || !Number.isInteger(num) || num < 0) {
+ if (isNaN(num) || num < 0) {
callback(new Error("鎶ュ簾鏁伴噺蹇呴』澶т簬绛変簬0"));
return;
}
@@ -487,17 +487,6 @@
// 濡傛灉灏忎簬1锛屾竻闄�
if (num < 0) {
reportForm.quantity = null;
- return;
- }
- // 濡傛灉鏄皬鏁板彇鏁存暟閮ㄥ垎
- if (!Number.isInteger(num)) {
- const intValue = Math.floor(num);
- // 濡傛灉鍙栨暣鍚庡皬浜�1锛屾竻闄�
- if (intValue < 0) {
- reportForm.quantity = null;
- return;
- }
- reportForm.quantity = intValue;
return;
}
reportForm.quantity = num;
@@ -544,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;
@@ -675,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