From 3a07f2ca675bbd3c55893f7731b8f49d854b0e07 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 26 三月 2026 10:59:25 +0800
Subject: [PATCH] 军泰伟业 1.语法修改

---
 src/views/productionManagement/productionOrder/New.vue |   74 ++++++++++++++++++++++++++++++++----
 1 files changed, 65 insertions(+), 9 deletions(-)

diff --git a/src/views/productionManagement/productionOrder/New.vue b/src/views/productionManagement/productionOrder/New.vue
index 07295d7..395e2c8 100644
--- a/src/views/productionManagement/productionOrder/New.vue
+++ b/src/views/productionManagement/productionOrder/New.vue
@@ -100,6 +100,12 @@
           single
       />
 
+      <!-- 鐢ㄦ枡浜у搧閫夋嫨寮圭獥 -->
+      <ProductSelectDialog
+          v-model="showMaterialProductDialog"
+          @confirm="handleMaterialProductSelect"
+      />
+
       <!-- 鐢熶骇浠诲姟 -->
       <div class="section-card">
         <div class="section-header">
@@ -114,7 +120,19 @@
         <el-table-column type="index" label="搴忓彿" width="60" />
         <el-table-column label="宸ュ簭鍚嶇О" min-width="150">
           <template #default="{ row }">
-            <el-input v-model="row.processName" placeholder="璇疯緭鍏ュ伐搴忓悕绉�" />
+            <el-select 
+              v-model="row.processId" 
+              placeholder="璇烽�夋嫨宸ュ簭" 
+              style="width: 100%"
+              @change="(val) => handleProcessChange(val, row)"
+            >
+              <el-option
+                v-for="item in processOptions"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+              />
+            </el-select>
           </template>
         </el-table-column>
         <el-table-column label="璁″垝鏁�" min-width="120">
@@ -226,6 +244,7 @@
 import { Plus, Delete, Upload } from '@element-plus/icons-vue';
 import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue";
 import {addProductOrder, listProcessRoute} from "@/api/productionManagement/productionOrder.js";
+import {list as listProcess} from "@/api/productionManagement/productionProcess.js";
 
 const props = defineProps({
   visible: {
@@ -263,6 +282,9 @@
 // 鐢ㄦ枡娓呭崟鍒楄〃
 const materialList = ref([]);
 
+// 宸ュ簭鍒楄〃
+const processOptions = ref([]);
+
 // 鏂囦欢鍒楄〃
 const fileList = ref([]);
 
@@ -276,6 +298,17 @@
 });
 
 const showProductSelectDialog = ref(false);
+const showMaterialProductDialog = ref(false);
+
+// 鑾峰彇宸ュ簭鍒楄〃
+const fetchProcessOptions = () => {
+  listProcess().then(res => {
+    processOptions.value = res.data || [];
+  });
+};
+
+// 缁勪欢鎸傝浇鏃惰幏鍙栧伐搴忓垪琛�
+fetchProcessOptions();
 
 let { proxy } = getCurrentInstance()
 
@@ -331,11 +364,22 @@
   })
 }
 
+// 宸ュ簭閫夋嫨鍙樺寲澶勭悊
+const handleProcessChange = (processId, row) => {
+  const selectedProcess = processOptions.value.find(item => item.id === processId);
+  if (selectedProcess) {
+    row.processName = selectedProcess.name;
+    row.processNo = selectedProcess.no;
+  }
+};
+
 // 娣诲姞鐢熶骇浠诲姟
 const addProductionTask = () => {
   productionTaskList.value.push({
+    processId: undefined,
     processName: "",
-    planQuantity: 0,
+    processNo: "",
+    planQuantity: 1,
     reportPermission: "",
     planStartTime: "",
     planEndTime: "",
@@ -347,14 +391,26 @@
   productionTaskList.value.splice(index, 1);
 };
 
-// 娣诲姞鐢ㄦ枡
+// 娣诲姞鐢ㄦ枡 - 寮瑰嚭浜у搧閫夋嫨妗�
 const addMaterialItem = () => {
-  materialList.value.push({
-    drawingNumber: "",
-    productName: "",
-    unitQuantity: 0,
-    inventoryQuantity: 0,
-  });
+  showMaterialProductDialog.value = true;
+};
+
+// 澶勭悊鐢ㄦ枡浜у搧閫夋嫨
+const handleMaterialProductSelect = (products) => {
+  if (products && products.length > 0) {
+    products.forEach(product => {
+      materialList.value.push({
+        productModelId: product.id,
+        drawingNumber: product.model,
+        productName: product.productName,
+        unit: product.unit,
+        unitQuantity: 1,
+        inventoryQuantity: 0,
+      });
+    });
+  }
+  showMaterialProductDialog.value = false;
 };
 
 // 鍒犻櫎鐢ㄦ枡

--
Gitblit v1.9.3