From c9cc00d09c756f126710168f81eb7ceba0959ec2 Mon Sep 17 00:00:00 2001
From: zhang_nuo <zhang_12370@163.com>
Date: 星期五, 21 八月 2026 11:17:31 +0800
Subject: [PATCH] feat(personnel,production): 新增年龄自动计算及工单数量支持小数

---
 src/views/productionManagement/workOrderManagement/index.vue |   64 ++++++++++++++++++-------------
 1 files changed, 37 insertions(+), 27 deletions(-)

diff --git a/src/views/productionManagement/workOrderManagement/index.vue b/src/views/productionManagement/workOrderManagement/index.vue
index a42f98c..a0ed7fc 100644
--- a/src/views/productionManagement/workOrderManagement/index.vue
+++ b/src/views/productionManagement/workOrderManagement/index.vue
@@ -57,7 +57,7 @@
               <span class="info-value">{{ transferCardRowData.productName }}</span>
             </div>
             <div class="info-item">
-              <span class="info-label">浜у搧瑙勬牸</span>
+              <span class="info-label">瑙勬牸鍨嬪彿</span>
               <span class="info-value">{{ transferCardRowData.model }}</span>
             </div>
             <div class="info-item">
@@ -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" />
@@ -160,6 +160,17 @@
                        :label="user.nickName"
                        :value="user.userId" />
           </el-select>
+        </el-form-item>
+        <!-- 宸ユ椂 -->
+        <el-form-item label="宸ユ椂"
+                      v-if="currentReportRowData?.type == 0"
+                      prop="workHour">
+          <el-input v-model.number="reportForm.workHour"
+                    type="number"
+                    min="0"
+                    style="width: 280px"
+                    placeholder="璇疯緭鍏ュ伐鏃�" /><span style="margin-left:10px"
+                class="param-unit">h</span>
         </el-form-item>
         <div v-if="params.length > 0"
              class="param-grid"
@@ -325,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",
@@ -419,6 +430,7 @@
     productMainId: null,
     productionOrderRoutingOperationId: "",
     productionOrderId: "",
+    workHour: 0,
     paramGroups: {},
   });
 
@@ -434,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;
     }
@@ -449,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;
     }
@@ -475,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;
@@ -537,7 +538,7 @@
     if (!Number.isFinite(n)) return 0;
     if (n <= 0) return 0;
     if (n >= 100) return 100;
-    return Math.round(n);
+    return parseFloat(n.toFixed(2));
   };
   const progressColor = percentage => {
     const p = toProgressPercentage(percentage);
@@ -661,7 +662,10 @@
       }
     }
     currentReportRowData.value = row;
-    reportForm.planQuantity = row.planQuantity;
+    const planQuantity = Number(row.planQuantity || 0);
+    const completeQuantity = Number(row.completeQuantity || 0);
+    const remainingQuantity = Math.max(0, planQuantity - completeQuantity);
+    reportForm.planQuantity = remainingQuantity;
     reportForm.quantity =
       row.quantity !== undefined && row.quantity !== null ? row.quantity : null;
     reportForm.productProcessRouteItemId = row.productProcessRouteItemId;
@@ -673,6 +677,11 @@
     reportForm.productionOrderRoutingOperationId =
       row.productionOrderRoutingOperationId;
     reportForm.productionOrderId = row.productionOrderId;
+    if (row.type == 0) {
+      reportForm.workHour = row.workHour || 0;
+    } else {
+      reportForm.workHour = 0;
+    }
     nextTick(() => {
       reportFormRef.value?.clearValidate();
       if (row.productionOrderRoutingOperationId && row.productionOrderId) {
@@ -772,6 +781,7 @@
         productionOrderRoutingOperationId:
           reportForm.productionOrderRoutingOperationId,
         productionOrderId: reportForm.productionOrderId,
+        workHour: reportForm.workHour,
         productionOperationParamList: productionOperationParamList,
       };
 

--
Gitblit v1.9.3