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/finalInspection/components/formDia.vue |   53 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 50 insertions(+), 3 deletions(-)

diff --git a/src/views/qualityManagement/finalInspection/components/formDia.vue b/src/views/qualityManagement/finalInspection/components/formDia.vue
index 31ba755..312b05c 100644
--- a/src/views/qualityManagement/finalInspection/components/formDia.vue
+++ b/src/views/qualityManagement/finalInspection/components/formDia.vue
@@ -97,6 +97,34 @@
         </el-row>
         <el-row :gutter="30">
           <el-col :span="12">
+            <el-form-item label="鏄惁鎶芥锛�"
+                          prop="isSampling">
+              <el-radio-group v-model="form.isSampling"
+                              class="sampling-radio-group"
+                              :disabled="isViewMode"
+                              @change="handleSamplingChange">
+                <el-radio-button :label="1">鏄�</el-radio-button>
+                <el-radio-button :label="0">鍚�</el-radio-button>
+              </el-radio-group>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12"
+                  v-if="form.isSampling === 1">
+            <el-form-item label="鎶芥鏁伴噺锛�"
+                          prop="samplingQuantity">
+              <el-input-number :step="0.01"
+                               :min="0"
+                               style="width: 100%"
+                               v-model="form.samplingQuantity"
+                               placeholder="璇疯緭鍏�"
+                               clearable
+                               :precision="2"
+                               :disabled="isViewMode" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="30">
+          <el-col :span="12">
             <el-form-item label="妫�娴嬪崟浣嶏細" prop="checkCompany">
               <el-input v-model="form.checkCompany" placeholder="璇疯緭鍏�" clearable :disabled="isViewMode"/>
             </el-form-item>
@@ -184,6 +212,8 @@
     qualifiedQuantity: "",
     unqualifiedQuantity: "",
     checkCompany: "",
+    isSampling: 0,
+    samplingQuantity: "",
   },
   rules: {
     checkTime: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
@@ -197,6 +227,8 @@
     qualifiedQuantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
     unqualifiedQuantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
     checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+    isSampling: [{ required: true, message: "璇烽�夋嫨鏄惁鎶芥", trigger: "change" }],
+    samplingQuantity: [{ required: true, message: "璇疯緭鍏ユ娊妫�鏁伴噺", trigger: "blur" }],
   },
 });
 const { form, rules } = toRefs(data);
@@ -289,7 +321,7 @@
   ]);
   userList.value = userListsRes.data;
 
-  form.value = {}
+  form.value = { isSampling: 0, samplingQuantity: "" }
   testStandardOptions.value = [];
   tableData.value = [];
 
@@ -312,6 +344,7 @@
       // 骞惰鍔犺浇瑙勬牸鍨嬪彿鍜屾寚鏍囬�夐」
       const params = {
         productId: currentProductId.value,
+        productModelId: form.value.productModelId || undefined,
         inspectType: 2
       };
 
@@ -380,6 +413,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 handleQualifiedQuantityChange = (value) => {
@@ -457,7 +492,7 @@
     }
   });
 }
-const getList = () => {
+const getList = (modelId) => {
   if (!currentProductId.value) {
     testStandardOptions.value = [];
     tableData.value = [];
@@ -465,6 +500,7 @@
   }
   let params = {
     productId: currentProductId.value,
+    productModelId: modelId ?? form.value.productModelId ?? undefined,
     inspectType: 2
   };
   qualityInspectDetailByProductId(params).then(res => {
@@ -502,6 +538,15 @@
     tableData.value = res.data;
   });
 }
+// 鏄惁鎶芥鍒囨崲
+const handleSamplingChange = (value) => {
+  if (value !== 1) {
+    form.value.samplingQuantity = "";
+    nextTick(() => {
+      proxy.$refs?.formRef?.clearValidate?.("samplingQuantity");
+    });
+  }
+}
 // 鍏抽棴寮规
 const closeDia = () => {
   proxy.resetForm("formRef");
@@ -517,5 +562,7 @@
 </script>
 
 <style scoped>
-
+.sampling-radio-group {
+  height: 32px;
+}
 </style>

--
Gitblit v1.9.3