From 9b25e5c7a4e2e300b213ad4d5fb4d4b72cdced39 Mon Sep 17 00:00:00 2001
From: zhang_nuo <zhang_12370@163.com>
Date: 星期日, 13 九月 2026 11:40:54 +0800
Subject: [PATCH] fix(monitor/operlog): 修复操作日志表格操作日期显示错误

---
 src/views/procurementManagement/procurementLedger/index.vue |  171 ++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 120 insertions(+), 51 deletions(-)

diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index dad6a26..ca92040 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -66,6 +66,10 @@
     </div>
     <div class="table_list">
       <div style="display: flex;justify-content: flex-end;margin-bottom: 20px;">
+        <el-button type="success"
+                   plain
+                   v-if="false"
+                   @click="handleBatchGenerate">鎵归噺鐢熸垚鏁版嵁</el-button>
         <el-button type="primary"
                    @click="openForm('add')">鏂板鍙拌处</el-button>
         <el-button type="primary"
@@ -106,7 +110,7 @@
                                prop="specificationModel" />
               <el-table-column label="鍗曚綅"
                                prop="unit" />
-                               <el-table-column label="鍏ュ簱瀹℃牳鐘舵��"
+              <el-table-column label="鍏ュ簱瀹℃牳鐘舵��"
                                prop="stockInApprovalStatus"
                                width="120">
                 <template #default="scope">
@@ -121,7 +125,7 @@
               <el-table-column label="鍙敤鏁伴噺"
                                prop="availableQuality" />
               <el-table-column label="閫�璐ф暟閲�"
-                               prop="returnQuality" />
+                               prop="returnQuantity" />
               <el-table-column label="绋庣巼(%)"
                                prop="taxRate" />
               <el-table-column label="鍚◣鍗曚环(鍏�)"
@@ -144,10 +148,10 @@
                          prop="purchaseContractNumber"
                          width="160"
                          show-overflow-tooltip />
-        <el-table-column label="閿�鍞悎鍚屽彿"
-                         prop="salesContractNo"
-                         width="160"
-                         show-overflow-tooltip />
+<!--        <el-table-column label="閿�鍞悎鍚屽彿"-->
+<!--                         prop="salesContractNo"-->
+<!--                         width="160"-->
+<!--                         show-overflow-tooltip />-->
         <el-table-column label="渚涘簲鍟嗗悕绉�"
                          prop="supplierName"
                          width="160"
@@ -188,6 +192,11 @@
                          show-overflow-tooltip />
         <el-table-column label="鍚堝悓閲戦(鍏�)"
                          prop="contractAmount"
+                         width="200"
+                         show-overflow-tooltip
+                         :formatter="formattedNumber" />
+        <el-table-column label="瀹為檯鍚堝悓閲戦(鍏�)"
+                         prop="netContractAmount"
                          width="200"
                          show-overflow-tooltip
                          :formatter="formattedNumber" />
@@ -590,7 +599,7 @@
             <el-form-item label="鍚◣鍗曚环(鍏�)锛�"
                           prop="taxInclusiveUnitPrice">
               <el-input-number v-model="productForm.taxInclusiveUnitPrice"
-                               :precision="2"
+                               :precision="6"
                                :step="0.1"
                                :min="0"
                                clearable
@@ -603,7 +612,7 @@
                           prop="quantity">
               <el-input-number :step="0.1"
                                clearable
-                               :precision="2"
+                               :precision="6"
                                :min="0"
                                style="width: 100%"
                                v-model="productForm.quantity"
@@ -617,7 +626,7 @@
             <el-form-item label="鍚◣鎬讳环(鍏�)锛�"
                           prop="taxInclusiveTotalPrice">
               <el-input-number v-model="productForm.taxInclusiveTotalPrice"
-                               :precision="2"
+                               :precision="6"
                                :step="0.1"
                                :min="0"
                                clearable
@@ -629,7 +638,7 @@
             <el-form-item label="涓嶅惈绋庢�讳环(鍏�)锛�"
                           prop="taxExclusiveTotalPrice">
               <el-input-number v-model="productForm.taxExclusiveTotalPrice"
-                               :precision="2"
+                               :precision="6"
                                :step="0.1"
                                :min="0"
                                clearable
@@ -656,7 +665,7 @@
             <el-form-item label="搴撳瓨棰勮鏁伴噺锛�"
                           prop="warnNum">
               <el-input-number v-model="productForm.warnNum"
-                               :precision="2"
+                               :precision="6"
                                :step="0.1"
                                :min="0"
                                clearable
@@ -721,6 +730,7 @@
     getOptions,
     getPurchaseTemplateList,
     delPurchaseTemplate,
