From e57932740c39954cf0baa5d7eaa6c3eaeb313fb4 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期五, 04 九月 2026 11:46:04 +0800
Subject: [PATCH] Merge branch 'dev_pro_河南鹤壁' of http://114.132.189.42:9002/r/product-inventory-management into dev_pro_河南鹤壁

---
 src/views/productionManagement/productionOrder/components/MaterialLedgerDialog.vue |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/src/views/productionManagement/productionOrder/components/MaterialLedgerDialog.vue b/src/views/productionManagement/productionOrder/components/MaterialLedgerDialog.vue
index ca25853..9067dde 100644
--- a/src/views/productionManagement/productionOrder/components/MaterialLedgerDialog.vue
+++ b/src/views/productionManagement/productionOrder/components/MaterialLedgerDialog.vue
@@ -6,12 +6,19 @@
                @close="handleClose">
       <div class="material-toolbar">
         <el-button type="primary"
+                   plain
+                   @click="handleAddPurchase">鏂板閲囪喘</el-button>
+        <el-button type="primary"
                    @click="handleAddMaterialRow">鏂板</el-button>
       </div>
       <el-table v-loading="materialTableLoading"
                 :data="materialTableData"
                 border
+                @selection-change="handleMaterialSelectionChange"
                 row-key="tempId">
+        <el-table-column align="center"
+                         type="selection"
+                         width="55" />
         <el-table-column label="宸ュ簭鍚嶇О"
                          min-width="100">
           <template #default="{ row }">
@@ -143,6 +150,8 @@
     <ProductSelectDialog v-model="materialProductDialogVisible"
                          @confirm="handleMaterialProductConfirm"
                          single />
+    <PurchaseLedgerAddDialog ref="purchaseLedgerAddDialogRef"
+                             v-model="purchaseLedgerDialogVisible" />
     <!-- request-url="/stockInventory/rawMaterials" -->
   </div>
 </template>
@@ -151,6 +160,7 @@
   import { computed, ref, watch } from "vue";
   import { ElMessage } from "element-plus";
   import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue";
+  import PurchaseLedgerAddDialog from "./PurchaseLedgerAddDialog.vue";
   import { findProductProcessRouteItemList } from "@/api/productionManagement/productProcessRoute.js";
   import { getStockInventoryByModelId } from "@/api/inventoryManagement/stockInventory.js";
   import {
@@ -174,6 +184,9 @@
   const materialTableLoading = ref(false);
   const materialSaving = ref(false);
   const materialTableData = ref([]);
+  const selectedMaterialRows = ref([]);
+  const purchaseLedgerDialogVisible = ref(false);
+  const purchaseLedgerAddDialogRef = ref(null);
 
   const isSaveDisabled = computed(() => {
     if (materialTableLoading.value) return true;
@@ -378,6 +391,7 @@
 
   const handleClose = () => {
     materialTableData.value = [];
+    selectedMaterialRows.value = [];
     currentMaterialSelectRowIndex.value = -1;
   };
 
@@ -419,6 +433,32 @@
     materialTableData.value.push(createMaterialRow());
   };
 
+  const handleMaterialSelectionChange = selection => {
+    selectedMaterialRows.value = selection;
+  };
+
+  const handleAddPurchase = () => {
+    if (selectedMaterialRows.value.length === 0) {
+      ElMessage.warning("璇烽�夋嫨闇�瑕佹柊澧為噰璐殑鍘熸枡琛�");
+      return;
+    }
+    const rowsWithModel = selectedMaterialRows.value.filter(
+      row => row.materialModelId
+    );
+    if (rowsWithModel.length === 0) {
+      ElMessage.warning("鎵�閫夎缂哄皯鍘熸枡鍨嬪彿锛岃鍏堥�夋嫨鍘熸枡鍚庡啀鏂板閲囪喘");
+      return;
+    }
+    const productRows = rowsWithModel.map(row => ({
+      productModelId: row.materialModelId,
+      productCategory: row.materialName,
+      specificationModel: row.materialModel,
+      unit: row.unit,
+      isChecked: false,
+    }));
+    purchaseLedgerAddDialogRef.value?.open(productRows);
+  };
+
   const handleDeleteMaterialRow = index => {
     materialTableData.value.splice(index, 1);
   };

--
Gitblit v1.9.3