From 960eba0574dc3c34f0722fff368aa7c8a70d9f32 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期一, 25 五月 2026 13:23:54 +0800
Subject: [PATCH] fix:报工投入调整

---
 src/views/productionManagement/workOrder/components/ProductionRecordForm.vue |   45 ++++++++++++++++++++++++++++++++-------------
 1 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/src/views/productionManagement/workOrder/components/ProductionRecordForm.vue b/src/views/productionManagement/workOrder/components/ProductionRecordForm.vue
index 10bfc44..ec649a6 100644
--- a/src/views/productionManagement/workOrder/components/ProductionRecordForm.vue
+++ b/src/views/productionManagement/workOrder/components/ProductionRecordForm.vue
@@ -17,7 +17,7 @@
     type: Number,
     default: 120
   },
-  /** 鏈鐢熶骇鏁伴噺锛堟垚鍨嬪伐搴忕敤浜庤绠楁姇鍏ラ噸閲忥級 */
+  /** 鏈鐢熶骇鏁伴噺锛堟垚鍨嬪伐搴忕敤浜庤绠楁姇鍏ラ噸閲�/鏁伴噺锛� */
   quantity: {
     type: Number,
     default: null
@@ -27,7 +27,7 @@
     type: Boolean,
     default: false
   },
-  /** 宸ュ崟 BOM 鎶曞叆閲嶉噺锛岄潪鎴愬瀷宸ュ簭鍥炴樉鍒般�屾姇鍏ラ噸閲忋�� */
+  /** 宸ュ崟 BOM 鎶曞叆閲嶉噺锛岄潪鎴愬瀷宸ュ簭鍥炴樉鍒般�屾姇鍏ラ噸閲�/鏁伴噺銆� */
   bomInputQty: {
     type: Number,
     default: null
@@ -39,11 +39,21 @@
   list: [] as any[],
 });
 
+const INPUT_WEIGHT_PARAM_ITEM = "鎶曞叆閲嶉噺/鏁伴噺";
+
+/** 鍙傛暟椤瑰睍绀哄悕 */
+const displayParameterItem = (name) => {
+  const trimmed = String(name ?? "").trim();
+  if (trimmed === "鎶曞叆閲嶉噺/鏁伴噺") return INPUT_WEIGHT_PARAM_ITEM;
+  return trimmed;
+};
+
 const fieldLabel = (item: any) => {
+  const parameterItem = displayParameterItem(item.parameterItem);
   if (!item.unit || item.unit === "/") {
-    return item.parameterItem;
+    return parameterItem;
   }
-  return `${item.parameterItem}锛�${item.unit}锛塦;
+  return `${parameterItem}锛�${item.unit}锛塦;
 };
 
 const getType = (item: any) => item.type || "鏂囨湰鏍煎紡";
@@ -52,7 +62,11 @@
   const result: Record<string, any[]> = {};
   formData.list.forEach((item, index) => {
     if (String(item.isRequired) === "1") {
-      result[`list.${index}.value`] = [{required: true, message: `璇疯緭鍏�${item.parameterItem}`, trigger: "blur"}];
+      result[`list.${index}.value`] = [{
+        required: true,
+        message: `璇疯緭鍏�${displayParameterItem(item.parameterItem)}`,
+        trigger: "blur"
+      }];
     }
   });
   return result;
@@ -66,15 +80,20 @@
 
 const normalizeUnit = (unit) => String(unit ?? "").trim().toLowerCase();
 
-const isInputWeightItem = (item) =>
-  String(item?.parameterItem ?? "").includes("鎶曞叆閲嶉噺") &&
-  normalizeUnit(item?.unit) === "kg";
+const isInputWeightItem = (item) => {
+  const name = String(item?.parameterItem ?? "").trim();
+  const unit = normalizeUnit(item?.unit);
+  return name.includes(INPUT_WEIGHT_PARAM_ITEM) &&
+    (unit === "kg" || unit.startsWith("kg/"));
+};
 
-const isBlankCoeffItem = (item) =>
-  String(item?.parameterItem ?? "").includes("鐢熷澂绯绘暟") &&
-  normalizeUnit(item?.unit) === "g";
+const isBlankCoeffItem = (item) => {
+  const unit = normalizeUnit(item?.unit);
+  return String(item?.parameterItem ?? "").includes("鐢熷澂绯绘暟") &&
+    (unit === "g" || unit.startsWith("g/"));
+};
 
-/** 鎶曞叆閲嶉噺(KG) = 鏈鐢熶骇鏁伴噺 脳 鐢熷澂绯绘暟(g) / 1000 */
+/** 鎶曞叆閲嶉噺/鏁伴噺(KG) = 鏈鐢熶骇鏁伴噺 脳 鐢熷澂绯绘暟(g) / 1000 */
 const syncFormingInputWeight = () => {
   if (!props.isFormingProcess) return;
   const weightItem = formData.list.find(isInputWeightItem);
@@ -93,7 +112,7 @@
   weightItem.value = Number(((qty * coeff) / 1000).toFixed(4));
 };
 
-/** 闈炴垚鍨嬶細鎶曞叆閲嶉噺鍙栧伐鍗� bomInputQty锛堜粎鍥炴樉锛屼笉瑕嗙洊鐢ㄦ埛宸茬紪杈戠殑鍊硷級 */
+/** 闈炴垚鍨嬶細鎶曞叆閲嶉噺/鏁伴噺鍙栧伐鍗� bomInputQty锛堜粎鍥炴樉锛屼笉瑕嗙洊鐢ㄦ埛宸茬紪杈戠殑鍊硷級 */
 const syncBomInputWeight = (force = false) => {
   if (props.isFormingProcess) return;
   const weightItem = formData.list.find(isInputWeightItem);

--
Gitblit v1.9.3