+    batchGeneratePurchaseInboundSteps,
   } from "@/api/procurementManagement/procurementLedger.js";
   import useFormData from "@/hooks/useFormData.js";
   const FileList = defineAsyncComponent(() =>
@@ -776,9 +786,9 @@
   // 鑾峰彇鍏ュ簱鐘舵�佹爣绛剧被鍨�
   const getStockInStatusType = status => {
     const typeMap = {
-      "寰呭叆搴�": "info", // 寰呭叆搴� - 鐏拌壊
-      "鍏ュ簱涓�": "warning", // 鍏ュ簱涓� - 姗欒壊
-      "瀹屽叏鍏ュ簱": "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
+      寰呭叆搴�: "info", // 寰呭叆搴� - 鐏拌壊
+      鍏ュ簱涓�: "warning", // 鍏ュ簱涓� - 姗欒壊
+      瀹屽叏鍏ュ簱: "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
     };
     return typeMap[status] || "";
   };
@@ -786,9 +796,9 @@
   // 鑾峰彇鍏ュ簱瀹℃牳鐘舵�佹爣绛剧被鍨�
   const getStockInApprovalStatusType = status => {
     const typeMap = {
-      "寰呭叆搴�": "info", // 寰呭叆搴� - 鐏拌壊
-      "鍏ュ簱涓�": "warning", // 鍏ュ簱涓� - 姗欒壊
-      "瀹屽叏鍏ュ簱": "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
+      寰呭叆搴�: "info", // 寰呭叆搴� - 鐏拌壊
+      鍏ュ簱涓�: "warning", // 鍏ュ簱涓� - 姗欒壊
+      瀹屽叏鍏ュ簱: "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
     };
     return typeMap[status] || "";
   };
@@ -923,7 +933,7 @@
     },
     rules: {
       purchaseContractNumber: [
-        { required: true, message: "璇疯緭鍏�", trigger: "blur" },
+        { required: false, message: "璇疯緭鍏�", trigger: "blur" },
       ],
       projectName: [
         { required: true, message: "璇疯緭鍏ラ」鐩悕绉�", trigger: "blur" },
@@ -1075,7 +1085,7 @@
   };
 
   const formattedNumber = (row, column, cellValue) => {
-    return parseFloat(cellValue).toFixed(2);
+    return parseFloat(cellValue).toFixed(6);
   };
   // 鏌ヨ鍒楄〃
   /** 鎼滅储鎸夐挳鎿嶄綔 */
@@ -1195,6 +1205,11 @@
         "futureTicketsAmount",
       ],
       {
+        taxInclusiveUnitPrice: { decimalPlaces: 6 },
+        taxInclusiveTotalPrice: { decimalPlaces: 6 },
+        taxExclusiveTotalPrice: { decimalPlaces: 6 },
+        ticketsAmount: { decimalPlaces: 6 },
+        futureTicketsAmount: { decimalPlaces: 6 },
         ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
         futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
       }
