From 6f1acfd2086a1f8c2cb80afd3db4e534e44d545e Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期五, 14 八月 2026 10:33:51 +0800
Subject: [PATCH] fix: 报工明细创建日期格式化

---
 src/views/productionPlan/productionPlan/index.vue |   62 +++++++++++++++++++------------
 1 files changed, 38 insertions(+), 24 deletions(-)

diff --git a/src/views/productionPlan/productionPlan/index.vue b/src/views/productionPlan/productionPlan/index.vue
index 46d0548..07cf781 100644
--- a/src/views/productionPlan/productionPlan/index.vue
+++ b/src/views/productionPlan/productionPlan/index.vue
@@ -13,6 +13,14 @@
                     style="width: 160px;"
                     @keyup.enter="handleQuery" />
         </el-form-item>
+        <el-form-item label="閿�鍞悎鍚屽彿:"
+                      prop="salesContractNo">
+          <el-input v-model="searchForm.salesContractNo"
+                    placeholder="璇疯緭鍏�"
+                    clearable
+                    style="width: 160px;"
+                    @keyup.enter="handleQuery" />
+        </el-form-item>
         <el-form-item label="闇�姹傛棩鏈熻寖鍥�:"
                       prop="dateRange">
           <el-date-picker v-model="searchForm.dateRange"
@@ -134,7 +142,9 @@
       </el-form>
       <template #footer>
         <span class="dialog-footer">
-          <el-button type="primary" @click="handleMergeSubmit">纭畾涓嬪彂</el-button>
+          <el-button type="primary"
+                     :loading="mergeSubmitLoading"
+                     @click="handleMergeSubmit">纭畾涓嬪彂</el-button>
           <el-button @click="isShowNewModal = false">鍙栨秷</el-button>
         </span>
       </template>
@@ -227,7 +237,8 @@
       </el-form>
       <template #footer>
         <span class="dialog-footer">
-          <el-button type="primary" @click="handleSubmit">纭畾</el-button>
+          <el-button type="primary"
+                     @click="handleSubmit">纭畾</el-button>
           <el-button @click="dialogVisible = false">鍙栨秷</el-button>
         </span>
       </template>
@@ -256,6 +267,7 @@
     productionPlanUpdate,
     productionPlanDelete,
     productionPlanCombine,
+    exportProductionPlan,
   } from "@/api/productionPlan/productionPlan.js";
   import { productTreeList, modelListPage } from "@/api/basicData/product.js";
   import PIMTable from "./components/PIMTable.vue";
@@ -267,11 +279,6 @@
   const loadProdData = () => {
     console.log("Mock loadProdData called");
     return Promise.resolve({ code: 200, msg: "鍚屾鎴愬姛" });
-  };
-
-  const exportProductionPlan = () => {
-    console.log("Mock exportProductionPlan called");
-    return Promise.resolve();
   };
 
   // const productionPlanCombine = payload => {
@@ -296,6 +303,13 @@
       formatData: params => {
         return params == "閿�鍞�" ? "閿�鍞�" : "鍐呴儴";
       },
+    },
+    {
+      label: "閿�鍞悎鍚屽彿",
+      prop: "salesContractNo",
+      width: "200px",
+      dataType: "slot",
+      slot: "salesContractNo",
     },
 
     {
@@ -322,7 +336,6 @@
       label: "鎵�闇�鏁伴噺",
       prop: "qtyRequired",
       width: "150px",
-      align: "right",
       dataType: "slot",
       slot: "qtyRequired",
       className: "volume-cell",
@@ -371,13 +384,7 @@
       className: "date-cell",
       formatData: cell => (cell ? dayjs(cell).format("YYYY-MM-DD") : ""),
     },
-    {
-      label: "閿�鍞悎鍚屽彿",
-      prop: "salesContractNo",
-      width: "200px",
-      dataType: "slot",
-      slot: "salesContractNo",
-    },
+
     {
       label: "瀹㈡埛鍚嶇О",
       prop: "customerName",
@@ -460,6 +467,7 @@
 
   // 鍚堝苟涓嬪彂寮圭獥鎺у埗
   const isShowNewModal = ref(false);
+  const mergeSubmitLoading = ref(false);
   // 鍚堝苟涓嬪彂琛ㄥ崟鏁版嵁
   const mergeForm = reactive({
     productName: "",
@@ -522,8 +530,7 @@
     });
   };
   const onBlur = value => {
-    // 闄愬埗鍥涗綅灏忔暟
-    mergeForm.totalAssignedQuantity = Number(value.toFixed(4));
+    mergeForm.totalAssignedQuantity = Number(Number(value).toFixed(10));
   };
 
   const fetchProductOptions = () => {
@@ -591,6 +598,7 @@
   const data = reactive({
     searchForm: {
       mpsNo: "",
+      salesContractNo: "",
       productName: "",
       model: "",
       status: "",
@@ -619,6 +627,7 @@
     }
     Object.assign(searchForm.value, {
       mpsNo: "",
+      salesContractNo: "",
       productName: "",
       model: "",
       status: "",
@@ -646,9 +655,9 @@
         };
       }
       summary[category].totalAssignedQuantity += Number(
-        (Number(row.qtyRequired || 0) - Number(row.quantityIssued || 0)).toFixed(
-          4
-        )
+        (
+          Number(row.qtyRequired || 0) - Number(row.quantityIssued || 0)
+        ).toFixed(10)
       );
     });
 
@@ -729,13 +738,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 = Number(totalAssignedQuantity.toFixed(10));
+    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);
@@ -770,6 +780,7 @@
     const payload = {
       ...mergeForm,
     };
+    mergeSubmitLoading.value = true;
     productionPlanCombine(payload)
       .then(res => {
         if (res.code === 200) {
@@ -785,6 +796,9 @@
       .catch(err => {
         console.error("鍚堝苟涓嬪彂寮傚父锛�", err);
         ElMessage.error("绯荤粺寮傚父锛屽悎骞朵笅鍙戝け璐�");
+      })
+      .finally(() => {
+        mergeSubmitLoading.value = false;
       });
     // 鍙互閫夋嫨鍒锋柊鍒楄〃鎴栧叾浠栨搷浣�
   };

--
Gitblit v1.9.3