From ac42eaba695bbef82cdfc4166c7fddf2b45f9b0e Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期一, 20 七月 2026 14:28:00 +0800
Subject: [PATCH] Merge branch 'dev_pro_河南鹤壁' of http://114.132.189.42:9002/r/product-inventory-management into dev_pro_河南鹤壁

---
 src/views/qualityManagement/finalInspection/components/formDia.vue |   92 ++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 80 insertions(+), 12 deletions(-)

diff --git a/src/views/qualityManagement/finalInspection/components/formDia.vue b/src/views/qualityManagement/finalInspection/components/formDia.vue
index 10bfad9..e5cd36e 100644
--- a/src/views/qualityManagement/finalInspection/components/formDia.vue
+++ b/src/views/qualityManagement/finalInspection/components/formDia.vue
@@ -97,17 +97,41 @@
         </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>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="妫�娴嬬粨鏋滐細" prop="checkResult">
-              <el-select v-model="form.checkResult" :disabled="isViewMode">
-                <el-option label="鍚堟牸" value="鍚堟牸" />
-                <el-option label="涓嶅悎鏍�" value="涓嶅悎鏍�" />
-                <el-option label="閮ㄥ垎鍚堟牸" value="閮ㄥ垎鍚堟牸" />
-              </el-select>
+            <el-form-item label="鍚堟牸鐜囷細">
+              <el-tag :type="passRateTagType">{{ passRateDisplayText }}</el-tag>
             </el-form-item>
           </el-col>
         </el-row>
@@ -188,7 +212,8 @@
     qualifiedQuantity: "",
     unqualifiedQuantity: "",
     checkCompany: "",
-    checkResult: "",
+    isSampling: 0,
+    samplingQuantity: "",
   },
   rules: {
     checkTime: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
@@ -202,12 +227,44 @@
     qualifiedQuantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
     unqualifiedQuantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
     checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
-    checkResult: [{ required: true, message: "璇疯緭鍏�", trigger: "change" }],
+    isSampling: [{ required: true, message: "璇烽�夋嫨鏄惁鎶芥", trigger: "change" }],
+    samplingQuantity: [{ required: true, message: "璇疯緭鍏ユ娊妫�鏁伴噺", trigger: "blur" }],
   },
 });
 const { form, rules } = toRefs(data);
 // 鏄惁涓烘煡鐪嬫ā寮�
 const isViewMode = computed(() => operationType.value === 'view');
+
+const passRateValue = computed(() => {
+  const fromApi = form.value.passRate;
+  if (fromApi != null && fromApi !== '') {
+    const n = Number(fromApi);
+    if (!Number.isNaN(n)) return n;
+  }
+  const qualified = Number(form.value.qualifiedQuantity) || 0;
+  const unqualified = Number(form.value.unqualifiedQuantity) || 0;
+  const total = qualified + unqualified;
+  if (!total || total === 0) return null;
+  return (qualified / total) * 100;
+});
+
+const passRateDisplayText = computed(() => {
+  const params = passRateValue.value;
+  if (params == null || params === '') return '鈥�';
+  const n = Number(params);
+  if (Number.isNaN(n)) return '鈥�';
+  return `${n.toFixed(2)}%`;
+});
+
+const passRateTagType = computed(() => {
+  const params = passRateValue.value;
+  if (params == null || params === '') return 'info';
+  const n = Number(params);
+  if (Number.isNaN(n)) return 'info';
+  if (n >= 100) return 'success';
+  if (n >= 90) return 'warning';
+  return 'danger';
+});
 // 缂栬緫鏃讹細productMainId 鎴� purchaseLedgerId 浠讳竴鏈夊�煎垯宸ュ簭銆佹暟閲忕疆鐏�
 const processQuantityDisabled = computed(() => {
   const v = form.value || {};
@@ -264,15 +321,15 @@
   ]);
   userList.value = userListsRes.data;
 
-  form.value = {}
+  form.value = { isSampling: 0, samplingQuantity: "" }
   testStandardOptions.value = [];
   tableData.value = [];
 
   if (operationType.value === 'edit' || operationType.value === 'view') {
     // 鍏堜繚瀛� testStandardId锛岄伩鍏嶈娓呯┖
     const savedTestStandardId = row.testStandardId;
-    // 鍏堣缃〃鍗曟暟鎹紝浣嗘殏鏃舵竻绌� testStandardId锛岀瓑閫夐」鍔犺浇瀹屾垚鍚庡啀璁剧疆
-    form.value = {...row, testStandardId: ''}
+    const { passRate, ...rowWithoutPassRate } = row;
+    form.value = { ...rowWithoutPassRate, testStandardId: '' };
     currentProductId.value = row.productId || 0
     // 娓呯┖楠岃瘉鐘舵�侊紝閬垮厤鏁版嵁鍔犺浇杩囩▼涓殑鏍¢獙闂儊
     nextTick(() => {
@@ -477,6 +534,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");
@@ -492,5 +558,7 @@
 </script>
 
 <style scoped>
-
+.sampling-radio-group {
+  height: 32px;
+}
 </style>

--
Gitblit v1.9.3