@@ -1260,21 +1275,36 @@
   };
   // 涓昏〃鍚堣鏂规硶
   const summarizeMainTable = param => {
-    return proxy.summarizeTable(param, ["contractAmount"]);
+    return proxy.summarizeTable(
+      param,
+      ["contractAmount", "netContractAmount"],
+      {
+        contractAmount: { decimalPlaces: 6 },
+        netContractAmount: { decimalPlaces: 6 },
+      }
+    );
   };
   // 瀛愯〃鍚堣鏂规硶
   const summarizeProTable = param => {
-    return proxy.summarizeTable(param, [
-      "taxInclusiveUnitPrice",
-      "taxInclusiveTotalPrice",
-      "taxExclusiveTotalPrice",
-    ]);
+    return proxy.summarizeTable(
+      param,
+      [
+        "taxInclusiveUnitPrice",
+        "taxInclusiveTotalPrice",
+        "taxExclusiveTotalPrice",
+      ],
+      {
+        taxInclusiveUnitPrice: { decimalPlaces: 6 },
+        taxInclusiveTotalPrice: { decimalPlaces: 6 },
+        taxExclusiveTotalPrice: { decimalPlaces: 6 },
+      }
+    );
   };
   // 鎵撳紑寮规
   const openForm = async (type, row) => {
     // 缂栬緫鏃舵鏌ュ叆搴撶姸鎬侊紝瀹屽叏鍏ュ簱鏃朵笉鑳界紪杈�
     if (type === "edit" && row) {
-      if (row.stockInStatus === '瀹屽叏鍏ュ簱') {
+      if (row.stockInStatus === "瀹屽叏鍏ュ簱") {
         proxy.$modal.msgWarning("瀹屽叏鍏ュ簱鐘舵�佺殑璁板綍涓嶈兘缂栬緫");
         return;
       }
@@ -1306,18 +1336,7 @@
 
       form.value.entryDate = getCurrentDate();
 
-      if (type === "add") {
-        // 鏂板鏃剁敓鎴愰噰璐悎鍚屽彿
-        try {
-          const purchaseNoRes = await createPurchaseNo();
-          if (purchaseNoRes?.data) {
-            form.value.purchaseContractNumber = purchaseNoRes.data;
-          }
-        } catch (error) {
-          console.error("鐢熸垚閲囪喘鍚堝悓鍙峰け璐�:", error);
-          proxy.$modal.msgWarning("鐢熸垚閲囪喘鍚堝悓鍙峰け璐�");
-        }
-      } else if (type === "edit" && row?.id) {
+      if (type === "edit" && row?.id) {
         // 缂栬緫鏃跺姞杞芥暟鎹�
         currentId.value = row.id;
         try {
@@ -1325,7 +1344,10 @@
           form.value = { ...purchaseRes, stockInStatus: row.stockInStatus };
           fileList.value = purchaseRes.storageBlobVOS || [];
           // 浣跨敤 productList 鎺ュ彛鑾峰彇浜у搧鍒楄〃锛屼互鑾峰彇鍏ュ簱瀹℃牳鐘舵��
-          const productRes = await productList({ salesLedgerId: row.id, type: 2 });
+          const productRes = await productList({
+            salesLedgerId: row.id,
+            type: 2,
+          });
           productData.value = productRes.data || [];
         } catch (error) {
           console.error("鍔犺浇閲囪喘鍙拌处鏁版嵁澶辫触:", error);
@@ -1398,7 +1420,7 @@
 
   // 鎻愪氦琛ㄥ崟
   const submitForm = () => {
-    proxy.$refs["formRef"].validate(valid => {
+    proxy.$refs["formRef"].validate(async valid => {
       if (valid) {
         if (productData.value.length > 0) {
           // 鏂板鏃讹紝闇�瑕佷粠姣忎釜浜у搧瀵硅薄涓垹闄� id 瀛楁
@@ -1428,6 +1450,20 @@
           delete submitData.id;
         }
 
+        // 濡傛灉閲囪喘鍚堝悓鍙蜂负绌猴紝鍒欐牴鎹綍鍏ユ棩鏈熻嚜鍔ㄧ敓鎴�
+        if (!submitData.purchaseContractNumber) {
+          try {
+            const purchaseNoRes = await createPurchaseNo(submitData.entryDate);
+            if (purchaseNoRes?.data) {
+              submitData.purchaseContractNumber = purchaseNoRes.data;
+            }
+          } catch (error) {
+            console.error("鐢熸垚閲囪喘鍚堝悓鍙峰け璐�:", error);
+            proxy.$modal.msgWarning("鐢熸垚閲囪喘鍚堝悓鍙峰け璐�");
+            return;
+          }
+        }
+
         addOrEditPurchase(submitData).then(res => {
           proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
           closeDia();
@@ -1444,7 +1480,7 @@
   // 鎵撳紑浜у搧寮规
   const openProductForm = async (type, row, index) => {
     // 缂栬緫鏃舵鏌ヤ骇鍝佸叆搴撳鏍哥姸鎬侊紝瀹屽叏鍏ュ簱鏃朵笉鑳界紪杈�
-    if (type === "edit" && row && row.stockInApprovalStatus === '瀹屽叏鍏ュ簱') {
+    if (type === "edit" && row && row.stockInApprovalStatus === "瀹屽叏鍏ュ簱") {
       proxy.$modal.msgWarning("瀹屽叏鍏ュ簱鐘舵�佺殑浜у搧涓嶈兘缂栬緫");
       return;
     }
@@ -1633,7 +1669,7 @@
     }
     // 妫�鏌ラ�変腑鐨勪骇鍝佷腑鏄惁鏈夊畬鍏ㄥ叆搴撶殑
     const hasFullyStocked = productSelectedRows.value.some(
-      row => row.stockInApprovalStatus === '瀹屽叏鍏ュ簱'
+      row => row.stockInApprovalStatus === "瀹屽叏鍏ュ簱"
     );
     if (hasFullyStocked) {
       proxy.$modal.msgWarning("閫変腑鐨勪骇鍝佷腑鍖呭惈瀹屽叏鍏ュ簱鐨勪骇鍝侊紝鏃犳硶鍒犻櫎");
@@ -1715,6 +1751,37 @@
       });
   };
 
+  const handleBatchGenerate = async () => {
+    if (selectedRows.value.length === 0) {
+      proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+      return;
+    }
+    const ids = selectedRows.value.map((item) => item.id);
+    
+    ElMessageBox.confirm("纭鎵归噺鐢熸垚鏁版嵁锛�", "鎵归噺鐢熸垚", {
+      confirmButtonText: "纭",
+      cancelButtonText: "鍙栨秷",
+      type: "info",
+    })
+      .then(() => {
+        proxy.$modal.loading("姝e湪鎵归噺鐢熸垚鏁版嵁锛岃绋嶅��...");
+        batchGeneratePurchaseInboundSteps({ ids })
+          .then((res) => {
+            proxy.$modal.msgSuccess("鎵归噺鐢熸垚鎴愬姛");
+            getList();
+          })
+          .catch(() => {
+            proxy.$modal.msgError("鎵归噺鐢熸垚澶辫触");
+          })
+          .finally(() => {
+            proxy.$modal.closeLoading();
+          });
+      })
+      .catch(() => {
+        proxy.$modal.msg("宸插彇娑�");
+      });
+  };
+
   // 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
   function getCurrentDate() {
     const today = new Date();
@@ -1739,14 +1806,16 @@
     productForm.value.taxInclusiveTotalPrice =
       proxy.calculateTaxIncludeTotalPrice(
         productForm.value.taxInclusiveUnitPrice,
-        productForm.value.quantity
+        productForm.value.quantity,
+        6
       );
     if (productForm.value.taxRate) {
       // 涓嶅惈绋庢�讳环璁$畻
       productForm.value.taxExclusiveTotalPrice =
         proxy.calculateTaxExclusiveTotalPrice(
           productForm.value.taxInclusiveTotalPrice,
-          productForm.value.taxRate
+          productForm.value.taxRate,
+          6
         );
     }
   };
@@ -1777,7 +1846,7 @@
         productForm.value.taxInclusiveUnitPrice = (
           Number(productForm.value.taxInclusiveTotalPrice) /
           Number(productForm.value.quantity)
-        ).toFixed(2);
+        ).toFixed(6);
         // 纭繚缁撴灉涓嶄负璐熸暟
         if (Number(productForm.value.taxInclusiveUnitPrice) < 0) {
           productForm.value.taxInclusiveUnitPrice = "0";
@@ -1788,7 +1857,7 @@
         productForm.value.quantity = (
           Number(productForm.value.taxInclusiveTotalPrice) /
           Number(productForm.value.taxInclusiveUnitPrice)
-        ).toFixed(2);
+        ).toFixed(6);
         // 纭繚缁撴灉涓嶄负璐熸暟
         if (Number(productForm.value.quantity) < 0) {
           productForm.value.quantity = "0";
@@ -1798,7 +1867,7 @@
       productForm.value.taxExclusiveTotalPrice = (
         Number(productForm.value.taxInclusiveTotalPrice) /
         (1 + taxRate / 100)
-      ).toFixed(2);
+      ).toFixed(6);
       // 纭繚缁撴灉涓嶄负璐熸暟
       if (Number(productForm.value.taxExclusiveTotalPrice) < 0) {
         productForm.value.taxExclusiveTotalPrice = "0";
@@ -1808,7 +1877,7 @@
       productForm.value.taxInclusiveTotalPrice = (
         Number(productForm.value.taxExclusiveTotalPrice) *
         (1 + taxRate / 100)
-      ).toFixed(2);
+      ).toFixed(6);
       // 纭繚缁撴灉涓嶄负璐熸暟
       if (Number(productForm.value.taxInclusiveTotalPrice) < 0) {
         productForm.value.taxInclusiveTotalPrice = "0";
@@ -1818,7 +1887,7 @@
         productForm.value.taxInclusiveUnitPrice = (
           Number(productForm.value.taxInclusiveTotalPrice) /
           Number(productForm.value.quantity)
-        ).toFixed(2);
+        ).toFixed(6);
         // 纭繚缁撴灉涓嶄负璐熸暟
         if (Number(productForm.value.taxInclusiveUnitPrice) < 0) {
           productForm.value.taxInclusiveUnitPrice = "0";
@@ -1829,7 +1898,7 @@
         productForm.value.quantity = (
           Number(productForm.value.taxInclusiveTotalPrice) /
           Number(productForm.value.taxInclusiveUnitPrice)
-        ).toFixed(2);
+        ).toFixed(6);
         // 纭繚缁撴灉涓嶄负璐熸暟
         if (Number(productForm.value.quantity) < 0) {
           productForm.value.quantity = "0";
@@ -1852,7 +1921,7 @@
       contractNo: form.value.salesLedgerId,
     });
     if (code == 200) {
-      productData.value = data;
+      productData.value = data || [];
     }
   };
 

--
Gitblit v1.9.3