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/rawMaterialInspection/components/formDia.vue |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue b/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue
index d3f9fc0..a66c609 100644
--- a/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue
+++ b/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue
@@ -349,7 +349,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);
@@ -361,6 +365,7 @@
       // 鍏堝姞杞芥寚鏍囬�夐」
       let params = {
         productId: currentProductId.value,
+        productModelId: form.value.productModelId || undefined,
         inspectType: 0
       }
       qualityInspectDetailByProductId(params).then(res => {
@@ -425,6 +430,8 @@
 const handleChangeModel = (value) => {
   form.value.model = modelOptions.value.find(item => item.id == value)?.model || '';
   form.value.unit = modelOptions.value.find(item => item.id == value)?.unit || '';
+  // 瑙勬牸鍨嬪彿鍙樺寲鍚庢寜 浜у搧+瑙勬牸鍨嬪彿 閲嶆柊杩囨护鍙�夋寚鏍�
+  getList(value);
 }
 
 const findNodeById = (nodes, productId) => {
@@ -483,7 +490,7 @@
   })
 }
 
-const getList = () => {
+const getList = (modelId) => {
   if (!currentProductId.value) {
     testStandardOptions.value = [];
     tableData.value = [];
@@ -491,6 +498,7 @@
   }
   let params = {
     productId: currentProductId.value,
+    productModelId: modelId ?? form.value.productModelId ?? undefined,
     inspectType: 0
   }
   qualityInspectDetailByProductId(params).then(res => {

--
Gitblit v1.9.3