From 4dee4cb5b31a7f1dcd2c7b3d72f74b78d2fe3f29 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期五, 18 九月 2026 15:56:41 +0800
Subject: [PATCH] fix: 质检是否入库

---
 src/views/qualityManagement/processInspection/components/formDia.vue |   36 ++++++++++++++++++++++++++++++++++--
 1 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/src/views/qualityManagement/processInspection/components/formDia.vue b/src/views/qualityManagement/processInspection/components/formDia.vue
index a02976e..722fb93 100644
--- a/src/views/qualityManagement/processInspection/components/formDia.vue
+++ b/src/views/qualityManagement/processInspection/components/formDia.vue
@@ -156,6 +156,20 @@
             </el-form-item>
           </el-col>
         </el-row>
+        <el-row :gutter="30"
+                v-if="operationType === 'edit'">
+          <el-col :span="12">
+            <el-form-item label="鏄惁鍏ュ簱锛�"
+                          prop="isStockIn">
+              <el-switch v-model="form.isStockIn"
+                         :active-value="1"
+                         :inactive-value="0"
+                         active-text="鏄�"
+                         inactive-text="鍚�" />
+              <span class="stock-in-tip">閫夋嫨鈥滄槸鈥濆皢鐢熸垚鍏ュ簱璁板綍鍜屽簱瀛橈紝閫夋嫨鈥滃惁鈥濆彧淇濆瓨璐ㄦ璁板綍</span>
+            </el-form-item>
+          </el-col>
+        </el-row>
         <el-row :gutter="30">
           <el-col :span="12">
             <el-form-item label="妫�娴嬪崟浣嶏細"
@@ -272,6 +286,7 @@
       checkCompany: "",
       isSampling: 0,
       samplingQuantity: "",
+      isStockIn: 0,
     },
     rules: {
       checkTime: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
@@ -393,6 +408,7 @@
       checkCompany: "",
       isSampling: 0,
       samplingQuantity: "",
+      isStockIn: 0,
     };
     testStandardOptions.value = [];
     tableData.value = [];
@@ -403,6 +419,8 @@
       const savedTestStandardId = row.testStandardId;
       const { passRate, ...rowWithoutPassRate } = row;
       form.value = { ...rowWithoutPassRate, testStandardId: "" };
+      // 缂栬緫鏃�"鏄惁鍏ュ簱"榛樿鍚︼紝浠呬慨鏀硅川妫�璁板綍
+      form.value.isStockIn = 0;
       currentProductId.value = row.productId || 0;
       // 鍏抽敭锛氱紪杈戞椂鍔犺浇瑙勬牸鍨嬪彿涓嬫媺閫夐」锛屾墠鑳藉弽鏄� productModelId
       if (currentProductId.value) {
@@ -411,7 +429,11 @@
           modelOptions.value = res || [];
           // 鍚屾鍥炲~ model / unit锛堟湁浜涙帴鍙h繑鍥炵殑 row 閲屽彲鑳芥病甯﹀叏锛�
           if (form.value.productModelId) {
-            handleChangeModel(form.value.productModelId);
+            const selectedModel = modelOptions.value.find(item => item.id == form.value.productModelId);
+            if (selectedModel) {
+              form.value.model = selectedModel.model || "";
+              form.value.unit = selectedModel.unit || "";
+            }
           }
         } catch (e) {
           console.error("鍔犺浇瑙勬牸鍨嬪彿澶辫触", e);
@@ -423,6 +445,7 @@
         // 鍏堝姞杞芥寚鏍囬�夐」
         let params = {
           productId: currentProductId.value,
+          productModelId: form.value.productModelId || undefined,
           inspectType: 1,
           process: form.value.process || "",
         };
@@ -497,6 +520,8 @@
       modelOptions.value.find(item => item.id == value)?.model || "";
     form.value.unit =
       modelOptions.value.find(item => item.id == value)?.unit || "";
+    // 瑙勬牸鍨嬪彿鍙樺寲鍚庢寜 浜у搧+瑙勬牸鍨嬪彿 閲嶆柊杩囨护鍙�夋寚鏍�
+    getList(value);
   };
 
   const handleQualifiedQuantityChange = (value) => {
@@ -591,7 +616,7 @@
       }
     });
   };
-  const getList = () => {
+  const getList = (modelId) => {
     if (!currentProductId.value) {
       testStandardOptions.value = [];
       tableData.value = [];
@@ -600,6 +625,7 @@
     const processName = form.value.process || "";
     let params = {
       productId: currentProductId.value,
+      productModelId: modelId ?? form.value.productModelId ?? undefined,
       inspectType: 1,
       process: processName,
     };
@@ -668,4 +694,10 @@
 .sampling-radio-group {
   height: 32px;
 }
+
+.stock-in-tip {
+  margin-left: 12px;
+  font-size: 12px;
+  color: #909399;
+}
 </style>

--
Gitblit v1.9.3