From 0a9ef97a28c820b8f560bd5f0cb7834706880880 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期五, 22 五月 2026 21:57:02 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_NEW_pro' into dev_pro_河南鹤壁

---
 src/views/procurementManagement/procurementLedger/index.vue |  106 +++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 95 insertions(+), 11 deletions(-)

diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index adf7b6e..87fbbb0 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -42,6 +42,20 @@
                             clearable
                             @change="changeDaterange" />
           </el-form-item>
+          <el-form-item label="鍏ュ簱鐘舵�侊細">
+            <el-select v-model="searchForm.stockInStatus"
+                       placeholder="璇烽�夋嫨"
+                       clearable
+                       style="width: 240px"
+                       @change="handleQuery">
+              <el-option label="寰呭叆搴�"
+                         value="寰呭叆搴�" />
+              <el-option label="鍏ュ簱涓�"
+                         value="鍏ュ簱涓�" />
+              <el-option label="瀹屽叏鍏ュ簱"
+                         value="瀹屽叏鍏ュ簱" />
+            </el-select>
+          </el-form-item>
           <el-form-item>
             <el-button type="primary"
                        @click="handleQuery"> 鎼滅储
@@ -92,6 +106,16 @@
                                prop="specificationModel" />
               <el-table-column label="鍗曚綅"
                                prop="unit" />
+                               <el-table-column label="鍏ュ簱瀹℃牳鐘舵��"
+                               prop="stockInApprovalStatus"
+                               width="120">
+                <template #default="scope">
+                  <el-tag :type="getStockInApprovalStatusType(scope.row.stockInApprovalStatus)"
+                          size="small">
+                    {{ scope.row.stockInApprovalStatus || '--' }}
+                  </el-tag>
+                </template>
+              </el-table-column>
               <el-table-column label="鏁伴噺"
                                prop="quantity" />
               <el-table-column label="鍙敤鏁伴噺"
@@ -143,6 +167,17 @@
             </el-tag>
           </template>
         </el-table-column>
+        <el-table-column label="鍏ュ簱鐘舵��"
+                         prop="stockInStatus"
+                         width="100"
+                         show-overflow-tooltip>
+          <template #default="scope">
+            <el-tag :type="getStockInStatusType(scope.row.stockInStatus)"
+                    size="small">
+              {{ scope.row.stockInStatus || '--' }}
+            </el-tag>
+          </template>
+        </el-table-column>
         <el-table-column label="绛捐鏃ユ湡"
                          prop="executionDate"
                          width="100"
@@ -176,7 +211,7 @@
             <el-button link
                        type="primary"
                        @click="openForm('edit', scope.row)"
-                       :disabled="scope.row.approvalStatus !== 1 && scope.row.approvalStatus !== 4">缂栬緫
+                       :disabled="scope.row.stockInStatus === '瀹屽叏鍏ュ簱'">缂栬緫
             </el-button>
             <el-button link
                        type="primary"
@@ -403,6 +438,16 @@
               </el-tag>
             </template>
           </el-table-column>
+          <el-table-column label="鍏ュ簱瀹℃牳鐘舵��"
+                           prop="stockInApprovalStatus"
+                           width="120">
+            <template #default="scope">
+              <el-tag :type="getStockInApprovalStatusType(scope.row.stockInApprovalStatus)"
+                      size="small">
+                {{ scope.row.stockInApprovalStatus || '--' }}
+              </el-tag>
+            </template>
+          </el-table-column>
           <el-table-column fixed="right"
                            label="鎿嶄綔"
                            min-width="60"
@@ -410,7 +455,8 @@
             <template #default="scope">
               <el-button link
                          type="primary"
-                         @click="openProductForm('edit', scope.row, scope.$index)">缂栬緫
+                         @click="openProductForm('edit', scope.row, scope.$index)"
+                         :disabled="scope.row.stockInApprovalStatus === '瀹屽叏鍏ュ簱'">缂栬緫
               </el-button>
             </template>
           </el-table-column>
@@ -723,6 +769,26 @@
       2: "warning", // 瀹℃壒涓� - 姗欒壊
       3: "success", // 瀹℃壒閫氳繃 - 缁胯壊
       4: "danger", // 瀹℃壒澶辫触 - 绾㈣壊
+    };
+    return typeMap[status] || "";
+  };
+
+  // 鑾峰彇鍏ュ簱鐘舵�佹爣绛剧被鍨�
+  const getStockInStatusType = status => {
+    const typeMap = {
+      "寰呭叆搴�": "info", // 寰呭叆搴� - 鐏拌壊
+      "鍏ュ簱涓�": "warning", // 鍏ュ簱涓� - 姗欒壊
+      "瀹屽叏鍏ュ簱": "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
+    };
+    return typeMap[status] || "";
+  };
+
+  // 鑾峰彇鍏ュ簱瀹℃牳鐘舵�佹爣绛剧被鍨�
+  const getStockInApprovalStatusType = status => {
+    const typeMap = {
+      "寰呭叆搴�": "info", // 寰呭叆搴� - 鐏拌壊
+      "鍏ュ簱涓�": "warning", // 鍏ュ簱涓� - 姗欒壊
+      "瀹屽叏鍏ュ簱": "success", // 瀹屽叏鍏ュ簱 - 缁胯壊
     };
     return typeMap[status] || "";
   };
