From 2d2efaf994bec899dd8049774a4f79012242ea9e Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期四, 28 五月 2026 13:38:39 +0800
Subject: [PATCH] 采购产品列表bug

---
 src/views/procurementManagement/procurementLedger/index.vue |   30 +++++++++++++++++-------------
 1 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index cbd6e23..7eb6ba7 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -106,7 +106,7 @@
                                prop="specificationModel" />
               <el-table-column label="鍗曚綅"
                                prop="unit" />
-                               <el-table-column label="鍏ュ簱瀹℃牳鐘舵��"
+              <el-table-column label="鍏ュ簱瀹℃牳鐘舵��"
                                prop="stockInApprovalStatus"
                                width="120">
                 <template #default="scope">
@@ -776,9 +776,9 @@
   // 鑾峰彇鍏ュ簱鐘舵�佹爣绛剧被鍨�
   const getStockInStatusType = status => {
     const typeMap = {
-      "寰呭叆搴�": "info", // 寰呭叆搴� - 鐏拌壊
-      "鍏ュ簱涓�": "warning", // 鍏ュ簱涓� - 姗欒壊
-      "瀹屽叏鍏ュ簱": "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
+      寰呭叆搴�: "info", // 寰呭叆搴� - 鐏拌壊
+      鍏ュ簱涓�: "warning", // 鍏ュ簱涓� - 姗欒壊
+      瀹屽叏鍏ュ簱: "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
     };
     return typeMap[status] || "";
   };
@@ -786,9 +786,9 @@
   // 鑾峰彇鍏ュ簱瀹℃牳鐘舵�佹爣绛剧被鍨�
   const getStockInApprovalStatusType = status => {
     const typeMap = {
-      "寰呭叆搴�": "info", // 寰呭叆搴� - 鐏拌壊
-      "鍏ュ簱涓�": "warning", // 鍏ュ簱涓� - 姗欒壊
-      "瀹屽叏鍏ュ簱": "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
+      寰呭叆搴�: "info", // 寰呭叆搴� - 鐏拌壊
+      鍏ュ簱涓�: "warning", // 鍏ュ簱涓� - 姗欒壊
+      瀹屽叏鍏ュ簱: "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
     };
     return typeMap[status] || "";
   };
@@ -1274,7 +1274,7 @@
   const openForm = async (type, row) => {
     // 缂栬緫鏃舵鏌ュ叆搴撶姸鎬侊紝瀹屽叏鍏ュ簱鏃朵笉鑳界紪杈�
     if (type === "edit" && row) {
-      if (row.stockInStatus === '瀹屽叏鍏ュ簱') {
+      if (row.stockInStatus === "瀹屽叏鍏ュ簱") {
         proxy.$modal.msgWarning("瀹屽叏鍏ュ簱鐘舵�佺殑璁板綍涓嶈兘缂栬緫");
         return;
       }
@@ -1314,7 +1314,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);
@@ -1447,7 +1450,7 @@
   // 鎵撳紑浜у搧寮规
   const openProductForm = async (type, row, index) => {
     // 缂栬緫鏃舵鏌ヤ骇鍝佸叆搴撳鏍哥姸鎬侊紝瀹屽叏鍏ュ簱鏃朵笉鑳界紪杈�
-    if (type === "edit" && row && row.stockInApprovalStatus === '瀹屽叏鍏ュ簱') {
+    if (type === "edit" && row && row.stockInApprovalStatus === "瀹屽叏鍏ュ簱") {
       proxy.$modal.msgWarning("瀹屽叏鍏ュ簱鐘舵�佺殑浜у搧涓嶈兘缂栬緫");
       return;
     }
@@ -1604,8 +1607,9 @@
           submitProductEdit();
         } else {
           if (productOperationType.value === "add") {
-            productData.value.push({ ...productForm.value });
+            console.log("productForm.value---", productForm.value);
             console.log("productData.value---", productData.value);
+            productData.value.push({ ...productForm.value });
           } else {
             productData.value[productOperationIndex.value] = {
               ...productForm.value,
@@ -1636,7 +1640,7 @@
     }
     // 妫�鏌ラ�変腑鐨勪骇鍝佷腑鏄惁鏈夊畬鍏ㄥ叆搴撶殑
     const hasFullyStocked = productSelectedRows.value.some(
-      row => row.stockInApprovalStatus === '瀹屽叏鍏ュ簱'
+      row => row.stockInApprovalStatus === "瀹屽叏鍏ュ簱"
     );
     if (hasFullyStocked) {
       proxy.$modal.msgWarning("閫変腑鐨勪骇鍝佷腑鍖呭惈瀹屽叏鍏ュ簱鐨勪骇鍝侊紝鏃犳硶鍒犻櫎");
@@ -1855,7 +1859,7 @@
       contractNo: form.value.salesLedgerId,
     });
     if (code == 200) {
-      productData.value = data;
+      productData.value = data || [];
     }
   };
 

--
Gitblit v1.9.3