@@ -1206,10 +1272,10 @@
   };
   // 鎵撳紑寮规
   const openForm = async (type, row) => {
-    // 缂栬緫鏃舵鏌ュ鏍哥姸鎬侊紝鍙湁寰呭鏍�(1)鍜屽鎵瑰け璐�(4)鎵嶈兘缂栬緫
+    // 缂栬緫鏃舵鏌ュ叆搴撶姸鎬侊紝瀹屽叏鍏ュ簱鏃朵笉鑳界紪杈�
     if (type === "edit" && row) {
-      if (row.approvalStatus !== 1 && row.approvalStatus !== 4) {
-        proxy.$modal.msgWarning("鍙湁寰呭鏍稿拰瀹℃壒澶辫触鐘舵�佺殑璁板綍鎵嶈兘缂栬緫");
+      if (row.stockInStatus === '瀹屽叏鍏ュ簱') {
+        proxy.$modal.msgWarning("瀹屽叏鍏ュ簱鐘舵�佺殑璁板綍涓嶈兘缂栬緫");
         return;
       }
     }
@@ -1256,9 +1322,11 @@
         currentId.value = row.id;
         try {
           const purchaseRes = await getPurchaseById({ id: row.id, type: 2 });
-          form.value = { ...purchaseRes };
-          productData.value = purchaseRes.productData || [];
+          form.value = { ...purchaseRes, stockInStatus: row.stockInStatus };
           fileList.value = purchaseRes.storageBlobVOS || [];
+          // 浣跨敤 productList 鎺ュ彛鑾峰彇浜у搧鍒楄〃锛屼互鑾峰彇鍏ュ簱瀹℃牳鐘舵��
+          const productRes = await productList({ salesLedgerId: row.id, type: 2 });
+          productData.value = productRes.data || [];
         } catch (error) {
           console.error("鍔犺浇閲囪喘鍙拌处鏁版嵁澶辫触:", error);
           proxy.$modal.msgError("鍔犺浇鏁版嵁澶辫触");
@@ -1375,6 +1443,12 @@
   };
   // 鎵撳紑浜у搧寮规
   const openProductForm = async (type, row, index) => {
+    // 缂栬緫鏃舵鏌ヤ骇鍝佸叆搴撳鏍哥姸鎬侊紝瀹屽叏鍏ュ簱鏃朵笉鑳界紪杈�
+    if (type === "edit" && row && row.stockInApprovalStatus === '瀹屽叏鍏ュ簱') {
+      proxy.$modal.msgWarning("瀹屽叏鍏ュ簱鐘舵�佺殑浜у搧涓嶈兘缂栬緫");
+      return;
+    }
+
     productOperationType.value = type;
     productOperationIndex.value = index;
     productForm.value = {};
@@ -1545,8 +1619,9 @@
     addOrUpdateSalesLedgerProduct(productForm.value).then(res => {
       proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
       closeProductDia();
-      getPurchaseById({ id: currentId.value, type: 2 }).then(res => {
-        productData.value = res.productData;
+      // 浣跨敤 productList 鎺ュ彛鍒锋柊浜у搧鍒楄〃锛屼互鑾峰彇鍏ュ簱瀹℃牳鐘舵��
+      productList({ salesLedgerId: currentId.value, type: 2 }).then(res => {
+        productData.value = res.data || [];
       });
     });
   };
@@ -1554,6 +1629,14 @@
   const deleteProduct = () => {
     if (productSelectedRows.value.length === 0) {
       proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+      return;
+    }
+    // 妫�鏌ラ�変腑鐨勪骇鍝佷腑鏄惁鏈夊畬鍏ㄥ叆搴撶殑
+    const hasFullyStocked = productSelectedRows.value.some(
+      row => row.stockInApprovalStatus === '瀹屽叏鍏ュ簱'
+    );
+    if (hasFullyStocked) {
+      proxy.$modal.msgWarning("閫変腑鐨勪骇鍝佷腑鍖呭惈瀹屽叏鍏ュ簱鐨勪骇鍝侊紝鏃犳硶鍒犻櫎");
       return;
     }
     if (operationType.value === "add") {
@@ -1579,8 +1662,9 @@
           delProduct(ids).then(res => {
             proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
             closeProductDia();
-            getPurchaseById({ id: currentId.value, type: 2 }).then(res => {
-              productData.value = res.productData;
+            // 浣跨敤 productList 鎺ュ彛鍒锋柊浜у搧鍒楄〃锛屼互鑾峰彇鍏ュ簱瀹℃牳鐘舵��
+            productList({ salesLedgerId: currentId.value, type: 2 }).then(res => {
+              productData.value = res.data || [];
             });
           });
         })

--
Gitblit v1.9.3