From df76c64ca6a49dbff88ea972a68a02ce53ffdbe3 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期四, 04 六月 2026 16:59:17 +0800
Subject: [PATCH] 指标绑定选择产品时,加上工序选择框(过程检、出厂检),支持多选。出厂检验及指标维护给出厂检增加工序字段

---
 src/views/qualityManagement/metricMaintenance/StandardFormDialog.vue |  215 +-
 src/views/qualityManagement/finalInspection/components/formDia.vue   |  872 +++++----
 src/views/qualityManagement/metricMaintenance/index.vue              | 1680 ++++++++++---------
 src/views/qualityManagement/finalInspection/index.vue                | 1293 +++++++------
 src/views/qualityManagement/metricBinding/index.vue                  | 1133 +++++++-----
 5 files changed, 2,830 insertions(+), 2,363 deletions(-)

diff --git a/src/views/qualityManagement/finalInspection/components/formDia.vue b/src/views/qualityManagement/finalInspection/components/formDia.vue
index 2866cca..84c0eba 100644
--- a/src/views/qualityManagement/finalInspection/components/formDia.vue
+++ b/src/views/qualityManagement/finalInspection/components/formDia.vue
@@ -1,120 +1,167 @@
 <template>
   <div>
-    <el-dialog
-        v-model="dialogFormVisible"
-        :title="operationType === 'add' ? '鏂板鍑哄巶妫�楠�' : '缂栬緫鍑哄巶妫�楠�'"
-        width="70%"
-        @close="closeDia"
-    >
-      <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
+    <el-dialog v-model="dialogFormVisible"
+               :title="operationType === 'add' ? '鏂板鍑哄巶妫�楠�' : '缂栬緫鍑哄巶妫�楠�'"
+               width="70%"
+               @close="closeDia">
+      <el-form :model="form"
+               label-width="140px"
+               label-position="top"
+               :rules="rules"
+               ref="formRef">
         <el-row :gutter="30">
           <el-col :span="12">
-            <el-form-item label="浜у搧鍚嶇О锛�" prop="productId">
-              <el-tree-select
-                  v-model="form.productId"
-                  placeholder="璇烽�夋嫨"
-                  clearable
-                  check-strictly
-                  @change="getModels"
-                  :data="productOptions"
-                  :render-after-expand="false"
-                  :disabled="operationType === 'edit'"
-                  style="width: 100%"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="productModelId">
-              <el-select v-model="form.productModelId" placeholder="璇烽�夋嫨" clearable :disabled="operationType === 'edit'"
-                         filterable readonly @change="handleChangeModel">
-                <el-option v-for="item in modelOptions" :key="item.id" :label="item.model" :value="item.id" />
+            <el-form-item label="宸ュ簭锛�"
+                          prop="process">
+              <el-select v-model="form.process"
+                         placeholder="璇烽�夋嫨宸ュ簭"
+                         clearable
+                         :disabled="processQuantityDisabled"
+                         @change="handleProcessChange"
+                         style="width: 100%">
+                <el-option v-for="item in processList"
+                           :key="item.name"
+                           :label="item.name"
+                           :value="item.name" />
               </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="鎸囨爣閫夋嫨锛�" prop="testStandardId">
-              <el-select
-                v-model="form.testStandardId"
-                placeholder="璇烽�夋嫨鎸囨爣"
-                clearable
-                @change="handleTestStandardChange"
-                style="width: 100%"
-              >
-                <el-option
-                  v-for="item in testStandardOptions"
-                  :key="item.id"
-                  :label="item.standardName || item.standardNo"
-                  :value="item.id"
-                />
+            <el-form-item label="浜у搧鍚嶇О锛�"
+                          prop="productId">
+              <el-tree-select v-model="form.productId"
+                              placeholder="璇烽�夋嫨"
+                              clearable
+                              check-strictly
+                              @change="getModels"
+                              :data="productOptions"
+                              :render-after-expand="false"
+                              :disabled="operationType === 'edit'"
+                              style="width: 100%" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="30">
+          <el-col :span="12">
+            <el-form-item label="瑙勬牸鍨嬪彿锛�"
+                          prop="productModelId">
+              <el-select v-model="form.productModelId"
+                         placeholder="璇烽�夋嫨"
+                         clearable
+                         :disabled="operationType === 'edit'"
+                         filterable
+                         readonly
+                         @change="handleChangeModel">
+                <el-option v-for="item in modelOptions"
+                           :key="item.id"
+                           :label="item.model"
+                           :value="item.id" />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="鎸囨爣閫夋嫨锛�"
+                          prop="testStandardId">
+              <el-select v-model="form.testStandardId"
+                         placeholder="璇烽�夋嫨鎸囨爣"
+                         clearable
+                         @change="handleTestStandardChange"
+                         style="width: 100%">
+                <el-option v-for="item in testStandardOptions"
+                           :key="item.id"
+                           :label="item.standardName || item.standardNo"
+                           :value="item.id" />
               </el-select>
             </el-form-item>
           </el-col>
         </el-row>
         <el-row :gutter="30">
           <el-col :span="12">
-            <el-form-item label="鍗曚綅锛�" prop="unit">
-              <el-input v-model="form.unit" placeholder="璇疯緭鍏�" disabled/>
+            <el-form-item label="鍗曚綅锛�"
+                          prop="unit">
+              <el-input v-model="form.unit"
+                        placeholder="璇疯緭鍏�"
+                        disabled />
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="鏁伴噺锛�" prop="quantity">
-              <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.quantity" placeholder="璇疯緭鍏�" clearable :precision="2" :disabled="quantityDisabled"/>
+            <el-form-item label="鏁伴噺锛�"
+                          prop="quantity">
+              <el-input-number :step="0.01"
+                               :min="0"
+                               style="width: 100%"
+                               v-model="form.quantity"
+                               placeholder="璇疯緭鍏�"
+                               clearable
+                               :precision="2"
+                               :disabled="quantityDisabled" />
             </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/>
+            <el-form-item label="妫�娴嬪崟浣嶏細"
+                          prop="checkCompany">
+              <el-input v-model="form.checkCompany"
+                        placeholder="璇疯緭鍏�"
+                        clearable />
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="妫�娴嬬粨鏋滐細" prop="checkResult">
+            <el-form-item label="妫�娴嬬粨鏋滐細"
+                          prop="checkResult">
               <el-select v-model="form.checkResult">
-                <el-option label="鍚堟牸" value="鍚堟牸" />
-                <el-option label="涓嶅悎鏍�" value="涓嶅悎鏍�" />
+                <el-option label="鍚堟牸"
+                           value="鍚堟牸" />
+                <el-option label="涓嶅悎鏍�"
+                           value="涓嶅悎鏍�" />
               </el-select>
             </el-form-item>
           </el-col>
         </el-row>
         <el-row :gutter="30">
           <el-col :span="12">
-            <el-form-item label="妫�楠屽憳锛�" prop="checkName">
-							<el-select v-model="form.checkName" placeholder="璇烽�夋嫨" clearable filterable>
-								<el-option v-for="item in userList" :key="item.nickName" :label="item.nickName"
-													 :value="item.nickName"/>
-							</el-select>
+            <el-form-item label="妫�楠屽憳锛�"
+                          prop="checkName">
+              <el-select v-model="form.checkName"
+                         placeholder="璇烽�夋嫨"
+                         clearable
+                         filterable>
+                <el-option v-for="item in userList"
+                           :key="item.nickName"
+                           :label="item.nickName"
+                           :value="item.nickName" />
+              </el-select>
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="妫�娴嬫棩鏈燂細" prop="checkTime">
-              <el-date-picker
-                  v-model="form.checkTime"
-                  type="date"
-                  placeholder="璇烽�夋嫨鏃ユ湡"
-                  value-format="YYYY-MM-DD"
-                  format="YYYY-MM-DD"
-                  clearable
-                  style="width: 100%"
-              />
+            <el-form-item label="妫�娴嬫棩鏈燂細"
+                          prop="checkTime">
+              <el-date-picker v-model="form.checkTime"
+                              type="date"
+                              placeholder="璇烽�夋嫨鏃ユ湡"
+                              value-format="YYYY-MM-DD"
+                              format="YYYY-MM-DD"
+                              clearable
+                              style="width: 100%" />
             </el-form-item>
           </el-col>
         </el-row>
       </el-form>
-			<PIMTable
-				rowKey="id"
-				:column="tableColumn"
-				:tableData="tableData"
-				:tableLoading="tableLoading"
-				height="400"
-			>
-				<template #slot="{ row }">
-					<el-input v-model="row.testValue" clearable/>
-				</template>
-			</PIMTable>
+      <PIMTable rowKey="id"
+                :column="tableColumn"
+                :tableData="tableData"
+                :tableLoading="tableLoading"
+                height="400">
+        <template #slot="{ row }">
+          <el-input v-model="row.testValue"
+                    clearable />
+        </template>
+      </PIMTable>
       <template #footer>
         <div class="dialog-footer">
-          <el-button type="primary" @click="submitForm">纭</el-button>
+          <el-button type="primary"
+                     @click="submitForm">纭</el-button>
           <el-button @click="closeDia">鍙栨秷</el-button>
         </div>
       </template>
@@ -123,315 +170,396 @@
 </template>
 
 <script setup>
-import {ref, reactive, toRefs, computed, getCurrentInstance, nextTick} from "vue";
-import {getOptions} from "@/api/procurementManagement/procurementLedger.js";
-import {modelList, productTreeList} from "@/api/basicData/product.js";
-import {qualityInspectAdd, qualityInspectUpdate} from "@/api/qualityManagement/rawMaterialInspection.js";
-import {userListNoPage} from "@/api/system/user.js";
-import {qualityInspectDetailByProductId, getQualityTestStandardParamByTestStandardId} from "@/api/qualityManagement/metricMaintenance.js";
-import {qualityInspectParamInfo} from "@/api/qualityManagement/qualityInspectParam.js";
-const { proxy } = getCurrentInstance()
-const emit = defineEmits(['close'])
+  import {
+    ref,
+    reactive,
+    toRefs,
+    computed,
+    getCurrentInstance,
+    nextTick,
+  } from "vue";
+  import { getOptions } from "@/api/procurementManagement/procurementLedger.js";
+  import { modelList, productTreeList } from "@/api/basicData/product.js";
+  import {
+    qualityInspectAdd,
+    qualityInspectUpdate,
+  } from "@/api/qualityManagement/rawMaterialInspection.js";
+  import { userListNoPage } from "@/api/system/user.js";
+  import {
+    qualityInspectDetailByProductId,
+    getQualityTestStandardParamByTestStandardId,
+  } from "@/api/qualityManagement/metricMaintenance.js";
+  import { qualityInspectParamInfo } from "@/api/qualityManagement/qualityInspectParam.js";
+  import { list } from "@/api/productionManagement/productionProcess";
+  const { proxy } = getCurrentInstance();
+  const emit = defineEmits(["close"]);
 
-const dialogFormVisible = ref(false);
-const operationType = ref('')
-const data = reactive({
-  form: {
-    checkTime: "",
-    process: "",
-    checkName: "",
-    productName: "",
-    productId: "",
-    productModelId: "",
-    model: "",
-    testStandardId: "",
-    unit: "",
-    quantity: "",
-    checkCompany: "",
-    checkResult: "",
-  },
-  rules: {
-    checkTime: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" },],
-    process: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
-    checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
-    productId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
-    productModelId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
-    testStandardId: [{required: false, message: "璇烽�夋嫨鎸囨爣", trigger: "change"}],
-    unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
-    quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
-    checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
-    checkResult: [{ required: true, message: "璇疯緭鍏�", trigger: "change" }],
-  },
-});
-const { form, rules } = toRefs(data);
-// 缂栬緫鏃讹細productMainId 鎴� purchaseLedgerId 浠讳竴鏈夊�煎垯鏁伴噺缃伆
-const quantityDisabled = computed(() => {
-  const v = form.value || {};
-  return !!(v.productMainId != null || v.purchaseLedgerId != null);
-});
-const supplierList = ref([]);
-const productOptions = ref([]);
-const tableColumn = ref([
-	{
-		label: "鎸囨爣",
-		prop: "parameterItem",
-	},
-	{
-		label: "鍗曚綅",
-		prop: "unit",
-	},
-	{
-		label: "鏍囧噯鍊�",
-		prop: "standardValue",
-	},
-	{
-		label: "鍐呮帶鍊�",
-		prop: "controlValue",
-	},
-	{
-		label: "妫�楠屽��",
-		prop: "testValue",
-		dataType: 'slot',
-		slot: 'slot',
-	},
-]);
-const tableData = ref([]);
-const tableLoading = ref(false);
-const userList = ref([]);
-const currentProductId = ref(0);
-const testStandardOptions = ref([]); // 鎸囨爣閫夋嫨涓嬫媺妗嗘暟鎹�
-const modelOptions = ref([]);
-
-// 鎵撳紑寮规
-const openDialog = async (type, row, defaultCheckResult = "", defaultCheckName = "") => {
-  operationType.value = type;
-  dialogFormVisible.value = true;
-  // 鍏堟竻绌鸿〃鍗曢獙璇佺姸鎬侊紝閬垮厤闂儊
-  await nextTick();
-  proxy.$refs.formRef?.clearValidate();
-
-  // 骞惰鍔犺浇鍩虹鏁版嵁
-  const [userListsRes] = await Promise.all([
-    userListNoPage(),
-    getProductOptions(),
-    getOptions().then((res) => {
-      supplierList.value = res.data;
-    })
+  const dialogFormVisible = ref(false);
+  const operationType = ref("");
+  const data = reactive({
+    form: {
+      checkTime: "",
+      process: "",
+      checkName: "",
+      productName: "",
+      productId: "",
+      productModelId: "",
+      model: "",
+      testStandardId: "",
+      unit: "",
+      quantity: "",
+      checkCompany: "",
+      checkResult: "",
+    },
+    rules: {
+      checkTime: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+      process: [{ required: true, message: "璇烽�夋嫨宸ュ簭", trigger: "change" }],
+      checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+      productId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+      productModelId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+      testStandardId: [
+        { required: false, message: "璇烽�夋嫨鎸囨爣", trigger: "change" },
+      ],
+      unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+      quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+      checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+      checkResult: [{ required: true, message: "璇疯緭鍏�", trigger: "change" }],
+    },
+  });
+  const { form, rules } = toRefs(data);
+  // 缂栬緫鏃讹細productMainId 鎴� purchaseLedgerId 浠讳竴鏈夊�煎垯鏁伴噺缃伆
+  const quantityDisabled = computed(() => {
+    const v = form.value || {};
+    return !!(v.productMainId != null || v.purchaseLedgerId != null);
+  });
+  const processQuantityDisabled = computed(() => {
+    const v = form.value || {};
+    return !!(v.productMainId != null || v.purchaseLedgerId != null);
+  });
+  const processList = ref([]); // 宸ュ簭涓嬫媺鍒楄〃锛堝伐搴忓悕绉� name锛�
+  const supplierList = ref([]);
+  const productOptions = ref([]);
+  const tableColumn = ref([
+    {
+      label: "鎸囨爣",
+      prop: "parameterItem",
+    },
+    {
+      label: "鍗曚綅",
+      prop: "unit",
+    },
+    {
+      label: "鏍囧噯鍊�",
+      prop: "standardValue",
+    },
+    {
+      label: "鍐呮帶鍊�",
+      prop: "controlValue",
+    },
+    {
+      label: "妫�楠屽��",
+      prop: "testValue",
+      dataType: "slot",
+      slot: "slot",
+    },
   ]);
-  // 绛涢�� roleIds 鍖呭惈 106 鐨勭敤鎴�
-  userList.value = (userListsRes.data || []).filter(user => {
-    const roleIds = user.roleIds || [];
-    return roleIds.includes(106) || roleIds.includes('106');
-  });
+  const tableData = ref([]);
+  const tableLoading = ref(false);
+  const userList = ref([]);
+  const currentProductId = ref(0);
+  const testStandardOptions = ref([]); // 鎸囨爣閫夋嫨涓嬫媺妗嗘暟鎹�
+  const modelOptions = ref([]);
 
-  form.value = {}
-  testStandardOptions.value = [];
-  tableData.value = [];
+  // 鎵撳紑寮规
+  const openDialog = async (
+    type,
+    row,
+    defaultCheckResult = "",
+    defaultCheckName = ""
+  ) => {
+    operationType.value = type;
+    dialogFormVisible.value = true;
+    await nextTick();
+    proxy.$refs.formRef?.clearValidate?.();
 
-  if (operationType.value === 'edit') {
-    // 鍏堜繚瀛� testStandardId锛岄伩鍏嶈娓呯┖
-    const savedTestStandardId = row.testStandardId;
-    // 鍏堣缃〃鍗曟暟鎹紝浣嗘殏鏃舵竻绌� testStandardId锛岀瓑閫夐」鍔犺浇瀹屾垚鍚庡啀璁剧疆
-    form.value = {...row, testStandardId: ''}
-    // 濡傛灉浼犲叆浜嗛粯璁ゆ娴嬬粨鏋滐紝瑕嗙洊row涓殑鍊�
-    if (defaultCheckResult) {
-      form.value.checkResult = defaultCheckResult;
-    }
-    // 濡傛灉浼犲叆浜嗛粯璁ゆ楠屽憳锛岃鐩杛ow涓殑鍊硷紙浼樺厛浣跨敤浼犲叆鐨勬楠屽憳锛�
-    console.log('formDia checkName debug:', { defaultCheckName, rowCheckName: row.checkName });
-    form.value.checkName = defaultCheckName || row.checkName || "";
-    currentProductId.value = row.productId || 0
-    // 娓呯┖楠岃瘉鐘舵�侊紝閬垮厤鏁版嵁鍔犺浇杩囩▼涓殑鏍¢獙闂儊
-    nextTick(() => {
-      proxy.$refs.formRef?.clearValidate();
+    const [userListsRes] = await Promise.all([
+      userListNoPage(),
+      getProductOptions(),
+      getOptions().then(res => {
+        supplierList.value = res.data;
+      }),
+      list()
+        .then(res => {
+          processList.value = res.data || [];
+        })
+        .catch(() => {
+          processList.value = [];
+        }),
+    ]);
+    // 绛涢�� roleIds 鍖呭惈 106 鐨勭敤鎴�
+    userList.value = (userListsRes.data || []).filter(user => {
+      const roleIds = user.roleIds || [];
+      return roleIds.includes(106) || roleIds.includes("106");
     });
-    
-    // 缂栬緫妯″紡涓嬶紝骞惰鍔犺浇瑙勬牸鍨嬪彿鍜屾寚鏍囬�夐」
-    if (currentProductId.value) {
-      // 璁剧疆浜у搧鍚嶇О
-      form.value.productName = findNodeById(productOptions.value, currentProductId.value);
-      
-      // 骞惰鍔犺浇瑙勬牸鍨嬪彿鍜屾寚鏍囬�夐」
-      const params = {
-        productId: currentProductId.value,
-        inspectType: 2
-      };
-      
-      Promise.all([
-        modelList({ id: currentProductId.value }),
-        qualityInspectDetailByProductId(params)
-      ]).then(([modelRes, testStandardRes]) => {
-        // 璁剧疆瑙勬牸鍨嬪彿閫夐」
-        modelOptions.value = modelRes || [];
-        // 濡傛灉琛ㄥ崟涓凡鏈� productModelId锛岃缃搴旂殑 model 鍜� unit
-        if (form.value.productModelId && modelOptions.value.length > 0) {
-          const selectedModel = modelOptions.value.find(item => item.id == form.value.productModelId);
-          if (selectedModel) {
-            form.value.model = selectedModel.model || '';
-            form.value.unit = selectedModel.unit || '';
-          }
-        }
-        
-        // 璁剧疆鎸囨爣閫夐」
-        testStandardOptions.value = testStandardRes.data || [];
-        
-        // 璁剧疆 testStandardId 骞跺姞杞藉弬鏁板垪琛�
-        nextTick(() => {
-          if (savedTestStandardId) {
-            // 纭繚绫诲瀷鍖归厤锛坕tem.id 鍙兘鏄暟瀛楁垨瀛楃涓诧級
-            const matchedOption = testStandardOptions.value.find(item => 
-              item.id == savedTestStandardId || String(item.id) === String(savedTestStandardId)
-            );
-            if (matchedOption) {
-              // 纭繚浣跨敤鍖归厤椤圭殑 id锛堜繚鎸佺被鍨嬩竴鑷达級
-              form.value.testStandardId = matchedOption.id;
-            } else {
-              // 濡傛灉鎵句笉鍒板尮閰嶉」锛屽皾璇曠洿鎺ヤ娇鐢ㄥ師鍊�
-              console.warn('鏈壘鍒板尮閰嶇殑鎸囨爣閫夐」锛宼estStandardId:', savedTestStandardId, '鍙敤閫夐」:', testStandardOptions.value);
-              form.value.testStandardId = savedTestStandardId;
-            }
-          }
-          // 缂栬緫鍦烘櫙淇濈暀宸叉湁妫�楠屽�硷紝鐩存帴鎷夊彇鍘熷弬鏁版暟鎹�
-          getQualityInspectParamList(row.id);
-        });
-      });
-    } else {
-      getQualityInspectParamList(row.id);
-    }
-  }
-}
-const getProductOptions = () => {
-  return productTreeList().then((res) => {
-    productOptions.value = convertIdToValue(res);
-  });
-};
-const getModels = (value) => {
-  form.value.productModelId = undefined;
-  form.value.unit = undefined;
-  modelOptions.value = [];
-  currentProductId.value = value
-  form.value.productName = findNodeById(productOptions.value, value);
-  modelList({ id: value }).then((res) => {
-    modelOptions.value = res;
-  })
-  if (currentProductId.value) {
-    getList();
-  }
-};
 
-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 || '';
-}
-
-const findNodeById = (nodes, productId) => {
-  for (let i = 0; i < nodes.length; i++) {
-    if (nodes[i].value === productId) {
-      return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣
-    }
-    if (nodes[i].children && nodes[i].children.length > 0) {
-      const foundNode = findNodeById(nodes[i].children, productId);
-      if (foundNode) {
-        return foundNode; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐�
-      }
-    }
-  }
-  return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
-};
-function convertIdToValue(data) {
-  return data.map((item) => {
-    const { id, children, ...rest } = item;
-    const newItem = {
-      ...rest,
-      value: id, // 灏� id 鏀逛负 value
+    currentProductId.value = 0;
+    modelOptions.value = [];
+    form.value = {
+      checkTime: "",
+      process: "",
+      checkName: defaultCheckName || "",
+      productName: "",
+      productId: "",
+      productModelId: "",
+      model: "",
+      testStandardId: "",
+      unit: "",
+      quantity: "",
+      checkCompany: "",
+      checkResult: defaultCheckResult || "",
     };
-    if (children && children.length > 0) {
-      newItem.children = convertIdToValue(children);
-    }
-    
-    return newItem;
-  });
-}
-// 鎻愪氦浜у搧琛ㄥ崟
-const submitForm = () => {
-  proxy.$refs.formRef.validate(valid => {
-    if (valid) {
-      form.value.inspectType = 2
-			if (operationType.value === "add") {
-				tableData.value.forEach((item) => {
-					delete item.id
-				})
-			}
-			const data = {...form.value, qualityInspectParams: tableData.value}
-      if (operationType.value === "add") {
-        qualityInspectAdd(data).then(res => {
-          proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
-          closeDia();
-        })
-      } else {
-        qualityInspectUpdate(data).then(res => {
-          proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
-          closeDia();
-        })
-      }
-    }
-  })
-}
-const getList = () => {
-  if (!currentProductId.value) {
     testStandardOptions.value = [];
     tableData.value = [];
-    return;
-  }
-  let params = {
-    productId: currentProductId.value,
-    inspectType: 2
-  }
-	qualityInspectDetailByProductId(params).then(res => {
-		// 淇濆瓨涓嬫媺妗嗛�夐」鏁版嵁
-		testStandardOptions.value = res.data || [];
-		// 娓呯┖琛ㄦ牸鏁版嵁锛岀瓑寰呯敤鎴烽�夋嫨鎸囨爣
-		tableData.value = [];
-		// 娓呯┖鎸囨爣閫夋嫨
-		form.value.testStandardId = '';
-	})
-}
 
-// 鎸囨爣閫夋嫨鍙樺寲澶勭悊
-const handleTestStandardChange = (testStandardId) => {
-  if (!testStandardId) {
+    if (operationType.value === "edit") {
+      // 鍏堜繚瀛� testStandardId锛岄伩鍏嶈娓呯┖
+      const savedTestStandardId = row.testStandardId;
+      // 鍏堣缃〃鍗曟暟鎹紝浣嗘殏鏃舵竻绌� testStandardId锛岀瓑閫夐」鍔犺浇瀹屾垚鍚庡啀璁剧疆
+      form.value = { ...row, testStandardId: "" };
+      // 濡傛灉浼犲叆浜嗛粯璁ゆ娴嬬粨鏋滐紝瑕嗙洊row涓殑鍊�
+      if (defaultCheckResult) {
+        form.value.checkResult = defaultCheckResult;
+      }
+      // 濡傛灉浼犲叆浜嗛粯璁ゆ楠屽憳锛岃鐩杛ow涓殑鍊硷紙浼樺厛浣跨敤浼犲叆鐨勬楠屽憳锛�
+      console.log("formDia checkName debug:", {
+        defaultCheckName,
+        rowCheckName: row.checkName,
+      });
+      form.value.checkName = defaultCheckName || row.checkName || "";
+      currentProductId.value = row.productId || 0;
+      // 娓呯┖楠岃瘉鐘舵�侊紝閬垮厤鏁版嵁鍔犺浇杩囩▼涓殑鏍¢獙闂儊
+      nextTick(() => {
+        proxy.$refs.formRef?.clearValidate();
+      });
+
+      // 缂栬緫妯″紡涓嬶紝骞惰鍔犺浇瑙勬牸鍨嬪彿鍜屾寚鏍囬�夐」
+      if (currentProductId.value) {
+        // 璁剧疆浜у搧鍚嶇О
+        form.value.productName = findNodeById(
+          productOptions.value,
+          currentProductId.value
+        );
+
+        // 骞惰鍔犺浇瑙勬牸鍨嬪彿鍜屾寚鏍囬�夐」
+        const params = {
+          productId: currentProductId.value,
+          inspectType: 2,
+          process: form.value.process || "",
+        };
+
+        Promise.all([
+          modelList({ id: currentProductId.value }),
+          qualityInspectDetailByProductId(params),
+        ]).then(([modelRes, testStandardRes]) => {
+          // 璁剧疆瑙勬牸鍨嬪彿閫夐」
+          modelOptions.value = modelRes || [];
+          // 濡傛灉琛ㄥ崟涓凡鏈� productModelId锛岃缃搴旂殑 model 鍜� unit
+          if (form.value.productModelId && modelOptions.value.length > 0) {
+            const selectedModel = modelOptions.value.find(
+              item => item.id == form.value.productModelId
+            );
+            if (selectedModel) {
+              form.value.model = selectedModel.model || "";
+              form.value.unit = selectedModel.unit || "";
+            }
+          }
+
+          // 璁剧疆鎸囨爣閫夐」
+          testStandardOptions.value = testStandardRes.data || [];
+
+          // 璁剧疆 testStandardId 骞跺姞杞藉弬鏁板垪琛�
+          nextTick(() => {
+            if (savedTestStandardId) {
+              // 纭繚绫诲瀷鍖归厤锛坕tem.id 鍙兘鏄暟瀛楁垨瀛楃涓诧級
+              const matchedOption = testStandardOptions.value.find(
+                item =>
+                  item.id == savedTestStandardId ||
+                  String(item.id) === String(savedTestStandardId)
+              );
+              if (matchedOption) {
+                // 纭繚浣跨敤鍖归厤椤圭殑 id锛堜繚鎸佺被鍨嬩竴鑷达級
+                form.value.testStandardId = matchedOption.id;
+              } else {
+                // 濡傛灉鎵句笉鍒板尮閰嶉」锛屽皾璇曠洿鎺ヤ娇鐢ㄥ師鍊�
+                console.warn(
+                  "鏈壘鍒板尮閰嶇殑鎸囨爣閫夐」锛宼estStandardId:",
+                  savedTestStandardId,
+                  "鍙敤閫夐」:",
+                  testStandardOptions.value
+                );
+                form.value.testStandardId = savedTestStandardId;
+              }
+            }
+            // 缂栬緫鍦烘櫙淇濈暀宸叉湁妫�楠屽�硷紝鐩存帴鎷夊彇鍘熷弬鏁版暟鎹�
+            getQualityInspectParamList(row.id);
+          });
+        });
+      } else {
+        getQualityInspectParamList(row.id);
+      }
+    }
+  };
+  const getProductOptions = () => {
+    return productTreeList().then(res => {
+      productOptions.value = convertIdToValue(res);
+    });
+  };
+  const getModels = value => {
+    form.value.productModelId = undefined;
+    form.value.unit = undefined;
+    modelOptions.value = [];
+    currentProductId.value = value;
+    form.value.productName = findNodeById(productOptions.value, value);
+    modelList({ id: value }).then(res => {
+      modelOptions.value = res;
+    });
+    if (currentProductId.value) {
+      getList();
+    }
+  };
+
+  const handleProcessChange = () => {
+    testStandardOptions.value = [];
     tableData.value = [];
-    return;
+    form.value.testStandardId = "";
+    if (currentProductId.value) {
+      getList();
+    }
+  };
+
+  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 || "";
+  };
+
+  const findNodeById = (nodes, productId) => {
+    for (let i = 0; i < nodes.length; i++) {
+      if (nodes[i].value === productId) {
+        return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣
+      }
+      if (nodes[i].children && nodes[i].children.length > 0) {
+        const foundNode = findNodeById(nodes[i].children, productId);
+        if (foundNode) {
+          return foundNode; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐�
+        }
+      }
+    }
+    return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
+  };
+  function convertIdToValue(data) {
+    return data.map(item => {
+      const { id, children, ...rest } = item;
+      const newItem = {
+        ...rest,
+        value: id, // 灏� id 鏀逛负 value
+      };
+      if (children && children.length > 0) {
+        newItem.children = convertIdToValue(children);
+      }
+
+      return newItem;
+    });
   }
-  tableLoading.value = true;
-  getQualityTestStandardParamByTestStandardId(testStandardId).then(res => {
-    tableData.value = res.data || [];
-  }).catch(error => {
-    console.error('鑾峰彇鏍囧噯鍙傛暟澶辫触:', error);
+  // 鎻愪氦浜у搧琛ㄥ崟
+  const submitForm = () => {
+    proxy.$refs.formRef.validate(valid => {
+      if (valid) {
+        form.value.inspectType = 2;
+        if (operationType.value === "add") {
+          tableData.value.forEach(item => {
+            delete item.id;
+          });
+        }
+        const processName = form.value.process || "";
+        const data = {
+          ...form.value,
+          process: processName,
+          qualityInspectParams: tableData.value,
+        };
+        if (operationType.value === "add") {
+          qualityInspectAdd(data).then(res => {
+            proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+            closeDia();
+          });
+        } else {
+          qualityInspectUpdate(data).then(res => {
+            proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+            closeDia();
+          });
+        }
+      }
+    });
+  };
+  const getList = () => {
+    if (!currentProductId.value) {
+      testStandardOptions.value = [];
+      tableData.value = [];
+      return;
+    }
+    let params = {
+      productId: currentProductId.value,
+      inspectType: 2,
+      process: form.value.process || "",
+    };
+    qualityInspectDetailByProductId(params).then(res => {
+      // 淇濆瓨涓嬫媺妗嗛�夐」鏁版嵁
+      testStandardOptions.value = res.data || [];
+      // 娓呯┖琛ㄦ牸鏁版嵁锛岀瓑寰呯敤鎴烽�夋嫨鎸囨爣
+      tableData.value = [];
+      // 娓呯┖鎸囨爣閫夋嫨
+      form.value.testStandardId = "";
+    });
+  };
+
+  // 鎸囨爣閫夋嫨鍙樺寲澶勭悊
+  const handleTestStandardChange = testStandardId => {
+    if (!testStandardId) {
+      tableData.value = [];
+      return;
+    }
+    tableLoading.value = true;
+    getQualityTestStandardParamByTestStandardId(testStandardId)
+      .then(res => {
+        tableData.value = res.data || [];
+      })
+      .catch(error => {
+        console.error("鑾峰彇鏍囧噯鍙傛暟澶辫触:", error);
+        tableData.value = [];
+      })
+      .finally(() => {
+        tableLoading.value = false;
+      });
+  };
+  const getQualityInspectParamList = id => {
+    qualityInspectParamInfo(id).then(res => {
+      tableData.value = res.data;
+    });
+  };
+  // 鍏抽棴寮规
+  const closeDia = () => {
+    proxy.resetForm("formRef");
     tableData.value = [];
-  }).finally(() => {
-    tableLoading.value = false;
-  })
-}
-const getQualityInspectParamList = (id) => {
-	qualityInspectParamInfo(id).then(res => {
-		tableData.value = res.data;
-	})
-}
-// 鍏抽棴寮规
-const closeDia = () => {
-  proxy.resetForm("formRef");
-  tableData.value = [];
-  testStandardOptions.value = [];
-  form.value.testStandardId = '';
-  dialogFormVisible.value = false;
-  emit('close')
-};
-defineExpose({
-  openDialog,
-});
+    testStandardOptions.value = [];
+    form.value.testStandardId = "";
+    dialogFormVisible.value = false;
+    emit("close");
+  };
+  defineExpose({
+    openDialog,
+  });
 </script>
 
 <style scoped>
-
-</style>
\ No newline at end of file
+</style>
diff --git a/src/views/qualityManagement/finalInspection/index.vue b/src/views/qualityManagement/finalInspection/index.vue
index f60ab1c..ea8e698 100644
--- a/src/views/qualityManagement/finalInspection/index.vue
+++ b/src/views/qualityManagement/finalInspection/index.vue
@@ -2,50 +2,73 @@
   <div class="app-container">
     <div class="search_form">
       <div>
-        <span class="search_title">浜у搧鍚嶇О锛�</span>
-        <el-input
-            v-model="searchForm.productName"
-            style="width: 240px"
-            placeholder="璇疯緭鍏ヤ骇鍝佸悕绉版悳绱�"
-            @change="handleQuery"
-            clearable
-            :prefix-icon="Search"
-        />
-        <span  style="margin-left: 10px" class="search_title">妫�娴嬫棩鏈燂細</span>
-        <el-date-picker  v-model="searchForm.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="daterange"
-                         placeholder="璇烽�夋嫨" clearable @change="changeDaterange" />
-        <el-button type="primary" @click="handleQuery" style="margin-left: 10px"
-        >鎼滅储</el-button
-        >
+        <span class="search_title">宸ュ簭锛�</span>
+        <el-input v-model="searchForm.process"
+                  style="width: 240px"
+                  placeholder="璇疯緭鍏ュ伐搴忔悳绱�"
+                  @change="handleQuery"
+                  clearable
+                  :prefix-icon="Search" />
+        <span style="margin-left: 10px"
+              class="search_title">浜у搧鍚嶇О锛�</span>
+        <el-input v-model="searchForm.productName"
+                  style="width: 240px"
+                  placeholder="璇疯緭鍏ヤ骇鍝佸悕绉版悳绱�"
+                  @change="handleQuery"
+                  clearable
+                  :prefix-icon="Search" />
+        <span style="margin-left: 10px"
+              class="search_title">妫�娴嬫棩鏈燂細</span>
+        <el-date-picker v-model="searchForm.entryDate"
+                        value-format="YYYY-MM-DD"
+                        format="YYYY-MM-DD"
+                        type="daterange"
+                        placeholder="璇烽�夋嫨"
+                        clearable
+                        @change="changeDaterange" />
+        <el-button type="primary"
+                   @click="handleQuery"
+                   style="margin-left: 10px">鎼滅储</el-button>
       </div>
       <div>
-        <el-button type="primary" @click="openForm('add')">鏂板</el-button>
+        <el-button type="primary"
+                   @click="openForm('add')">鏂板</el-button>
         <el-button @click="handleOut">瀵煎嚭</el-button>
-        <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
+        <el-button type="danger"
+                   plain
+                   @click="handleDelete">鍒犻櫎</el-button>
       </div>
     </div>
     <div class="table_list">
-      <PIMTable
-          rowKey="id"
-          :column="tableColumn"
-          :tableData="tableData"
-          :page="page"
-          :isSelection="true"
-          @selection-change="handleSelectionChange"
-          :tableLoading="tableLoading"
-          @pagination="pagination"
-          :total="page.total"
-      ></PIMTable>
+      <PIMTable rowKey="id"
+                :column="tableColumn"
+                :tableData="tableData"
+                :page="page"
+                :isSelection="true"
+                @selection-change="handleSelectionChange"
+                :tableLoading="tableLoading"
+                @pagination="pagination"
+                :total="page.total"></PIMTable>
     </div>
-    <InspectionFormDia ref="inspectionFormDia" @close="handleQuery"></InspectionFormDia>
-    <FormDia ref="formDia" @close="handleQuery"></FormDia>
-    <files-dia ref="filesDia" @close="handleQuery"></files-dia>
+    <InspectionFormDia ref="inspectionFormDia"
+                       @close="handleQuery"></InspectionFormDia>
+    <FormDia ref="formDia"
+             @close="handleQuery"></FormDia>
+    <files-dia ref="filesDia"
+               @close="handleQuery"></files-dia>
     <!-- 妫�楠岀粨鏋滈�夋嫨瀵硅瘽妗� -->
-    <el-dialog v-model="quickCheckVisible" title="妫�楠�" width="40%" @close="closeQuickCheck">
-      <el-form :model="quickCheckForm" label-width="140px" label-position="top" ref="quickCheckRef">
+    <el-dialog v-model="quickCheckVisible"
+               title="妫�楠�"
+               width="40%"
+               @close="closeQuickCheck">
+      <el-form :model="quickCheckForm"
+               label-width="140px"
+               label-position="top"
+               ref="quickCheckRef">
         <el-row :gutter="20">
           <el-col :span="12">
-            <el-form-item label="妫�娴嬬粨鏋滐細" required>
+            <el-form-item label="妫�娴嬬粨鏋滐細"
+                          required>
               <el-radio-group v-model="quickCheckForm.checkResult">
                 <el-radio value="鍚堟牸">鍚堟牸</el-radio>
                 <el-radio value="涓嶅悎鏍�">涓嶅悎鏍�</el-radio>
@@ -53,42 +76,44 @@
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="妫�楠屽憳锛�" required>
-              <el-select v-model="quickCheckForm.checkName" placeholder="璇烽�夋嫨" clearable style="width: 100%">
-                <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"/>
+            <el-form-item label="妫�楠屽憳锛�"
+                          required>
+              <el-select v-model="quickCheckForm.checkName"
+                         placeholder="璇烽�夋嫨"
+                         clearable
+                         style="width: 100%">
+                <el-option v-for="item in userList"
+                           :key="item.nickName"
+                           :label="item.nickName"
+                           :value="item.nickName" />
               </el-select>
             </el-form-item>
           </el-col>
         </el-row>
         <el-row :gutter="20">
           <el-col :span="12">
-            <el-form-item label="妫�娴嬫棩鏈燂細" required>
-              <el-date-picker
-                v-model="quickCheckForm.checkTime"
-                type="date"
-                placeholder="璇烽�夋嫨鏃ユ湡"
-                value-format="YYYY-MM-DD"
-                format="YYYY-MM-DD"
-                clearable
-                style="width: 100%"
-              />
+            <el-form-item label="妫�娴嬫棩鏈燂細"
+                          required>
+              <el-date-picker v-model="quickCheckForm.checkTime"
+                              type="date"
+                              placeholder="璇烽�夋嫨鏃ユ湡"
+                              value-format="YYYY-MM-DD"
+                              format="YYYY-MM-DD"
+                              clearable
+                              style="width: 100%" />
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="鎸囨爣閫夋嫨锛�">
-              <el-select
-                v-model="quickCheckForm.testStandardId"
-                placeholder="璇烽�夋嫨鎸囨爣"
-                clearable
-                @change="handleTestStandardChange"
-                style="width: 100%"
-              >
-                <el-option
-                  v-for="item in testStandardOptions"
-                  :key="item.id"
-                  :label="item.standardName || item.standardNo"
-                  :value="item.id"
-                />
+              <el-select v-model="quickCheckForm.testStandardId"
+                         placeholder="璇烽�夋嫨鎸囨爣"
+                         clearable
+                         @change="handleTestStandardChange"
+                         style="width: 100%">
+                <el-option v-for="item in testStandardOptions"
+                           :key="item.id"
+                           :label="item.standardName || item.standardNo"
+                           :value="item.id" />
               </el-select>
             </el-form-item>
           </el-col>
@@ -96,344 +121,380 @@
         <el-row :gutter="20">
           <el-col :span="12">
             <el-form-item label="妫�娴嬪崟浣嶏細">
-              <el-input v-model="quickCheckForm.checkCompany" placeholder="璇疯緭鍏�" clearable style="width: 100%"/>
+              <el-input v-model="quickCheckForm.checkCompany"
+                        placeholder="璇疯緭鍏�"
+                        clearable
+                        style="width: 100%" />
             </el-form-item>
           </el-col>
         </el-row>
         <!-- 妫�楠屽�艰〃鏍� -->
-        <el-form-item label="妫�楠屽�硷細" v-if="quickCheckTableData.length > 0">
-          <PIMTable
-            rowKey="id"
-            :column="quickCheckTableColumn"
-            :tableData="quickCheckTableData"
-            :tableLoading="quickCheckTableLoading"
-            height="200"
-          >
+        <el-form-item label="妫�楠屽�硷細"
+                      v-if="quickCheckTableData.length > 0">
+          <PIMTable rowKey="id"
+                    :column="quickCheckTableColumn"
+                    :tableData="quickCheckTableData"
+                    :tableLoading="quickCheckTableLoading"
+                    height="200">
             <template #slot="{ row }">
-              <el-input v-model="row.testValue" clearable placeholder="璇疯緭鍏ユ楠屽��"/>
+              <el-input v-model="row.testValue"
+                        clearable
+                        placeholder="璇疯緭鍏ユ楠屽��" />
             </template>
           </PIMTable>
         </el-form-item>
       </el-form>
       <template #footer>
         <div class="dialog-footer">
-          <el-button type="primary" @click="handleQuickCheckConfirm">纭</el-button>
+          <el-button type="primary"
+                     @click="handleQuickCheckConfirm">纭</el-button>
           <el-button @click="closeQuickCheck">鍙栨秷</el-button>
         </div>
       </template>
     </el-dialog>
-    <el-dialog v-model="dialogFormVisible" title="缂栬緫妫�楠屽憳" width="30%"
-							 @close="closeDia">
-				<el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
-					<el-form-item label="妫�楠屽憳锛�" prop="checkName">
-						<el-select v-model="form.checkName" placeholder="璇烽�夋嫨" clearable>
-							<el-option v-for="item in userList" :key="item.nickName" :label="item.nickName"
-												 :value="item.nickName"/>
-						</el-select>
-					</el-form-item>
-				</el-form>
-				<template #footer>
-					<div class="dialog-footer">
-						<el-button type="primary" @click="submitForm">纭</el-button>
-						<el-button @click="closeDia">鍙栨秷</el-button>
-					</div>
-				</template>
-			</el-dialog>
+    <el-dialog v-model="dialogFormVisible"
+               title="缂栬緫妫�楠屽憳"
+               width="30%"
+               @close="closeDia">
+      <el-form :model="form"
+               label-width="140px"
+               label-position="top"
+               :rules="rules"
+               ref="formRef">
+        <el-form-item label="妫�楠屽憳锛�"
+                      prop="checkName">
+          <el-select v-model="form.checkName"
+                     placeholder="璇烽�夋嫨"
+                     clearable>
+            <el-option v-for="item in userList"
+                       :key="item.nickName"
+                       :label="item.nickName"
+                       :value="item.nickName" />
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button type="primary"
+                     @click="submitForm">纭</el-button>
+          <el-button @click="closeDia">鍙栨秷</el-button>
+        </div>
+      </template>
+    </el-dialog>
   </div>
 </template>
 
 <script setup>
-import { Search } from "@element-plus/icons-vue";
-import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick} from "vue";
-import InspectionFormDia from "@/views/qualityManagement/finalInspection/components/inspectionFormDia.vue";
-import FormDia from "@/views/qualityManagement/finalInspection/components/formDia.vue";
-import {ElMessageBox} from "element-plus";
-import {
-	downloadQualityInspect,
-	qualityInspectDel,
-	qualityInspectDetail,
-	qualityInspectListPage, qualityInspectUpdate,
-	submitQualityInspect,
-	qualityInspectExportNew
-} from "@/api/qualityManagement/rawMaterialInspection.js";
-import {qualityInspectDetailByProductId, getQualityTestStandardParamByTestStandardId} from "@/api/qualityManagement/metricMaintenance.js";
-import FilesDia from "@/views/qualityManagement/finalInspection/components/filesDia.vue";
-import dayjs from "dayjs";
-import {userListNoPage} from "@/api/system/user.js";
-import useUserStore from "@/store/modules/user";
+  import { Search } from "@element-plus/icons-vue";
+  import {
+    onMounted,
+    ref,
+    reactive,
+    toRefs,
+    getCurrentInstance,
+    nextTick,
+  } from "vue";
+  import InspectionFormDia from "@/views/qualityManagement/finalInspection/components/inspectionFormDia.vue";
+  import FormDia from "@/views/qualityManagement/finalInspection/components/formDia.vue";
+  import { ElMessageBox } from "element-plus";
+  import {
+    downloadQualityInspect,
+    qualityInspectDel,
+    qualityInspectDetail,
+    qualityInspectListPage,
+    qualityInspectUpdate,
+    submitQualityInspect,
+    qualityInspectExportNew,
+  } from "@/api/qualityManagement/rawMaterialInspection.js";
+  import {
+    qualityInspectDetailByProductId,
+    getQualityTestStandardParamByTestStandardId,
+  } from "@/api/qualityManagement/metricMaintenance.js";
+  import FilesDia from "@/views/qualityManagement/finalInspection/components/filesDia.vue";
+  import dayjs from "dayjs";
+  import { userListNoPage } from "@/api/system/user.js";
+  import useUserStore from "@/store/modules/user";
 
-const data = reactive({
-  searchForm: {
-    productName: "",
-    entryDate: undefined, // 褰曞叆鏃ユ湡
-    entryDateStart: undefined,
-    entryDateEnd: undefined,
-  },
-	rules: {
-		checkName: [{required: true, message: "璇烽�夋嫨", trigger: "change"}],
-	},
-});
-const { searchForm } = toRefs(data);
-const tableColumn = ref([
-  {
-    label: "妫�娴嬫棩鏈�",
-    prop: "checkTime",
-    width: 120
-  },
-  {
-    label: "鐢熶骇宸ュ崟鍙�",
-    prop: "workOrderNo",
-    width: 120
-  },
-  {
-    label: "妫�楠屽憳",
-    prop: "checkName",
-  },
-  {
-    label: "浜у搧鍚嶇О",
-    prop: "productName",
-  },
-  {
-    label: "瑙勬牸鍨嬪彿",
-    prop: "model",
-  },
-  {
-    label: "鍗曚綅",
-    prop: "unit",
-  },
-  {
-    label: "鏁伴噺",
-    prop: "quantity",
-    width: 100
-  },
-  {
-    label: "妫�娴嬪崟浣�",
-    prop: "checkCompany",
-    width: 120
-  },
-  {
-    label: "妫�娴嬬粨鏋�",
-    prop: "checkResult",
-    dataType: "tag",
-    formatType: (params) => {
-      if (params == '涓嶅悎鏍�') {
-        return "danger";
-      } else if (params == '鍚堟牸') {
-        return "success";
-      } else {
-        return null;
-      }
+  const data = reactive({
+    searchForm: {
+      process: "",
+      productName: "",
+      entryDate: undefined, // 褰曞叆鏃ユ湡
+      entryDateStart: undefined,
+      entryDateEnd: undefined,
     },
-  },
-	{
-		label: "鎻愪氦鐘舵��",
-		prop: "inspectState",
-		formatData: (params) => {
-			if (params) {
-				return "宸叉彁浜�";
-			} else {
-				return "鏈彁浜�";
-			}
-		},
-	},
-  {
-    dataType: "action",
-    label: "鎿嶄綔",
-    align: "center",
-    fixed: "right",
-    width: 280,
-    operation: [
-      {
-        name: "妫�楠�",
-        type: "text",
-        clickFun: (row) => {
-          openQuickCheck(row);
-        },
-				disabled: (row) => {
-					// 宸叉彁浜ゅ垯绂佺敤
-					if (row.inspectState == 1) return true;
-					// 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳界紪杈�
-					if (row.checkName) {
-						return row.checkName !== userStore.nickName;
-					}
-					return false;
-				}
+    rules: {
+      checkName: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+    },
+  });
+  const { searchForm } = toRefs(data);
+  const tableColumn = ref([
+    {
+      label: "妫�娴嬫棩鏈�",
+      prop: "checkTime",
+      width: 120,
+    },
+    {
+      label: "鐢熶骇宸ュ崟鍙�",
+      prop: "workOrderNo",
+      width: 120,
+    },
+    {
+      label: "宸ュ簭",
+      prop: "process",
+      width: 230,
+    },
+    {
+      label: "妫�楠屽憳",
+      prop: "checkName",
+    },
+    {
+      label: "浜у搧鍚嶇О",
+      prop: "productName",
+    },
+    {
+      label: "瑙勬牸鍨嬪彿",
+      prop: "model",
+    },
+    {
+      label: "鍗曚綅",
+      prop: "unit",
+    },
+    {
+      label: "鏁伴噺",
+      prop: "quantity",
+      width: 100,
+    },
+    {
+      label: "妫�娴嬪崟浣�",
+      prop: "checkCompany",
+      width: 120,
+    },
+    {
+      label: "妫�娴嬬粨鏋�",
+      prop: "checkResult",
+      dataType: "tag",
+      formatType: params => {
+        if (params == "涓嶅悎鏍�") {
+          return "danger";
+        } else if (params == "鍚堟牸") {
+          return "success";
+        } else {
+          return null;
+        }
       },
-      {
-        name: "闄勪欢",
-        type: "text",
-        clickFun: (row) => {
-          openFilesFormDia(row);
-        },
+    },
+    {
+      label: "鎻愪氦鐘舵��",
+      prop: "inspectState",
+      formatData: params => {
+        if (params) {
+          return "宸叉彁浜�";
+        } else {
+          return "鏈彁浜�";
+        }
       },
-				{
-					name: "鎻愪氦",
-					type: "text",
-					clickFun: (row) => {
-						submit(row.id);
-					},
-					disabled: (row) => {
-						// 宸叉彁浜ゅ垯绂佺敤
-						if (row.inspectState == 1) return true;
-						// 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳芥彁浜�
-						if (row.checkName) {
-							return row.checkName !== userStore.nickName;
-						}
-						return false;
-					}
-				},
-				{
-					name: "鍒嗛厤妫�楠屽憳",
-					type: "text",
-					clickFun: (row) => {
-						if (!row.checkName) {
-							open(row)
-						} else {
-							proxy.$modal.msgError("妫�楠屽憳宸插瓨鍦�");
-						}
-					},
-					disabled: (row) => {
-						return row.inspectState == 1 || row.checkName;
-					}
-				},
-				{
-					name: "涓嬭浇",
-					type: "text",
-					clickFun: (row) => {
-						downLoadFile(row);
-					},
-				},
-    ],
-  },
-]);
-const tableData = ref([]);
-const selectedRows = ref([]);
-const tableLoading = ref(false);
-const currentRow = ref(null)
-const page = reactive({
-  current: 1,
-  size: 100,
-  total: 0
-});
-const formDia = ref()
-const filesDia = ref()
-const inspectionFormDia = ref()
-const { proxy } = getCurrentInstance()
-const userStore = useUserStore()
-const userList = ref([]);
-const form = ref({
-	checkName: ""
-});
-const dialogFormVisible = ref(false);
-const quickCheckVisible = ref(false);
-const quickCheckForm = ref({
-	checkResult: "鍚堟牸",
-	checkName: "",
-	checkTime: "",
-	testStandardId: "",
-	checkCompany: ""
-});
-const quickCheckRef = ref(null);
-const testStandardOptions = ref([]); // 鎸囨爣閫夋嫨涓嬫媺妗嗘暟鎹�
-const quickCheckTableColumn = ref([
-  {
-    label: "鎸囨爣",
-    prop: "parameterItem",
-  },
-  {
-    label: "鍗曚綅",
-    prop: "unit",
-  },
-  {
-    label: "鏍囧噯鍊�",
-    prop: "standardValue",
-  },
-  {
-    label: "鍐呮帶鍊�",
-    prop: "controlValue",
-  },
-  {
-    label: "妫�楠屽��",
-    prop: "testValue",
-    dataType: 'slot',
-    slot: 'slot',
-  },
-]);
-const quickCheckTableData = ref([]);
-const quickCheckTableLoading = ref(false);
+    },
+    {
+      dataType: "action",
+      label: "鎿嶄綔",
+      align: "center",
+      fixed: "right",
+      width: 280,
+      operation: [
+        {
+          name: "妫�楠�",
+          type: "text",
+          clickFun: row => {
+            openQuickCheck(row);
+          },
+          disabled: row => {
+            // 宸叉彁浜ゅ垯绂佺敤
+            if (row.inspectState == 1) return true;
+            // 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳界紪杈�
+            if (row.checkName) {
+              return row.checkName !== userStore.nickName;
+            }
+            return false;
+          },
+        },
+        {
+          name: "闄勪欢",
+          type: "text",
+          clickFun: row => {
+            openFilesFormDia(row);
+          },
+        },
+        {
+          name: "鎻愪氦",
+          type: "text",
+          clickFun: row => {
+            submit(row.id);
+          },
+          disabled: row => {
+            // 宸叉彁浜ゅ垯绂佺敤
+            if (row.inspectState == 1) return true;
+            // 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳芥彁浜�
+            if (row.checkName) {
+              return row.checkName !== userStore.nickName;
+            }
+            return false;
+          },
+        },
+        {
+          name: "鍒嗛厤妫�楠屽憳",
+          type: "text",
+          clickFun: row => {
+            if (!row.checkName) {
+              open(row);
+            } else {
+              proxy.$modal.msgError("妫�楠屽憳宸插瓨鍦�");
+            }
+          },
+          disabled: row => {
+            return row.inspectState == 1 || row.checkName;
+          },
+        },
+        {
+          name: "涓嬭浇",
+          type: "text",
+          clickFun: row => {
+            downLoadFile(row);
+          },
+        },
+      ],
+    },
+  ]);
+  const tableData = ref([]);
+  const selectedRows = ref([]);
+  const tableLoading = ref(false);
+  const currentRow = ref(null);
+  const page = reactive({
+    current: 1,
+    size: 100,
+    total: 0,
+  });
+  const formDia = ref();
+  const filesDia = ref();
+  const inspectionFormDia = ref();
+  const { proxy } = getCurrentInstance();
+  const userStore = useUserStore();
+  const userList = ref([]);
+  const form = ref({
+    checkName: "",
+  });
+  const dialogFormVisible = ref(false);
+  const quickCheckVisible = ref(false);
+  const quickCheckForm = ref({
+    checkResult: "鍚堟牸",
+    checkName: "",
+    checkTime: "",
+    testStandardId: "",
+    checkCompany: "",
+  });
+  const quickCheckRef = ref(null);
+  const testStandardOptions = ref([]); // 鎸囨爣閫夋嫨涓嬫媺妗嗘暟鎹�
+  const quickCheckTableColumn = ref([
+    {
+      label: "鎸囨爣",
+      prop: "parameterItem",
+    },
+    {
+      label: "鍗曚綅",
+      prop: "unit",
+    },
+    {
+      label: "鏍囧噯鍊�",
+      prop: "standardValue",
+    },
+    {
+      label: "鍐呮帶鍊�",
+      prop: "controlValue",
+    },
+    {
+      label: "妫�楠屽��",
+      prop: "testValue",
+      dataType: "slot",
+      slot: "slot",
+    },
+  ]);
+  const quickCheckTableData = ref([]);
+  const quickCheckTableLoading = ref(false);
 
-const changeDaterange = (value) => {
-  searchForm.value.entryDateStart = undefined;
-  searchForm.value.entryDateEnd = undefined;
-  if (value) {
-    searchForm.value.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD");
-    searchForm.value.entryDateEnd = dayjs(value[1]).format("YYYY-MM-DD");
-  }
-  getList();
-};
-// 鏌ヨ鍒楄〃
-/** 鎼滅储鎸夐挳鎿嶄綔 */
-const handleQuery = () => {
-  page.current = 1;
-  getList();
-};
-const pagination = (obj) => {
-  page.current = obj.page;
-  page.size = obj.limit;
-  getList();
-};
-const getList = () => {
-  tableLoading.value = true;
-  const params = { ...searchForm.value, ...page };
-  params.entryDate = undefined
-  qualityInspectListPage({...params, inspectType: 2}).then(res => {
-    tableLoading.value = false;
-    tableData.value = res.data.records
-    page.total = res.data.total;
-  }).catch(err => {
-    tableLoading.value = false;
-  })
-};
-// 琛ㄦ牸閫夋嫨鏁版嵁
-const handleSelectionChange = (selection) => {
-  selectedRows.value = selection;
-};
+  const changeDaterange = value => {
+    searchForm.value.entryDateStart = undefined;
+    searchForm.value.entryDateEnd = undefined;
+    if (value) {
+      searchForm.value.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD");
+      searchForm.value.entryDateEnd = dayjs(value[1]).format("YYYY-MM-DD");
+    }
+    getList();
+  };
+  // 鏌ヨ鍒楄〃
+  /** 鎼滅储鎸夐挳鎿嶄綔 */
+  const handleQuery = () => {
+    page.current = 1;
+    getList();
+  };
+  const pagination = obj => {
+    page.current = obj.page;
+    page.size = obj.limit;
+    getList();
+  };
+  const getList = () => {
+    tableLoading.value = true;
+    const params = { ...searchForm.value, ...page };
+    params.entryDate = undefined;
+    qualityInspectListPage({ ...params, inspectType: 2 })
+      .then(res => {
+        tableLoading.value = false;
+        tableData.value = res.data.records;
+        page.total = res.data.total;
+      })
+      .catch(err => {
+        tableLoading.value = false;
+      });
+  };
+  // 琛ㄦ牸閫夋嫨鏁版嵁
+  const handleSelectionChange = selection => {
+    selectedRows.value = selection;
+  };
 
-// 鎵撳紑寮规
-const openForm = (type, row) => {
-  nextTick(() => {
-    formDia.value?.openDialog(type, row)
-  })
-};
-// 鎵撳紑鏂板妫�楠屽脊妗�
-const openInspectionForm = (type, row) => {
-  nextTick(() => {
-    inspectionFormDia.value?.openDialog(type, row)
-  })
-};
-// 鎵撳紑闄勪欢寮规
-const openFilesFormDia = (type, row) => {
-  nextTick(() => {
-    filesDia.value?.openDialog(type, row)
-  })
-};
+  // 鎵撳紑寮规
+  const openForm = (type, row) => {
+    nextTick(() => {
+      formDia.value?.openDialog(type, row);
+    });
+  };
+  // 鎵撳紑鏂板妫�楠屽脊妗�
+  const openInspectionForm = (type, row) => {
+    nextTick(() => {
+      inspectionFormDia.value?.openDialog(type, row);
+    });
+  };
+  // 鎵撳紑闄勪欢寮规
+  const openFilesFormDia = (type, row) => {
+    nextTick(() => {
+      filesDia.value?.openDialog(type, row);
+    });
+  };
 
-// 鍒犻櫎
-const handleDelete = () => {
-  let ids = [];
-  if (selectedRows.value.length > 0) {
-    ids = selectedRows.value.map((item) => item.id);
-  } else {
-    proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
-    return;
-  }
-  ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", {
-    confirmButtonText: "纭",
-    cancelButtonText: "鍙栨秷",
-    type: "warning",
-  })
+  // 鍒犻櫎
+  const handleDelete = () => {
+    let ids = [];
+    if (selectedRows.value.length > 0) {
+      ids = selectedRows.value.map(item => item.id);
+    } else {
+      proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+      return;
+    }
+    ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", {
+      confirmButtonText: "纭",
+      cancelButtonText: "鍙栨秷",
+      type: "warning",
+    })
       .then(() => {
-        qualityInspectDel(ids).then((res) => {
+        qualityInspectDel(ids).then(res => {
           proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
           getList();
         });
@@ -441,258 +502,276 @@
       .catch(() => {
         proxy.$modal.msg("宸插彇娑�");
       });
-};
-// 瀵煎嚭
-const handleOut = () => {
-	// 鍒ゆ柇鏄惁鏈夐�変腑鏁版嵁
-	const hasSelected = selectedRows.value.length > 0;
+  };
+  // 瀵煎嚭
+  const handleOut = () => {
+    // 鍒ゆ柇鏄惁鏈夐�変腑鏁版嵁
+    const hasSelected = selectedRows.value.length > 0;
 
-	const confirmMsg = hasSelected
-		? "閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�"
-		: "灏嗗鍑哄叏閮ㄦ暟鎹紝鏄惁纭瀵煎嚭锛�";
+    const confirmMsg = hasSelected
+      ? "閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�"
+      : "灏嗗鍑哄叏閮ㄦ暟鎹紝鏄惁纭瀵煎嚭锛�";
 
-	ElMessageBox.confirm(confirmMsg, "瀵煎嚭", {
-		confirmButtonText: "纭",
-		cancelButtonText: "鍙栨秷",
-		type: "warning",
-	})
-		.then(() => {
-			// 鏋勫缓瀵煎嚭鍙傛暟
-			const exportData = {
-				inspectType: 2,
-				productName: searchForm.value.productName || "",
-				entryDateStart: searchForm.value.entryDateStart || "",
-				entryDateEnd: searchForm.value.entryDateEnd || "",
-			};
+    ElMessageBox.confirm(confirmMsg, "瀵煎嚭", {
+      confirmButtonText: "纭",
+      cancelButtonText: "鍙栨秷",
+      type: "warning",
+    })
+      .then(() => {
+        // 鏋勫缓瀵煎嚭鍙傛暟
+        const exportData = {
+          inspectType: 2,
+          process: searchForm.value.process || "",
+          productName: searchForm.value.productName || "",
+          entryDateStart: searchForm.value.entryDateStart || "",
+          entryDateEnd: searchForm.value.entryDateEnd || "",
+        };
 
-			// 濡傛灉鏈夐�変腑鏁版嵁锛屾坊鍔爄ds
-			if (hasSelected) {
-				exportData.ids = selectedRows.value.map(item => item.id);
-			}
+        // 濡傛灉鏈夐�変腑鏁版嵁锛屾坊鍔爄ds
+        if (hasSelected) {
+          exportData.ids = selectedRows.value.map(item => item.id);
+        }
 
-			// 璋冪敤鏂板鍑烘帴鍙�
-			qualityInspectExportNew(exportData).then((blobData) => {
-				const blob = new Blob([blobData], {
-					type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
-				});
-				const downloadUrl = window.URL.createObjectURL(blob);
-				const link = document.createElement('a');
-				link.href = downloadUrl;
-				link.download = '鍑哄巶妫�楠�.xlsx';
-				document.body.appendChild(link);
-				link.click();
-				document.body.removeChild(link);
-				window.URL.revokeObjectURL(downloadUrl);
-			}).catch((error) => {
-				proxy.$modal.msgError("瀵煎嚭澶辫触");
-			});
-		})
-		.catch(() => {
-			proxy.$modal.msg("宸插彇娑�");
-		});
-};
+        // 璋冪敤鏂板鍑烘帴鍙�
+        qualityInspectExportNew(exportData)
+          .then(blobData => {
+            const blob = new Blob([blobData], {
+              type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
+            });
+            const downloadUrl = window.URL.createObjectURL(blob);
+            const link = document.createElement("a");
+            link.href = downloadUrl;
+            link.download = "鍑哄巶妫�楠�.xlsx";
+            document.body.appendChild(link);
+            link.click();
+            document.body.removeChild(link);
+            window.URL.revokeObjectURL(downloadUrl);
+          })
+          .catch(error => {
+            proxy.$modal.msgError("瀵煎嚭澶辫触");
+          });
+      })
+      .catch(() => {
+        proxy.$modal.msg("宸插彇娑�");
+      });
+  };
 
-// 鎻愪环
-const submit = async (id) => {
-	const res = await submitQualityInspect({id: id})
-	if (res.code === 200) {
-		proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
-		getList();
-	}
-}
+  // 鎻愪环
+  const submit = async id => {
+    const res = await submitQualityInspect({ id: id });
+    if (res.code === 200) {
+      proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+      getList();
+    }
+  };
 
-// 鍏抽棴寮规
-const closeDia = () => {
-	proxy.resetForm("formRef");
-	dialogFormVisible.value = false;
-};
+  // 鍏抽棴寮规
+  const closeDia = () => {
+    proxy.resetForm("formRef");
+    dialogFormVisible.value = false;
+  };
 
-const submitForm = () => {
-	if (currentRow.value) {
-		const data = {
-			...form.value,
-			id: currentRow.value.id
-		}
-		qualityInspectUpdate(data).then(res => {
-			proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
-			closeDia();
-			getList();
-		})
-	}
-};
+  const submitForm = () => {
+    if (currentRow.value) {
+      const data = {
+        ...form.value,
+        id: currentRow.value.id,
+      };
+      qualityInspectUpdate(data).then(res => {
+        proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+        closeDia();
+        getList();
+      });
+    }
+  };
 
-const open = async (row) => {
-	let userLists = await userListNoPage();
-	// 绛涢�� roleIds 鍖呭惈 106 鐨勭敤鎴�
-	userList.value = (userLists.data || []).filter(user => {
-		const roleIds = user.roleIds || [];
-		return roleIds.includes(106) || roleIds.includes('106');
-	});
-	currentRow.value = row
-	dialogFormVisible.value = true
-}
+  const open = async row => {
+    let userLists = await userListNoPage();
+    // 绛涢�� roleIds 鍖呭惈 106 鐨勭敤鎴�
+    userList.value = (userLists.data || []).filter(user => {
+      const roleIds = user.roleIds || [];
+      return roleIds.includes(106) || roleIds.includes("106");
+    });
+    currentRow.value = row;
+    dialogFormVisible.value = true;
+  };
 
-const downLoadFile = (row) => {
-	downloadQualityInspect({ id: row.id }).then((blobData) => {
-		const blob = new Blob([blobData], {
-			type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
-		})
-		const downloadUrl = window.URL.createObjectURL(blob)
+  const downLoadFile = row => {
+    downloadQualityInspect({ id: row.id }).then(blobData => {
+      const blob = new Blob([blobData], {
+        type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+      });
+      const downloadUrl = window.URL.createObjectURL(blob);
 
-		const link = document.createElement('a')
-		link.href = downloadUrl
-		link.download = '鍑哄巶妫�楠屾姤鍛�.docx'
-		document.body.appendChild(link)
-		link.click()
+      const link = document.createElement("a");
+      link.href = downloadUrl;
+      link.download = "鍑哄巶妫�楠屾姤鍛�.docx";
+      document.body.appendChild(link);
+      link.click();
 
-		document.body.removeChild(link)
-		window.URL.revokeObjectURL(downloadUrl)
-	})
-};
+      document.body.removeChild(link);
+      window.URL.revokeObjectURL(downloadUrl);
+    });
+  };
 
-// 鎵撳紑妫�楠岀粨鏋滈�夋嫨瀵硅瘽妗�
-const openQuickCheck = async (row) => {
-	// 鍏堣皟鐢ㄨ鎯呮帴鍙h幏鍙栧畬鏁存暟鎹紙鍖呭惈鎸囨爣鍜屾楠屽�硷級
-	let detailData = row;
-	try {
-		const detailRes = await qualityInspectDetail(row.id);
-		if (detailRes.code === 200 && detailRes.data) {
-			detailData = detailRes.data;
-		}
-	} catch (e) {
-		console.error("鑾峰彇妫�楠岃鎯呭け璐�", e);
-	}
-	currentRow.value = detailData;
+  // 鎵撳紑妫�楠岀粨鏋滈�夋嫨瀵硅瘽妗�
+  const openQuickCheck = async row => {
+    // 鍏堣皟鐢ㄨ鎯呮帴鍙h幏鍙栧畬鏁存暟鎹紙鍖呭惈鎸囨爣鍜屾楠屽�硷級
+    let detailData = row;
+    try {
+      const detailRes = await qualityInspectDetail(row.id);
+      if (detailRes.code === 200 && detailRes.data) {
+        detailData = detailRes.data;
+      }
+    } catch (e) {
+      console.error("鑾峰彇妫�楠岃鎯呭け璐�", e);
+    }
+    currentRow.value = detailData;
 
-	// 鍔犺浇鐢ㄦ埛鍒楄〃锛岀瓫閫� roleIds 鍖呭惈 106 鐨勭敤鎴�
-	try {
-		const userLists = await userListNoPage();
-		userList.value = (userLists.data || []).filter(user => {
-			const roleIds = user.roleIds || [];
-			return roleIds.includes(106) || roleIds.includes('106');
-		});
-	} catch (e) {
-		console.error("鍔犺浇妫�楠屽憳鍒楄〃澶辫触", e);
-		userList.value = [];
-	}
-	// 鍔犺浇鎸囨爣閫夐」锛堟牴鎹骇鍝両D锛�
-	if (detailData.productId) {
-		try {
-			const params = {
-				productId: detailData.productId,
-				inspectType: 2
-			};
-			const res = await qualityInspectDetailByProductId(params);
-			testStandardOptions.value = res.data || [];
-		} catch (e) {
-			console.error("鍔犺浇鎸囨爣閫夐」澶辫触", e);
-			testStandardOptions.value = [];
-		}
-	} else {
-		testStandardOptions.value = [];
-	}
-	// 璁剧疆榛樿鍊硷紙浼樺厛浣跨敤璇︽儏鏁版嵁锛屾楠屽憳榛樿涓哄綋鍓嶇櫥褰曠敤鎴凤級
-	quickCheckForm.value = {
-		checkResult: detailData.checkResult || "鍚堟牸",
-		checkName: detailData.checkName || userStore.nickName || "",
-		checkTime: detailData.checkTime || dayjs().format("YYYY-MM-DD"),
-		testStandardId: detailData.testStandardId || "",
-		checkCompany: detailData.checkCompany || ""
-	};
-	// 濡傛灉鏈夋楠屽弬鏁版暟鎹紝鍥炴樉鍒拌〃鏍�
-	if (detailData.qualityInspectParams && detailData.qualityInspectParams.length > 0) {
-		quickCheckTableData.value = detailData.qualityInspectParams;
-	} else {
-		quickCheckTableData.value = [];
-	}
-	quickCheckVisible.value = true;
-};
+    // 鍔犺浇鐢ㄦ埛鍒楄〃锛岀瓫閫� roleIds 鍖呭惈 106 鐨勭敤鎴�
+    try {
+      const userLists = await userListNoPage();
+      userList.value = (userLists.data || []).filter(user => {
+        const roleIds = user.roleIds || [];
+        return roleIds.includes(106) || roleIds.includes("106");
+      });
+    } catch (e) {
+      console.error("鍔犺浇妫�楠屽憳鍒楄〃澶辫触", e);
+      userList.value = [];
+    }
+    // 鍔犺浇鎸囨爣閫夐」锛堟牴鎹骇鍝両D锛�
+    if (detailData.productId) {
+      try {
+        const params = {
+          productId: detailData.productId,
+          inspectType: 2,
+          process: detailData.process || "",
+        };
+        const res = await qualityInspectDetailByProductId(params);
+        testStandardOptions.value = res.data || [];
+      } catch (e) {
+        console.error("鍔犺浇鎸囨爣閫夐」澶辫触", e);
+        testStandardOptions.value = [];
+      }
+    } else {
+      testStandardOptions.value = [];
+    }
+    // 璁剧疆榛樿鍊硷紙浼樺厛浣跨敤璇︽儏鏁版嵁锛屾楠屽憳榛樿涓哄綋鍓嶇櫥褰曠敤鎴凤級
+    quickCheckForm.value = {
+      checkResult: detailData.checkResult || "鍚堟牸",
+      checkName: detailData.checkName || userStore.nickName || "",
+      checkTime: detailData.checkTime || dayjs().format("YYYY-MM-DD"),
+      testStandardId: detailData.testStandardId || "",
+      checkCompany: detailData.checkCompany || "",
+    };
+    // 濡傛灉鏈夋楠屽弬鏁版暟鎹紝鍥炴樉鍒拌〃鏍�
+    if (
+      detailData.qualityInspectParams &&
+      detailData.qualityInspectParams.length > 0
+    ) {
+      quickCheckTableData.value = detailData.qualityInspectParams;
+    } else {
+      quickCheckTableData.value = [];
+    }
+    quickCheckVisible.value = true;
+  };
 
-// 鎸囨爣閫夋嫨鍙樺寲澶勭悊
-const handleTestStandardChange = (testStandardId) => {
-  if (!testStandardId) {
+  // 鎸囨爣閫夋嫨鍙樺寲澶勭悊
+  const handleTestStandardChange = testStandardId => {
+    if (!testStandardId) {
+      quickCheckTableData.value = [];
+      return;
+    }
+    quickCheckTableLoading.value = true;
+    getQualityTestStandardParamByTestStandardId(testStandardId)
+      .then(res => {
+        quickCheckTableData.value = res.data || [];
+      })
+      .catch(error => {
+        console.error("鑾峰彇鏍囧噯鍙傛暟澶辫触:", error);
+        quickCheckTableData.value = [];
+      })
+      .finally(() => {
+        quickCheckTableLoading.value = false;
+      });
+  };
+
+  // 鍏抽棴妫�楠岀粨鏋滈�夋嫨瀵硅瘽妗�
+  const closeQuickCheck = () => {
+    quickCheckVisible.value = false;
+    quickCheckForm.value = {
+      checkResult: "鍚堟牸",
+      checkName: "",
+      checkTime: "",
+      testStandardId: "",
+      checkCompany: "",
+    };
     quickCheckTableData.value = [];
-    return;
-  }
-  quickCheckTableLoading.value = true;
-  getQualityTestStandardParamByTestStandardId(testStandardId).then(res => {
-    quickCheckTableData.value = res.data || [];
-  }).catch(error => {
-    console.error('鑾峰彇鏍囧噯鍙傛暟澶辫触:', error);
-    quickCheckTableData.value = [];
-  }).finally(() => {
-    quickCheckTableLoading.value = false;
+    testStandardOptions.value = [];
+  };
+
+  // 纭妫�楠岀粨鏋�
+  const handleQuickCheckConfirm = () => {
+    if (!quickCheckForm.value.checkResult) {
+      proxy.$modal.msgWarning("璇烽�夋嫨妫�娴嬬粨鏋�");
+      return;
+    }
+    if (!quickCheckForm.value.checkName) {
+      proxy.$modal.msgWarning("璇烽�夋嫨妫�楠屽憳");
+      return;
+    }
+    if (!quickCheckForm.value.checkTime) {
+      proxy.$modal.msgWarning("璇烽�夋嫨妫�娴嬫棩鏈�");
+      return;
+    }
+
+    const checkNameToPass = quickCheckForm.value.checkName;
+    const checkResultToPass = quickCheckForm.value.checkResult;
+    const checkTimeToPass = quickCheckForm.value.checkTime;
+    const testStandardIdToPass = quickCheckForm.value.testStandardId;
+    const checkCompanyToPass = quickCheckForm.value.checkCompany;
+    const qualityInspectParamsToPass = [...quickCheckTableData.value];
+
+    if (quickCheckForm.value.checkResult === "鍚堟牸") {
+      // 鍚堟牸锛氱洿鎺ユ彁浜�
+      const data = {
+        id: currentRow.value.id,
+        checkResult: "鍚堟牸",
+        checkName: checkNameToPass,
+        checkTime: checkTimeToPass,
+        testStandardId: testStandardIdToPass,
+        checkCompany: checkCompanyToPass,
+        inspectType: 2,
+        qualityInspectParams: qualityInspectParamsToPass,
+      };
+      qualityInspectUpdate(data).then(res => {
+        proxy.$modal.msgSuccess("妫�楠屾垚鍔�");
+        closeQuickCheck();
+        getList();
+      });
+    } else {
+      // 涓嶅悎鏍硷細鎵撳紑璇︾粏濉啓椤甸潰
+      closeQuickCheck();
+      nextTick(() => {
+        currentRow.value.checkTime = checkTimeToPass;
+        currentRow.value.checkCompany = checkCompanyToPass;
+        currentRow.value.testStandardId = testStandardIdToPass;
+        formDia.value?.openDialog(
+          "edit",
+          currentRow.value,
+          checkResultToPass,
+          checkNameToPass,
+          testStandardIdToPass,
+          checkCompanyToPass,
+          qualityInspectParamsToPass
+        );
+      });
+    }
+  };
+
+  onMounted(() => {
+    getList();
   });
-};
-
-// 鍏抽棴妫�楠岀粨鏋滈�夋嫨瀵硅瘽妗�
-const closeQuickCheck = () => {
-	quickCheckVisible.value = false;
-	quickCheckForm.value = {
-		checkResult: "鍚堟牸",
-		checkName: "",
-		checkTime: "",
-		testStandardId: "",
-		checkCompany: ""
-	};
-	quickCheckTableData.value = [];
-	testStandardOptions.value = [];
-};
-
-// 纭妫�楠岀粨鏋�
-const handleQuickCheckConfirm = () => {
-	if (!quickCheckForm.value.checkResult) {
-		proxy.$modal.msgWarning("璇烽�夋嫨妫�娴嬬粨鏋�");
-		return;
-	}
-	if (!quickCheckForm.value.checkName) {
-		proxy.$modal.msgWarning("璇烽�夋嫨妫�楠屽憳");
-		return;
-	}
-	if (!quickCheckForm.value.checkTime) {
-		proxy.$modal.msgWarning("璇烽�夋嫨妫�娴嬫棩鏈�");
-		return;
-	}
-
-	const checkNameToPass = quickCheckForm.value.checkName;
-	const checkResultToPass = quickCheckForm.value.checkResult;
-	const checkTimeToPass = quickCheckForm.value.checkTime;
-	const testStandardIdToPass = quickCheckForm.value.testStandardId;
-	const checkCompanyToPass = quickCheckForm.value.checkCompany;
-	const qualityInspectParamsToPass = [...quickCheckTableData.value];
-
-	if (quickCheckForm.value.checkResult === "鍚堟牸") {
-		// 鍚堟牸锛氱洿鎺ユ彁浜�
-		const data = {
-			id: currentRow.value.id,
-			checkResult: "鍚堟牸",
-			checkName: checkNameToPass,
-			checkTime: checkTimeToPass,
-			testStandardId: testStandardIdToPass,
-			checkCompany: checkCompanyToPass,
-			inspectType: 2,
-			qualityInspectParams: qualityInspectParamsToPass
-		};
-		qualityInspectUpdate(data).then(res => {
-			proxy.$modal.msgSuccess("妫�楠屾垚鍔�");
-			closeQuickCheck();
-			getList();
-		});
-	} else {
-		// 涓嶅悎鏍硷細鎵撳紑璇︾粏濉啓椤甸潰
-		closeQuickCheck();
-		nextTick(() => {
-			currentRow.value.checkTime = checkTimeToPass;
-			currentRow.value.checkCompany = checkCompanyToPass;
-			currentRow.value.testStandardId = testStandardIdToPass;
-			formDia.value?.openDialog("edit", currentRow.value, checkResultToPass, checkNameToPass, testStandardIdToPass, checkCompanyToPass, qualityInspectParamsToPass);
-		});
-	}
-};
-
-onMounted(() => {
-  getList();
-});
 </script>
 
 <style scoped></style>
diff --git a/src/views/qualityManagement/metricBinding/index.vue b/src/views/qualityManagement/metricBinding/index.vue
index 0509961..c207349 100644
--- a/src/views/qualityManagement/metricBinding/index.vue
+++ b/src/views/qualityManagement/metricBinding/index.vue
@@ -1,138 +1,205 @@
 <template>
   <div class="app-container metric-binding">
-    <el-tabs v-model="activeTab" @tab-change="handleTabChange" class="metric-tabs">
-      <el-tab-pane label="鍘熸潗鏂欐楠�" name="0" />
-      <el-tab-pane label="杩囩▼妫�楠�" name="1" />
-      <el-tab-pane label="鍑哄巶妫�楠�" name="2" />
+    <el-tabs v-model="activeTab"
+             @tab-change="handleTabChange"
+             class="metric-tabs">
+      <el-tab-pane label="鍘熸潗鏂欐楠�"
+                   name="0" />
+      <el-tab-pane label="杩囩▼妫�楠�"
+                   name="1" />
+      <el-tab-pane label="鍑哄巶妫�楠�"
+                   name="2" />
     </el-tabs>
-    <el-row :gutter="16" class="metric-binding-row">
+    <el-row :gutter="16"
+            class="metric-binding-row">
       <!-- 宸︿晶锛氭娴嬫爣鍑嗗垪琛� -->
-      <el-col :xs="24" :sm="24" :md="12" :lg="14" :xl="14" class="left-col">
+      <el-col :xs="24"
+              :sm="24"
+              :md="12"
+              :lg="14"
+              :xl="14"
+              class="left-col">
         <div class="panel left-panel">
-      <PIMTable
-        rowKey="id"
-        :column="standardColumns"
-        :tableData="standardTableData"
-        :page="page"
-        :isSelection="false"
-        :rowClassName="rowClassNameCenter"
-        :tableLoading="tableLoading"
-        :rowClick="handleTableRowClick"
-        @pagination="handlePagination"
-        :total="page.total"
-      >
-        <template #standardNoCell="{ row }">
-          <span class="clickable-link" @click="handleStandardRowClick(row)">
-            {{ row.standardNo }}
-          </span>
-        </template>
-
-        <!-- 琛ㄥご鎼滅储 -->
-        <template #standardNoHeader>
-          <el-input
-            v-model="searchForm.standardNo"
-            placeholder="鏍囧噯缂栧彿"
-            clearable
-            size="small"
-            @change="handleQuery"
-            @clear="handleQuery"
-          />
-        </template>
-        <template #standardNameHeader>
-          <el-input
-            v-model="searchForm.standardName"
-            placeholder="鏍囧噯鍚嶇О"
-            clearable
-            size="small"
-            @change="handleQuery"
-            @clear="handleQuery"
-          />
-        </template>
-        <template #stateHeader>
-          <el-select
-            v-model="searchForm.state"
-            placeholder="鐘舵��"
-            clearable
-            size="small"
-            style="width: 110px"
-            @change="handleQuery"
-            @clear="handleQuery"
-          >
-            <el-option label="鑽夌" value="0" />
-            <el-option label="閫氳繃" value="1" />
-            <el-option label="鎾ら攢" value="2" />
-          </el-select>
-        </template>
-      </PIMTable>
+          <PIMTable rowKey="id"
+                    :column="standardColumns"
+                    :tableData="standardTableData"
+                    :page="page"
+                    :isSelection="false"
+                    :rowClassName="rowClassNameCenter"
+                    :tableLoading="tableLoading"
+                    :rowClick="handleTableRowClick"
+                    @pagination="handlePagination"
+                    :total="page.total">
+            <template #standardNoCell="{ row }">
+              <span class="clickable-link"
+                    @click="handleStandardRowClick(row)">
+                {{ row.standardNo }}
+              </span>
+            </template>
+            <!-- 琛ㄥご鎼滅储 -->
+            <template #standardNoHeader>
+              <el-input v-model="searchForm.standardNo"
+                        placeholder="鏍囧噯缂栧彿"
+                        clearable
+                        size="small"
+                        @change="handleQuery"
+                        @clear="handleQuery" />
+            </template>
+            <template #standardNameHeader>
+              <el-input v-model="searchForm.standardName"
+                        placeholder="鏍囧噯鍚嶇О"
+                        clearable
+                        size="small"
+                        @change="handleQuery"
+                        @clear="handleQuery" />
+            </template>
+            <template #stateHeader>
+              <el-select v-model="searchForm.state"
+                         placeholder="鐘舵��"
+                         clearable
+                         size="small"
+                         style="width: 110px"
+                         @change="handleQuery"
+                         @clear="handleQuery">
+                <el-option label="鑽夌"
+                           value="0" />
+                <el-option label="閫氳繃"
+                           value="1" />
+                <el-option label="鎾ら攢"
+                           value="2" />
+              </el-select>
+            </template>
+          </PIMTable>
         </div>
       </el-col>
-
       <!-- 鍙充晶锛氱粦瀹氬垪琛� -->
-      <el-col :xs="24" :sm="24" :md="12" :lg="10" :xl="10" class="right-col">
+      <el-col :xs="24"
+              :sm="24"
+              :md="12"
+              :lg="10"
+              :xl="10"
+              class="right-col">
         <div class="panel right-panel">
-      <div class="right-header">
-        <div class="title">缁戝畾鍏崇郴</div>
-        <div class="desc" v-if="currentStandard">
-          褰撳墠妫�娴嬫爣鍑嗙紪鍙凤細<span class="link-text">{{ currentStandard.standardNo }}</span>
-        </div>
-        <div class="desc" v-else>璇烽�夋嫨宸︿晶妫�娴嬫爣鍑�</div>
-      </div>
-
-      <div class="right-toolbar">
-        <el-button type="primary" :disabled="!currentStandard" @click="openBindingDialog">娣诲姞缁戝畾</el-button>
-        <el-button type="danger" plain :disabled="!currentStandard" @click="handleBatchUnbind">鍒犻櫎</el-button>
-      </div>
-
-      <el-table
-        v-loading="bindingLoading"
-        :data="bindingTableData"
-        border
-        :row-class-name="() => 'row-center'"
-        class="center-table"
-        style="width: 100%"
-        height="calc(100vh - 220px)"
-        @selection-change="handleBindingSelectionChange"
-      >
-        <el-table-column type="selection" width="48" align="center" />
-        <el-table-column type="index" label="搴忓彿" width="60" align="center" />
-        <el-table-column prop="productName" label="浜у搧鍚嶇О" min-width="140" />
-        <el-table-column label="鎿嶄綔" width="120" fixed="right" align="center">
-          <template #default="{ row }">
-            <el-button link type="danger" size="small" @click="handleUnbind(row)">鍒犻櫎</el-button>
-          </template>
-        </el-table-column>
-      </el-table>
+          <div class="right-header">
+            <div class="title">缁戝畾鍏崇郴</div>
+            <div class="desc"
+                 v-if="currentStandard">
+              褰撳墠妫�娴嬫爣鍑嗙紪鍙凤細<span class="link-text">{{ currentStandard.standardNo }}</span>
+            </div>
+            <div class="desc"
+                 v-else>璇烽�夋嫨宸︿晶妫�娴嬫爣鍑�</div>
+          </div>
+          <div class="right-toolbar">
+            <el-button type="primary"
+                       :disabled="!currentStandard"
+                       @click="openBindingDialog">娣诲姞缁戝畾</el-button>
+            <el-button v-if="activeTab === '1' || activeTab === '2'"
+                       type="primary"
+                       :disabled="!leftProcessOptions.length"
+                       @click="openProcessBindingDialog">鎸夊伐搴忔壒閲忕粦瀹�</el-button>
+            <el-button type="danger"
+                       plain
+                       :disabled="!currentStandard"
+                       @click="handleBatchUnbind">鍒犻櫎</el-button>
+          </div>
+          <el-table v-loading="bindingLoading"
+                    :data="bindingTableData"
+                    border
+                    :row-class-name="() => 'row-center'"
+                    class="center-table"
+                    style="width: 100%"
+                    height="calc(100vh - 220px)"
+                    @selection-change="handleBindingSelectionChange">
+            <el-table-column type="selection"
+                             width="48"
+                             align="center" />
+            <el-table-column type="index"
+                             label="搴忓彿"
+                             width="60"
+                             align="center" />
+            <el-table-column prop="productName"
+                             label="浜у搧鍚嶇О"
+                             min-width="140" />
+            <el-table-column label="鎿嶄綔"
+                             width="120"
+                             fixed="right"
+                             align="center">
+              <template #default="{ row }">
+                <el-button link
+                           type="danger"
+                           size="small"
+                           @click="handleUnbind(row)">鍒犻櫎</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
         </div>
       </el-col>
     </el-row>
-
     <!-- 娣诲姞缁戝畾寮规 -->
-    <el-dialog
-      v-model="bindingDialogVisible"
-      title="娣诲姞缁戝畾"
-      width="520px"
-      @close="closeBindingDialog"
-    >
+    <el-dialog v-model="bindingDialogVisible"
+               title="娣诲姞缁戝畾"
+               width="520px"
+               @close="closeBindingDialog">
       <el-form label-width="100px">
         <el-form-item label="浜у搧">
-          <el-tree-select
-            v-model="selectedProductIds"
-            multiple
-            collapse-tags
-            collapse-tags-tooltip
-            placeholder="璇烽�夋嫨浜у搧锛堝彲澶氶�夛級"
-            clearable
-            check-strictly
-            :data="productOptions"
-            :render-after-expand="false"
-            style="width: 100%"
-          />
+          <el-tree-select v-model="selectedProductIds"
+                          multiple
+                          collapse-tags
+                          collapse-tags-tooltip
+                          placeholder="璇烽�夋嫨浜у搧锛堝彲澶氶�夛級"
+                          clearable
+                          check-strictly
+                          :data="productOptions"
+                          :render-after-expand="false"
+                          style="width: 100%" />
         </el-form-item>
       </el-form>
       <template #footer>
         <span class="dialog-footer">
           <el-button @click="closeBindingDialog">鍙栨秷</el-button>
-          <el-button type="primary" @click="submitBinding">纭畾</el-button>
+          <el-button type="primary"
+                     @click="submitBinding">纭畾</el-button>
+        </span>
+      </template>
+    </el-dialog>
+    <el-dialog v-model="processBindingDialogVisible"
+               title="鎸夊伐搴忔壒閲忕粦瀹�"
+               width="520px"
+               @close="closeProcessBindingDialog">
+      <el-form label-width="100px">
+        <el-form-item label="浜у搧">
+          <el-tree-select v-model="processBindingProductIds"
+                          multiple
+                          collapse-tags
+                          collapse-tags-tooltip
+                          placeholder="璇烽�夋嫨浜у搧锛堝彲澶氶�夛級"
+                          clearable
+                          check-strictly
+                          :data="productOptions"
+                          :render-after-expand="false"
+                          style="width: 100%" />
+        </el-form-item>
+        <el-form-item label="宸ュ簭">
+          <el-select v-model="processBindingProcessIds"
+                     multiple
+                     filterable
+                     clearable
+                     collapse-tags
+                     collapse-tags-tooltip
+                     placeholder="璇烽�夋嫨宸ュ簭锛堝繀閫夛紝鍙閫夛級"
+                     style="width: 100%">
+            <el-option v-for="item in leftProcessOptions"
+                       :key="item.value"
+                       :label="item.label"
+                       :value="item.value" />
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <span class="dialog-footer">
+          <el-button @click="closeProcessBindingDialog">鍙栨秷</el-button>
+          <el-button type="primary"
+                     @click="submitProcessBinding">纭畾</el-button>
         </span>
       </template>
     </el-dialog>
@@ -140,410 +207,516 @@
 </template>
 
 <script setup>
-import { Search } from '@element-plus/icons-vue'
-import { ref, reactive, toRefs, onMounted, getCurrentInstance } from 'vue'
-import { ElMessageBox } from 'element-plus'
-import PIMTable from '@/components/PIMTable/PIMTable.vue'
-import { productTreeList } from '@/api/basicData/product.js'
-import {
-  qualityTestStandardListPage
-} from '@/api/qualityManagement/metricMaintenance.js'
-import { productProcessListPage } from '@/api/basicData/productProcess.js'
-import {
-  qualityTestStandardBindingList,
-  qualityTestStandardBindingAdd,
-  qualityTestStandardBindingDel
-} from '@/api/qualityManagement/qualityTestStandardBinding.js'
+  import { Search } from "@element-plus/icons-vue";
+  import {
+    ref,
+    reactive,
+    toRefs,
+    onMounted,
+    getCurrentInstance,
+    computed,
+  } from "vue";
+  import { ElMessageBox } from "element-plus";
+  import PIMTable from "@/components/PIMTable/PIMTable.vue";
+  import { productTreeList } from "@/api/basicData/product.js";
+  import { qualityTestStandardListPage } from "@/api/qualityManagement/metricMaintenance.js";
+  import { productProcessListPage } from "@/api/basicData/productProcess.js";
+  import {
+    qualityTestStandardBindingList,
+    qualityTestStandardBindingAdd,
+    qualityTestStandardBindingDel,
+  } from "@/api/qualityManagement/qualityTestStandardBinding.js";
 
-const { proxy } = getCurrentInstance()
+  const { proxy } = getCurrentInstance();
 
-// 绫诲埆 Tab锛�0=鍘熸潗鏂欙紝1=杩囩▼锛�2=鍑哄巶锛�
-const activeTab = ref('0')
+  // 绫诲埆 Tab锛�0=鍘熸潗鏂欙紝1=杩囩▼锛�2=鍑哄巶锛�
+  const activeTab = ref("0");
 
-// 宸︿晶鏍囧噯鍒楄〃锛氭暣琛屽唴瀹瑰眳涓紙閰嶅悎鏍峰紡锛�
-const rowClassNameCenter = () => 'row-center'
+  // 宸︿晶鏍囧噯鍒楄〃锛氭暣琛屽唴瀹瑰眳涓紙閰嶅悎鏍峰紡锛�
+  const rowClassNameCenter = () => "row-center";
 
-const data = reactive({
-  searchForm: {
-    standardNo: '',
-    standardName: '',
-    state: '',
-    inspectType: ''
+  const data = reactive({
+    searchForm: {
+      standardNo: "",
+      standardName: "",
+      state: "",
+      inspectType: "",
+    },
+  });
+  const { searchForm } = toRefs(data);
+
+  // 宸︿晶
+  const standardTableData = ref([]);
+  const tableLoading = ref(false);
+  const page = reactive({ current: 1, size: 10, total: 0 });
+
+  // 宸ュ簭涓嬫媺锛堢敤浜庡垪琛ㄥ洖鏄撅級
+  const processOptions = ref([]);
+
+  const getProcessList = async () => {
+    try {
+      const res = await productProcessListPage({ current: 1, size: 1000 });
+      if (res?.code === 200) {
+        const records = res?.data?.records || [];
+        processOptions.value = records.map(item => ({
+          label: item.processName || item.name || item.label,
+          value: item.id || item.processId || item.value,
+        }));
+      }
+    } catch (error) {
+      console.error("鑾峰彇宸ュ簭鍒楄〃澶辫触:", error);
+    }
+  };
+
+  const standardColumns = ref([
+    {
+      label: "鏍囧噯缂栧彿",
+      prop: "standardNo",
+      dataType: "slot",
+      slot: "standardNoCell",
+      minWidth: 160,
+      align: "center",
+      headerSlot: "standardNoHeader",
+    },
+    {
+      label: "鏍囧噯鍚嶇О",
+      prop: "standardName",
+      minWidth: 180,
+      align: "center",
+      headerSlot: "standardNameHeader",
+    },
+    {
+      label: "绫诲埆",
+      prop: "inspectType",
+      align: "center",
+      dataType: "tag",
+      formatData: val => {
+        const map = { 0: "鍘熸潗鏂欐楠�", 1: "杩囩▼妫�楠�", 2: "鍑哄巶妫�楠�" };
+        return map[val] || val;
+      },
+    },
+    {
+      label: "宸ュ簭",
+      prop: "processId",
+      align: "center",
+      dataType: "tag",
+      formatData: val => {
+        const target = processOptions.value.find(
+          item => String(item.value) === String(val)
+        );
+        return target?.label || val;
+      },
+    },
+    {
+      label: "澶囨敞",
+      prop: "remark",
+      minWidth: 160,
+      align: "center",
+    },
+    // {
+    //   label: '鐘舵��',
+    //   prop: 'state',
+    //   headerSlot: 'stateHeader',
+    //   dataType: 'tag',
+    //   formatData: (val) => {
+    //     const map = { 0: '鑽夌', 1: '閫氳繃', 2: '鎾ら攢' }
+    //     return map[val] || val
+    //   },
+    //   formatType: (val) => {
+    //     if (val == 1) return 'success'
+    //     if (val == 2) return 'warning'
+    //     return 'info'
+    //   }
+    // }
+  ]);
+
+  const handleTabChange = () => {
+    searchForm.value.standardNo = "";
+    searchForm.value.standardName = "";
+    searchForm.value.state = "";
+    searchForm.value.inspectType = activeTab.value;
+    page.current = 1;
+    currentStandard.value = null;
+    bindingTableData.value = [];
+    bindingSelectedRows.value = [];
+    bindingDialogVisible.value = false;
+    processBindingDialogVisible.value = false;
+    getStandardList();
+  };
+
+  const currentStandard = ref(null);
+
+  // 鍙充晶缁戝畾
+  const bindingTableData = ref([]);
+  const bindingLoading = ref(false);
+  const bindingSelectedRows = ref([]);
+  const bindingDialogVisible = ref(false);
+  const processBindingDialogVisible = ref(false);
+
+  // 浜у搧鏍戯紙鐢ㄤ簬缁戝畾閫夋嫨锛�
+  const productOptions = ref([]);
+  const selectedProductIds = ref([]);
+  const processBindingProductIds = ref([]);
+  const processBindingProcessIds = ref([]);
+  const leftProcessOptions = computed(() => {
+    const ids = new Set(
+      (standardTableData.value || [])
+        .map(i => i?.processId)
+        .filter(v => v !== null && v !== undefined && String(v) !== "")
+        .map(v => String(v))
+    );
+    if (!ids.size) return [];
+    return (processOptions.value || [])
+      .filter(p => ids.has(String(p.value)))
+      .sort((a, b) => String(a.label).localeCompare(String(b.label), "zh-CN"));
+  });
+
+  const getProductOptions = async () => {
+    // 閬垮厤閲嶅璇锋眰
+    if (productOptions.value?.length) return;
+    const res = await productTreeList();
+    productOptions.value = convertIdToValue(Array.isArray(res) ? res : []);
+  };
+
+  function convertIdToValue(data) {
+    return (data || []).map(item => {
+      const { id, children, ...rest } = item;
+      const newItem = {
+        ...rest,
+        value: id,
+      };
+      if (children && children.length > 0) {
+        newItem.children = convertIdToValue(children);
+      }
+      return newItem;
+    });
   }
-})
-const { searchForm } = toRefs(data)
 
-// 宸︿晶
-const standardTableData = ref([])
-const tableLoading = ref(false)
-const page = reactive({ current: 1, size: 10, total: 0 })
+  const handleQuery = () => {
+    page.current = 1;
+    getStandardList();
+  };
 
-// 宸ュ簭涓嬫媺锛堢敤浜庡垪琛ㄥ洖鏄撅級
-const processOptions = ref([])
+  const handlePagination = obj => {
+    page.current = obj.page;
+    page.size = obj.limit;
+    getStandardList();
+  };
 
-const getProcessList = async () => {
-  try {
-    const res = await productProcessListPage({ current: 1, size: 1000 })
-    if (res?.code === 200) {
-      const records = res?.data?.records || []
-      processOptions.value = records.map((item) => ({
-        label: item.processName || item.name || item.label,
-        value: item.id || item.processId || item.value
-      }))
-    }
-  } catch (error) {
-    console.error('鑾峰彇宸ュ簭鍒楄〃澶辫触:', error)
-  }
-}
-
-const standardColumns = ref([
-  { label: '鏍囧噯缂栧彿', prop: 'standardNo', dataType: 'slot', slot: 'standardNoCell', minWidth: 160, align: 'center', headerSlot: 'standardNoHeader' },
-  { label: '鏍囧噯鍚嶇О', prop: 'standardName', minWidth: 180, align: 'center', headerSlot: 'standardNameHeader' },
-  {
-    label: '绫诲埆',
-    prop: 'inspectType',
-    align: 'center',
-    dataType: 'tag',
-    formatData: (val) => {
-      const map = { 0: '鍘熸潗鏂欐楠�', 1: '杩囩▼妫�楠�', 2: '鍑哄巶妫�楠�' }
-      return map[val] || val
-    }
-  },
-  {
-    label: '宸ュ簭',
-    prop: 'processId',
-    align: 'center',
-    dataType: 'tag',
-    formatData: (val) => {
-      const target = processOptions.value.find(
-        (item) => String(item.value) === String(val)
-      )
-      return target?.label || val
-    }
-  },
-  {
-    label: '澶囨敞',
-    prop: 'remark',
-    minWidth: 160,
-    align: 'center'
-  }
-  // {
-  //   label: '鐘舵��',
-  //   prop: 'state',
-  //   headerSlot: 'stateHeader',
-  //   dataType: 'tag',
-  //   formatData: (val) => {
-  //     const map = { 0: '鑽夌', 1: '閫氳繃', 2: '鎾ら攢' }
-  //     return map[val] || val
-  //   },
-  //   formatType: (val) => {
-  //     if (val == 1) return 'success'
-  //     if (val == 2) return 'warning'
-  //     return 'info'
-  //   }
-  // }
-])
-
-const handleTabChange = () => {
-  searchForm.value.standardNo = ''
-  searchForm.value.standardName = ''
-  searchForm.value.state = ''
-  searchForm.value.inspectType = activeTab.value
-  page.current = 1
-  currentStandard.value = null
-  bindingTableData.value = []
-  bindingSelectedRows.value = []
-  getStandardList()
-}
-
-const currentStandard = ref(null)
-
-// 鍙充晶缁戝畾
-const bindingTableData = ref([])
-const bindingLoading = ref(false)
-const bindingSelectedRows = ref([])
-const bindingDialogVisible = ref(false)
-
-// 浜у搧鏍戯紙鐢ㄤ簬缁戝畾閫夋嫨锛�
-const productOptions = ref([])
-const selectedProductIds = ref([])
-
-const getProductOptions = async () => {
-  // 閬垮厤閲嶅璇锋眰
-  if (productOptions.value?.length) return
-  const res = await productTreeList()
-  productOptions.value = convertIdToValue(Array.isArray(res) ? res : [])
-}
-
-function convertIdToValue(data) {
-  return (data || []).map((item) => {
-    const { id, children, ...rest } = item
-    const newItem = {
-      ...rest,
-      value: id
-    }
-    if (children && children.length > 0) {
-      newItem.children = convertIdToValue(children)
-    }
-    return newItem
-  })
-}
-
-const handleQuery = () => {
-  page.current = 1
-  getStandardList()
-}
-
-const handlePagination = (obj) => {
-  page.current = obj.page
-  page.size = obj.limit
-  getStandardList()
-}
-
-const getStandardList = () => {
-  tableLoading.value = true
-  qualityTestStandardListPage({
-    ...searchForm.value,
-    current: page.current,
-    size: page.size,
-    state: 1
-  })
-    .then((res) => {
-      const records = res?.data?.records || []
-      standardTableData.value = records
-      page.total = res?.data?.total || records.length
+  const getStandardList = () => {
+    tableLoading.value = true;
+    qualityTestStandardListPage({
+      ...searchForm.value,
+      current: page.current,
+      size: page.size,
+      state: 1,
     })
-    .finally(() => {
-      tableLoading.value = false
-    })
-}
+      .then(res => {
+        const records = res?.data?.records || [];
+        standardTableData.value = records;
+        page.total = res?.data?.total || records.length;
+      })
+      .finally(() => {
+        tableLoading.value = false;
+      });
+  };
 
-// 琛ㄦ牸琛岀偣鍑伙紝鍔犺浇鍙充晶缁戝畾鍒楄〃
-const handleTableRowClick = (row) => {
-  currentStandard.value = row
-  loadBindingList()
-}
+  // 琛ㄦ牸琛岀偣鍑伙紝鍔犺浇鍙充晶缁戝畾鍒楄〃
+  const handleTableRowClick = row => {
+    currentStandard.value = row;
+    loadBindingList();
+  };
 
-// 宸︿晶琛岀偣鍑伙紝鍔犺浇鍙充晶缁戝畾鍒楄〃锛堜繚鐣欑敤浜庢爣鍑嗙紪鍙峰垪鐨勭偣鍑伙級
-const handleStandardRowClick = (row) => {
-  currentStandard.value = row
-  loadBindingList()
-}
+  // 宸︿晶琛岀偣鍑伙紝鍔犺浇鍙充晶缁戝畾鍒楄〃锛堜繚鐣欑敤浜庢爣鍑嗙紪鍙峰垪鐨勭偣鍑伙級
+  const handleStandardRowClick = row => {
+    currentStandard.value = row;
+    loadBindingList();
+  };
 
-const loadBindingList = () => {
-  if (!currentStandard.value?.id) {
-    bindingTableData.value = []
-    return
-  }
-  bindingLoading.value = true
-  qualityTestStandardBindingList({ testStandardId: currentStandard.value.id })
-    .then((res) => {
-      const base = res?.data || []
-      // 灏嗗綋鍓嶆爣鍑嗙殑宸ュ簭鍜屽娉ㄥ甫鍒扮粦瀹氬垪琛ㄤ腑灞曠ず
-      bindingTableData.value = base.map((item) => ({
-        ...item,
-        processId: currentStandard.value?.processId,
-        remark: currentStandard.value?.remark
-      }))
-    })
-    .finally(() => {
-      bindingLoading.value = false
-    })
-}
+  const loadBindingList = () => {
+    if (!currentStandard.value?.id) {
+      bindingTableData.value = [];
+      return;
+    }
+    bindingLoading.value = true;
+    qualityTestStandardBindingList({ testStandardId: currentStandard.value.id })
+      .then(res => {
+        const base = res?.data || [];
+        // 灏嗗綋鍓嶆爣鍑嗙殑宸ュ簭鍜屽娉ㄥ甫鍒扮粦瀹氬垪琛ㄤ腑灞曠ず
+        bindingTableData.value = base.map(item => ({
+          ...item,
+          processId: currentStandard.value?.processId,
+          remark: currentStandard.value?.remark,
+        }));
+      })
+      .finally(() => {
+        bindingLoading.value = false;
+      });
+  };
 
-const handleBindingSelectionChange = (selection) => {
-  bindingSelectedRows.value = selection
-}
+  const handleBindingSelectionChange = selection => {
+    bindingSelectedRows.value = selection;
+  };
 
-const openBindingDialog = () => {
-  if (!currentStandard.value?.id) return
-  selectedProductIds.value = []
-  getProductOptions()
-  bindingDialogVisible.value = true
-}
+  const openBindingDialog = () => {
+    if (!currentStandard.value?.id) return;
+    selectedProductIds.value = [];
+    getProductOptions();
+    bindingDialogVisible.value = true;
+  };
 
-const closeBindingDialog = () => {
-  bindingDialogVisible.value = false
-}
+  const closeBindingDialog = () => {
+    bindingDialogVisible.value = false;
+  };
 
-const submitBinding = async () => {
-  const testStandardId = currentStandard.value?.id
-  if (!testStandardId) return
-  const ids = (selectedProductIds.value || []).filter(Boolean)
-  if (!ids.length) {
-    proxy.$message.warning('璇烽�夋嫨浜у搧')
-    return
-  }
-  const payload = ids.map((pid) => ({
-    productId: pid,
-    testStandardId
-  }))
-  await qualityTestStandardBindingAdd(payload)
-  proxy.$message.success('娣诲姞鎴愬姛')
-  bindingDialogVisible.value = false
-  loadBindingList()
-}
+  const openProcessBindingDialog = () => {
+    if (activeTab.value !== "1" && activeTab.value !== "2") return;
+    processBindingProductIds.value = [];
+    processBindingProcessIds.value = [];
+    getProductOptions();
+    processBindingDialogVisible.value = true;
+  };
 
-const handleUnbind = async (row) => {
-  const id = row?.id ?? row?.qualityTestStandardBindingId
-  if (id == null || id === '') return
-  try {
-    await ElMessageBox.confirm('纭鍒犻櫎璇ョ粦瀹氾紵', '鎻愮ず', { type: 'warning' })
-  } catch {
-    return
-  }
-  try {
-    await qualityTestStandardBindingDel([id])
-    proxy.$message.success('鍒犻櫎鎴愬姛')
-    loadBindingList()
-  } catch (err) {
-    console.error('鍒犻櫎缁戝畾澶辫触:', err)
-    proxy.$message?.error(err?.message || '鍒犻櫎澶辫触')
-  }
-}
+  const closeProcessBindingDialog = () => {
+    processBindingDialogVisible.value = false;
+  };
 
-const handleBatchUnbind = async () => {
-  if (!bindingSelectedRows.value.length) {
-    proxy.$message.warning('璇烽�夋嫨鏁版嵁')
-    return
-  }
-  const ids = bindingSelectedRows.value
-    .map((i) => i?.id ?? i?.qualityTestStandardBindingId)
-    .filter((id) => id != null && id !== '')
-  if (!ids.length) {
-    proxy.$message.warning('閫変腑鏁版嵁缂哄皯鏈夋晥 id')
-    return
-  }
-  try {
-    await ElMessageBox.confirm('閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�', '鍒犻櫎鎻愮ず', { type: 'warning' })
-  } catch {
-    return
-  }
-  try {
-    await qualityTestStandardBindingDel(ids)
-    proxy.$message.success('鍒犻櫎鎴愬姛')
-    loadBindingList()
-  } catch (err) {
-    console.error('鎵归噺鍒犻櫎缁戝畾澶辫触:', err)
-    proxy.$message?.error(err?.message || '鍒犻櫎澶辫触')
-  }
-}
+  const submitBinding = async () => {
+    const ids = (selectedProductIds.value || []).filter(Boolean);
+    if (!ids.length) {
+      proxy.$message.warning("璇烽�夋嫨浜у搧");
+      return;
+    }
+    const testStandardId = currentStandard.value?.id;
+    if (!testStandardId) return;
+    const payload = ids.map(pid => ({
+      productId: pid,
+      testStandardId,
+    }));
+    await qualityTestStandardBindingAdd(payload);
+    proxy.$message.success("娣诲姞鎴愬姛");
+    bindingDialogVisible.value = false;
+    loadBindingList();
+  };
 
-onMounted(() => {
-  searchForm.value.inspectType = activeTab.value
-  getStandardList()
-  getProcessList()
-})
+  const submitProcessBinding = async () => {
+    const ids = (processBindingProductIds.value || []).filter(Boolean);
+    if (!ids.length) {
+      proxy.$message.warning("璇烽�夋嫨浜у搧");
+      return;
+    }
+    const processIds = (processBindingProcessIds.value || []).filter(Boolean);
+    if (!processIds.length) {
+      proxy.$message.warning("璇烽�夋嫨宸ュ簭");
+      return;
+    }
+    const allow = new Set(leftProcessOptions.value.map(i => String(i.value)));
+    const processIdSet = new Set(processIds.map(i => String(i)));
+    for (const pid of processIdSet) {
+      if (!allow.has(pid)) {
+        proxy.$message.warning("鎵�閫夊伐搴忓繀椤诲湪宸︿晶鍒楄〃涓嚭鐜拌繃");
+        return;
+      }
+    }
+    const standards = (standardTableData.value || []).filter(s =>
+      processIdSet.has(String(s?.processId))
+    );
+    if (!standards.length) {
+      proxy.$message.warning("宸︿晶鍒楄〃鏈壘鍒板尮閰嶅伐搴忕殑妫�娴嬫爣鍑�");
+      return;
+    }
+
+    const uniq = new Set();
+    const payload = [];
+    for (const std of standards) {
+      const testStandardId = std?.id;
+      if (!testStandardId) continue;
+      for (const pid of ids) {
+        const key = `${String(testStandardId)}__${String(pid)}`;
+        if (uniq.has(key)) continue;
+        uniq.add(key);
+        payload.push({
+          productId: pid,
+          testStandardId,
+        });
+      }
+    }
+    if (!payload.length) {
+      proxy.$message.warning("鏈敓鎴愭湁鏁堢粦瀹氭暟鎹�");
+      return;
+    }
+    await qualityTestStandardBindingAdd(payload);
+    proxy.$message.success(`宸叉坊鍔� ${payload.length} 鏉$粦瀹歚);
+    processBindingDialogVisible.value = false;
+    if (currentStandard.value?.id) {
+      loadBindingList();
+    }
+  };
+
+  const handleUnbind = async row => {
+    const id = row?.id ?? row?.qualityTestStandardBindingId;
+    if (id == null || id === "") return;
+    try {
+      await ElMessageBox.confirm("纭鍒犻櫎璇ョ粦瀹氾紵", "鎻愮ず", { type: "warning" });
+    } catch {
+      return;
+    }
+    try {
+      await qualityTestStandardBindingDel([id]);
+      proxy.$message.success("鍒犻櫎鎴愬姛");
+      loadBindingList();
+    } catch (err) {
+      console.error("鍒犻櫎缁戝畾澶辫触:", err);
+      proxy.$message?.error(err?.message || "鍒犻櫎澶辫触");
+    }
+  };
+
+  const handleBatchUnbind = async () => {
+    if (!bindingSelectedRows.value.length) {
+      proxy.$message.warning("璇烽�夋嫨鏁版嵁");
+      return;
+    }
+    const ids = bindingSelectedRows.value
+      .map(i => i?.id ?? i?.qualityTestStandardBindingId)
+      .filter(id => id != null && id !== "");
+    if (!ids.length) {
+      proxy.$message.warning("閫変腑鏁版嵁缂哄皯鏈夋晥 id");
+      return;
+    }
+    try {
+      await ElMessageBox.confirm(
+        "閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�",
+        "鍒犻櫎鎻愮ず",
+        { type: "warning" }
+      );
+    } catch {
+      return;
+    }
+    try {
+      await qualityTestStandardBindingDel(ids);
+      proxy.$message.success("鍒犻櫎鎴愬姛");
+      loadBindingList();
+    } catch (err) {
+      console.error("鎵归噺鍒犻櫎缁戝畾澶辫触:", err);
+      proxy.$message?.error(err?.message || "鍒犻櫎澶辫触");
+    }
+  };
+
+  onMounted(() => {
+    searchForm.value.inspectType = activeTab.value;
+    getStandardList();
+    getProcessList();
+  });
 </script>
 
 <style scoped>
-.metric-binding {
-  padding: 0;
-}
+  .metric-binding {
+    padding: 0;
+  }
 
-.metric-tabs {
-  margin: 10px;
-}
+  .metric-tabs {
+    margin: 10px;
+  }
 
-.metric-binding-row {
-  width: 100%;
-}
+  .metric-binding-row {
+    width: 100%;
+  }
 
-.metric-binding-row .left-col,
-.metric-binding-row .right-col {
-  margin-bottom: 16px;
-}
+  .metric-binding-row .left-col,
+  .metric-binding-row .right-col {
+    margin-bottom: 16px;
+  }
 
-.metric-binding-row .panel {
-  background: #ffffff;
-  padding: 16px;
-  box-sizing: border-box;
-  height: 100%;
-  min-height: 400px;
-}
+  .metric-binding-row .panel {
+    background: #ffffff;
+    padding: 16px;
+    box-sizing: border-box;
+    height: 100%;
+    min-height: 400px;
+  }
 
-.left-panel,
-.right-panel {
-  height: 100%;
-}
+  .left-panel,
+  .right-panel {
+    height: 100%;
+  }
 
-.toolbar {
-  display: flex;
-  justify-content: space-between;
-  align-items: center;
-  margin-bottom: 12px;
-}
+  .toolbar {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    margin-bottom: 12px;
+  }
 
-.toolbar-right {
-  flex-shrink: 0;
-}
+  .toolbar-right {
+    flex-shrink: 0;
+  }
 
-.right-header {
-  display: flex;
-  align-items: baseline;
-  justify-content: space-between;
-  margin-bottom: 10px;
-}
+  .right-header {
+    display: flex;
+    align-items: baseline;
+    justify-content: space-between;
+    margin-bottom: 10px;
+  }
 
-.right-header .title {
-  font-size: 16px;
-  font-weight: 600;
-}
+  .right-header .title {
+    font-size: 16px;
+    font-weight: 600;
+  }
 
-.right-header .desc {
-  font-size: 13px;
-  color: #666;
-}
+  .right-header .desc {
+    font-size: 13px;
+    color: #666;
+  }
 
-.right-toolbar {
-  display: flex;
-  justify-content: flex-end;
-  gap: 10px;
-  margin-bottom: 10px;
-}
+  .right-toolbar {
+    display: flex;
+    justify-content: flex-end;
+    gap: 10px;
+    margin-bottom: 10px;
+  }
 
-.link-text {
-  color: #409eff;
-  cursor: default;
-}
+  .link-text {
+    color: #409eff;
+    cursor: default;
+  }
 
-.clickable-link {
-  color: #409eff;
-  cursor: pointer;
-}
+  .clickable-link {
+    color: #409eff;
+    cursor: pointer;
+  }
 
-.clickable-link:hover {
-  text-decoration: underline;
-}
+  .clickable-link:hover {
+    text-decoration: underline;
+  }
 
-:deep(.row-center td) {
-  text-align: center !important;
-}
+  :deep(.row-center td) {
+    text-align: center !important;
+  }
 
-/* el-table 琛ㄥご/鍐呭缁熶竴灞呬腑锛坮ow-class-name 涓嶄綔鐢ㄤ簬琛ㄥご锛� */
-:deep(.center-table .el-table__header-wrapper th .cell) {
-  text-align: center !important;
-}
-:deep(.center-table .el-table__body-wrapper td .cell) {
-  text-align: center !important;
-}
+  /* el-table 琛ㄥご/鍐呭缁熶竴灞呬腑锛坮ow-class-name 涓嶄綔鐢ㄤ簬琛ㄥご锛� */
+  :deep(.center-table .el-table__header-wrapper th .cell) {
+    text-align: center !important;
+  }
+  :deep(.center-table .el-table__body-wrapper td .cell) {
+    text-align: center !important;
+  }
 
-/* PIMTable 琛ㄥご灞呬腑 */
-:deep(.lims-table .pim-table-header-cell) {
-  text-align: center;
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  justify-content: center;
-}
+  /* PIMTable 琛ㄥご灞呬腑 */
+  :deep(.lims-table .pim-table-header-cell) {
+    text-align: center;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    justify-content: center;
+  }
 
-:deep(.lims-table .pim-table-header-title) {
-  text-align: center;
-  width: 100%;
-}
+  :deep(.lims-table .pim-table-header-title) {
+    text-align: center;
+    width: 100%;
+  }
 
-:deep(.lims-table .pim-table-header-extra) {
-  width: 100%;
-  margin-top: 4px;
-}
+  :deep(.lims-table .pim-table-header-extra) {
+    width: 100%;
+    margin-top: 4px;
+  }
 </style>
diff --git a/src/views/qualityManagement/metricMaintenance/StandardFormDialog.vue b/src/views/qualityManagement/metricMaintenance/StandardFormDialog.vue
index 0827a93..5872fd3 100644
--- a/src/views/qualityManagement/metricMaintenance/StandardFormDialog.vue
+++ b/src/views/qualityManagement/metricMaintenance/StandardFormDialog.vue
@@ -1,128 +1,137 @@
 <template>
-  <FormDialog
-    v-model="dialogVisible"
-    :title="computedTitle"
-    :operation-type="operationType"
-    :width="width"
-    @close="emit('close')"
-    @cancel="handleCancel"
-    @confirm="handleConfirm"
-  >
-    <el-form
-      ref="formRef"
-      :model="form"
-      :rules="rules"
-      label-width="100px"
-    >
-      <el-form-item label="鏍囧噯缂栧彿" prop="standardNo">
-        <el-input v-model="form.standardNo" placeholder="璇疯緭鍏ユ爣鍑嗙紪鍙�" />
+  <FormDialog v-model="dialogVisible"
+              :title="computedTitle"
+              :operation-type="operationType"
+              :width="width"
+              @close="emit('close')"
+              @cancel="handleCancel"
+              @confirm="handleConfirm">
+    <el-form ref="formRef"
+             :model="form"
+             :rules="rules"
+             label-width="100px">
+      <el-form-item label="鏍囧噯缂栧彿"
+                    prop="standardNo">
+        <el-input v-model="form.standardNo"
+                  placeholder="璇疯緭鍏ユ爣鍑嗙紪鍙�" />
       </el-form-item>
-      <el-form-item label="鏍囧噯鍚嶇О" prop="standardName">
-        <el-input v-model="form.standardName" placeholder="璇疯緭鍏ユ爣鍑嗗悕绉�" />
+      <el-form-item label="鏍囧噯鍚嶇О"
+                    prop="standardName">
+        <el-input v-model="form.standardName"
+                  placeholder="璇疯緭鍏ユ爣鍑嗗悕绉�" />
       </el-form-item>
-      <el-form-item v-if="needProcess" label="宸ュ簭" prop="processId">
-        <el-select v-model="form.processId" placeholder="璇烽�夋嫨宸ュ簭" style="width: 100%">
-          <el-option
-            v-for="item in processOptions"
-            :key="item.value"
-            :label="item.label"
-            :value="item.value"
-          />
+      <el-form-item v-if="needProcess"
+                    label="宸ュ簭"
+                    prop="processId">
+        <el-select v-model="form.processId"
+                   placeholder="璇烽�夋嫨宸ュ簭"
+                   style="width: 100%">
+          <el-option v-for="item in processOptions"
+                     :key="item.value"
+                     :label="item.label"
+                     :value="item.value" />
         </el-select>
       </el-form-item>
-      <el-form-item label="鐘舵��" prop="state">
-        <el-select v-model="form.state" placeholder="璇烽�夋嫨鐘舵��" style="width: 100%">
-          <el-option label="鑽夌" value="0" />
-          <el-option label="閫氳繃" value="1" />
-          <el-option label="鎾ら攢" value="2" />
+      <el-form-item label="鐘舵��"
+                    prop="state">
+        <el-select v-model="form.state"
+                   placeholder="璇烽�夋嫨鐘舵��"
+                   style="width: 100%">
+          <el-option label="鑽夌"
+                     value="0" />
+          <el-option label="閫氳繃"
+                     value="1" />
+          <el-option label="鎾ら攢"
+                     value="2" />
         </el-select>
       </el-form-item>
-      <el-form-item label="澶囨敞" prop="remark">
-        <el-input
-          v-model="form.remark"
-          type="textarea"
-          :rows="3"
-          placeholder="璇疯緭鍏ュ娉�"
-        />
+      <el-form-item label="澶囨敞"
+                    prop="remark">
+        <el-input v-model="form.remark"
+                  type="textarea"
+                  :rows="3"
+                  placeholder="璇疯緭鍏ュ娉�" />
       </el-form-item>
     </el-form>
   </FormDialog>
 </template>
 
 <script setup>
-import { computed, ref } from 'vue'
-import FormDialog from '@/components/Dialog/FormDialog.vue'
+  import { computed, ref } from "vue";
+  import FormDialog from "@/components/Dialog/FormDialog.vue";
 
-const props = defineProps({
-  modelValue: {
-    type: Boolean,
-    default: false
-  },
-  operationType: {
-    type: String,
-    default: 'add'
-  },
-  form: {
-    type: Object,
-    required: true
-  },
-  rules: {
-    type: Object,
-    default: () => ({})
-  },
-  processOptions: {
-    type: Array,
-    default: () => []
-  },
-  width: {
-    type: String,
-    default: '500px'
-  },
-  inspectType:{
-    type: String,
-    default: null
-  }
-})
+  const props = defineProps({
+    modelValue: {
+      type: Boolean,
+      default: false,
+    },
+    operationType: {
+      type: String,
+      default: "add",
+    },
+    form: {
+      type: Object,
+      required: true,
+    },
+    rules: {
+      type: Object,
+      default: () => ({}),
+    },
+    processOptions: {
+      type: Array,
+      default: () => [],
+    },
+    width: {
+      type: String,
+      default: "500px",
+    },
+    inspectType: {
+      type: String,
+      default: null,
+    },
+  });
 
-const emit = defineEmits(['update:modelValue', 'close', 'cancel', 'confirm'])
+  const emit = defineEmits(["update:modelValue", "close", "cancel", "confirm"]);
 
-const dialogVisible = computed({
-  get: () => props.modelValue,
-  set: (val) => emit('update:modelValue', val)
-})
+  const dialogVisible = computed({
+    get: () => props.modelValue,
+    set: val => emit("update:modelValue", val),
+  });
 
-const formRef = ref(null)
+  const formRef = ref(null);
 
-const needProcess = computed(() => String(props.inspectType ?? '') === '1')
+  const needProcess = computed(() =>
+    ["1", "2"].includes(String(props.inspectType ?? ""))
+  );
 
-const computedTitle = computed(() => {
-  if (props.operationType === 'edit') return '缂栬緫妫�娴嬫爣鍑�'
-  if (props.operationType === 'copy') return '澶嶅埗妫�娴嬫爣鍑�'
-  return '鏂板妫�娴嬫爣鍑�'
-})
+  const computedTitle = computed(() => {
+    if (props.operationType === "edit") return "缂栬緫妫�娴嬫爣鍑�";
+    if (props.operationType === "copy") return "澶嶅埗妫�娴嬫爣鍑�";
+    return "鏂板妫�娴嬫爣鍑�";
+  });
 
-const handleConfirm = () => {
-  if (!formRef.value) {
-    emit('confirm')
-    return
-  }
-  formRef.value.validate((valid) => {
-    if (valid) {
-      emit('confirm')
+  const handleConfirm = () => {
+    if (!formRef.value) {
+      emit("confirm");
+      return;
     }
-  })
-}
+    formRef.value.validate(valid => {
+      if (valid) {
+        emit("confirm");
+      }
+    });
+  };
 
-const handleCancel = () => {
-  emit('cancel')
-  dialogVisible.value = false
-}
+  const handleCancel = () => {
+    emit("cancel");
+    dialogVisible.value = false;
+  };
 
-const resetFields = () => {
-  formRef.value?.resetFields?.()
-}
+  const resetFields = () => {
+    formRef.value?.resetFields?.();
+  };
 
-defineExpose({
-  resetFields
-})
+  defineExpose({
+    resetFields,
+  });
 </script>
diff --git a/src/views/qualityManagement/metricMaintenance/index.vue b/src/views/qualityManagement/metricMaintenance/index.vue
index 89cc08f..6282edd 100644
--- a/src/views/qualityManagement/metricMaintenance/index.vue
+++ b/src/views/qualityManagement/metricMaintenance/index.vue
@@ -1,860 +1,938 @@
 <template>
   <div class="app-container metric-maintenance">
-    <el-tabs v-model="activeTab" @tab-change="handleTabChange" class="metric-tabs">
-      <el-tab-pane label="鍘熸潗鏂欐楠�" name="0" />
-      <el-tab-pane label="杩囩▼妫�楠�" name="1" />
-      <el-tab-pane label="鍑哄巶妫�楠�" name="2" />
+    <el-tabs v-model="activeTab"
+             @tab-change="handleTabChange"
+             class="metric-tabs">
+      <el-tab-pane label="鍘熸潗鏂欐楠�"
+                   name="0" />
+      <el-tab-pane label="杩囩▼妫�楠�"
+                   name="1" />
+      <el-tab-pane label="鍑哄巶妫�楠�"
+                   name="2" />
     </el-tabs>
-    <el-row :gutter="16" class="metric-maintenance-row">
+    <el-row :gutter="16"
+            class="metric-maintenance-row">
       <!-- 宸︿晶锛氭娴嬫爣鍑嗗垪琛� -->
-      <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" class="left-col">
+      <el-col :xs="24"
+              :sm="24"
+              :md="12"
+              :lg="12"
+              :xl="12"
+              class="left-col">
         <div class="left-panel">
-      <div class="toolbar">
-        <div class="toolbar-left"></div>
-        <div class="toolbar-right">
-          <el-button type="primary" @click="openStandardDialog('add')">鏂板</el-button>
-          <el-button type="success" plain @click="handleBatchAudit(1)">鎵瑰噯</el-button>
-          <el-button type="warning" plain @click="handleBatchAudit(2)">鎾ら攢</el-button>
-          <el-button type="danger" plain @click="handleBatchDelete">鍒犻櫎</el-button>
-        </div>
-      </div>
-      <PIMTable
-        rowKey="id"
-        :column="standardColumns"
-        :tableData="standardTableData"
-        :page="page"
-        :isSelection="true"
-        :tableLoading="tableLoading"
-        :rowClassName="rowClassNameCenter"
-        :rowClick="handleTableRowClick"
-        @selection-change="handleSelectionChange"
-        @pagination="handlePagination"
-        :total="page.total"
-      >
-        <template #standardNoCell="{ row }">
-          <span class="clickable-link" @click="handleStandardRowClick(row)">
-            {{ row.standardNo }}
-          </span>
-        </template>
-
-        <!-- 琛ㄥご鎼滅储鎻掓Ы -->
-        <template #standardNoHeader>
-          <el-input
-            v-model="searchForm.standardNo"
-            placeholder="鏍囧噯缂栧彿"
-            clearable
-            size="small"
-            @change="handleQuery"
-            @clear="handleQuery"
-          />
-        </template>
-        <template #standardNameHeader>
-          <el-input
-            v-model="searchForm.standardName"
-            placeholder="鏍囧噯鍚嶇О"
-            clearable
-            size="small"
-            @change="handleQuery"
-            @clear="handleQuery"
-          />
-        </template>
-        <template #stateHeader>
-          <el-select
-            v-model="searchForm.state"
-            placeholder="鐘舵��"
-            clearable
-            size="small"
-            style="width: 110px"
-            @change="handleQuery"
-            @clear="handleQuery"
-          >
-            <el-option label="鑽夌" value="0" />
-            <el-option label="閫氳繃" value="1" />
-            <el-option label="鎾ら攢" value="2" />
-          </el-select>
-        </template>
-      </PIMTable>
+          <div class="toolbar">
+            <div class="toolbar-left"></div>
+            <div class="toolbar-right">
+              <el-button type="primary"
+                         @click="openStandardDialog('add')">鏂板</el-button>
+              <el-button type="success"
+                         plain
+                         @click="handleBatchAudit(1)">鎵瑰噯</el-button>
+              <el-button type="warning"
+                         plain
+                         @click="handleBatchAudit(2)">鎾ら攢</el-button>
+              <el-button type="danger"
+                         plain
+                         @click="handleBatchDelete">鍒犻櫎</el-button>
+            </div>
+          </div>
+          <PIMTable rowKey="id"
+                    :column="standardColumns"
+                    :tableData="standardTableData"
+                    :page="page"
+                    :isSelection="true"
+                    :tableLoading="tableLoading"
+                    :rowClassName="rowClassNameCenter"
+                    :rowClick="handleTableRowClick"
+                    @selection-change="handleSelectionChange"
+                    @pagination="handlePagination"
+                    :total="page.total">
+            <template #standardNoCell="{ row }">
+              <span class="clickable-link"
+                    @click="handleStandardRowClick(row)">
+                {{ row.standardNo }}
+              </span>
+            </template>
+            <!-- 琛ㄥご鎼滅储鎻掓Ы -->
+            <template #standardNoHeader>
+              <el-input v-model="searchForm.standardNo"
+                        placeholder="鏍囧噯缂栧彿"
+                        clearable
+                        size="small"
+                        @change="handleQuery"
+                        @clear="handleQuery" />
+            </template>
+            <template #standardNameHeader>
+              <el-input v-model="searchForm.standardName"
+                        placeholder="鏍囧噯鍚嶇О"
+                        clearable
+                        size="small"
+                        @change="handleQuery"
+                        @clear="handleQuery" />
+            </template>
+            <template #stateHeader>
+              <el-select v-model="searchForm.state"
+                         placeholder="鐘舵��"
+                         clearable
+                         size="small"
+                         style="width: 110px"
+                         @change="handleQuery"
+                         @clear="handleQuery">
+                <el-option label="鑽夌"
+                           value="0" />
+                <el-option label="閫氳繃"
+                           value="1" />
+                <el-option label="鎾ら攢"
+                           value="2" />
+              </el-select>
+            </template>
+          </PIMTable>
         </div>
       </el-col>
-
       <!-- 鍙充晶锛氭爣鍑嗗弬鏁板垪琛� -->
-      <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" class="right-col">
+      <el-col :xs="24"
+              :sm="24"
+              :md="12"
+              :lg="12"
+              :xl="12"
+              class="right-col">
         <div class="right-panel">
-      <div class="right-header">
-        <div class="title">鏍囧噯鍙傛暟</div>
-        <div class="desc" v-if="currentStandard">
-          鎮ㄥ綋鍓嶉�夋嫨鐨勬娴嬫爣鍑嗙紪鍙锋槸锛�
-          <span class="link-text">{{ currentStandard.standardNo }}</span>
-        </div>
-        <div class="desc" v-else>璇峰厛鍦ㄥ乏渚ч�夋嫨涓�涓娴嬫爣鍑�</div>
-      </div>
-
-      <div class="right-toolbar">
-        <el-button type="primary" :disabled="!currentStandard || isStandardReadonly" @click="openParamDialog('add')">
-          鏂板
-        </el-button>
-        <el-button type="danger" plain :disabled="!currentStandard || isStandardReadonly" @click="handleParamBatchDelete">
-          鍒犻櫎
-        </el-button>
-      </div>
-
-      <el-table
-        v-loading="detailLoading"
-        :data="detailTableData"
-        border
-        :row-class-name="() => 'row-center'"
-        class="center-table"
-        style="width: 100%"
-        height="calc(100vh - 220px)"
-        @selection-change="handleParamSelectionChange"
-      >
-        <el-table-column type="selection" width="48" align="center" />
-        <el-table-column type="index" label="搴忓彿" width="60" align="center" />
-        <el-table-column prop="parameterItem" label="鍙傛暟椤�" min-width="120" />
-        <el-table-column prop="unit" label="鍗曚綅" width="80" />
-        <el-table-column prop="standardValue" label="鏍囧噯鍊�" min-width="120" />
-        <el-table-column prop="controlValue" label="鍐呮帶鍊�" min-width="120" />
-        <el-table-column prop="defaultValue" label="榛樿鍊�" min-width="120" />
-        <el-table-column label="鎿嶄綔" width="140" fixed="right" align="center">
-          <template #default="{ row }">
-            <el-button link type="primary" size="small" :disabled="isStandardReadonly" @click="openParamDialog('edit', row)">
-              缂栬緫
+          <div class="right-header">
+            <div class="title">鏍囧噯鍙傛暟</div>
+            <div class="desc"
+                 v-if="currentStandard">
+              鎮ㄥ綋鍓嶉�夋嫨鐨勬娴嬫爣鍑嗙紪鍙锋槸锛�
+              <span class="link-text">{{ currentStandard.standardNo }}</span>
+            </div>
+            <div class="desc"
+                 v-else>璇峰厛鍦ㄥ乏渚ч�夋嫨涓�涓娴嬫爣鍑�</div>
+          </div>
+          <div class="right-toolbar">
+            <el-button type="primary"
+                       :disabled="!currentStandard || isStandardReadonly"
+                       @click="openParamDialog('add')">
+              鏂板
             </el-button>
-            <el-button link type="danger" size="small" :disabled="isStandardReadonly" @click="handleParamDelete(row)">
+            <el-button type="danger"
+                       plain
+                       :disabled="!currentStandard || isStandardReadonly"
+                       @click="handleParamBatchDelete">
               鍒犻櫎
             </el-button>
-          </template>
-        </el-table-column>
-      </el-table>
+          </div>
+          <el-table v-loading="detailLoading"
+                    :data="detailTableData"
+                    border
+                    :row-class-name="() => 'row-center'"
+                    class="center-table"
+                    style="width: 100%"
+                    height="calc(100vh - 220px)"
+                    @selection-change="handleParamSelectionChange">
+            <el-table-column type="selection"
+                             width="48"
+                             align="center" />
+            <el-table-column type="index"
+                             label="搴忓彿"
+                             width="60"
+                             align="center" />
+            <el-table-column prop="parameterItem"
+                             label="鍙傛暟椤�"
+                             min-width="120" />
+            <el-table-column prop="unit"
+                             label="鍗曚綅"
+                             width="80" />
+            <el-table-column prop="standardValue"
+                             label="鏍囧噯鍊�"
+                             min-width="120" />
+            <el-table-column prop="controlValue"
+                             label="鍐呮帶鍊�"
+                             min-width="120" />
+            <el-table-column prop="defaultValue"
+                             label="榛樿鍊�"
+                             min-width="120" />
+            <el-table-column label="鎿嶄綔"
+                             width="140"
+                             fixed="right"
+                             align="center">
+              <template #default="{ row }">
+                <el-button link
+                           type="primary"
+                           size="small"
+                           :disabled="isStandardReadonly"
+                           @click="openParamDialog('edit', row)">
+                  缂栬緫
+                </el-button>
+                <el-button link
+                           type="danger"
+                           size="small"
+                           :disabled="isStandardReadonly"
+                           @click="handleParamDelete(row)">
+                  鍒犻櫎
+                </el-button>
+              </template>
+            </el-table-column>
+          </el-table>
         </div>
       </el-col>
     </el-row>
-
     <!-- 鏂板 / 缂栬緫妫�娴嬫爣鍑� -->
-    <StandardFormDialog
-      ref="standardFormDialogRef"
-      v-model="standardDialogVisible"
-      :operation-type="standardOperationType"
-      :form="standardForm"
-      :rules="standardRules"
-      :inspect-type="activeTab"
-      :process-options="processOptions"
-      @confirm="submitStandardForm"
-      @close="closeStandardDialog"
-      @cancel="closeStandardDialog"
-    />
-
-    <ParamFormDialog
-      ref="paramFormDialogRef"
-      v-model="paramDialogVisible"
-      :operation-type="paramOperationType"
-      :inspectType="activeTab.value"
-      :form="paramForm"
-      @confirm="submitParamForm"
-      @close="closeParamDialog"
-      @cancel="closeParamDialog"
-    />
+    <StandardFormDialog ref="standardFormDialogRef"
+                        v-model="standardDialogVisible"
+                        :operation-type="standardOperationType"
+                        :form="standardForm"
+                        :rules="standardRules"
+                        :inspect-type="activeTab"
+                        :process-options="processOptions"
+                        @confirm="submitStandardForm"
+                        @close="closeStandardDialog"
+                        @cancel="closeStandardDialog" />
+    <ParamFormDialog ref="paramFormDialogRef"
+                     v-model="paramDialogVisible"
+                     :operation-type="paramOperationType"
+                     :inspectType="activeTab.value"
+                     :form="paramForm"
+                     @confirm="submitParamForm"
+                     @close="closeParamDialog"
+                     @cancel="closeParamDialog" />
   </div>
 </template>
 
 <script setup>
-import { Search } from '@element-plus/icons-vue'
-import { ref, reactive, toRefs, onMounted, getCurrentInstance, computed } from 'vue'
-import { ElMessageBox } from 'element-plus'
-import {
-  qualityTestStandardListPage,
-  qualityTestStandardAdd,
-  qualityTestStandardUpdate,
-  qualityTestStandardDel,
-  qualityTestStandardCopyParam,
-  qualityTestStandardAudit,
-  qualityTestStandardParamList,
-  qualityTestStandardParamAdd,
-  qualityTestStandardParamUpdate,
-  qualityTestStandardParamDel
-} from '@/api/qualityManagement/metricMaintenance.js'
-import { productProcessListPage } from '@/api/basicData/productProcess.js'
-import StandardFormDialog from './StandardFormDialog.vue'
-import ParamFormDialog from './ParamFormDialog.vue'
+  import { Search } from "@element-plus/icons-vue";
+  import {
+    ref,
+    reactive,
+    toRefs,
+    onMounted,
+    getCurrentInstance,
+    computed,
+  } from "vue";
+  import { ElMessageBox } from "element-plus";
+  import {
+    qualityTestStandardListPage,
+    qualityTestStandardAdd,
+    qualityTestStandardUpdate,
+    qualityTestStandardDel,
+    qualityTestStandardCopyParam,
+    qualityTestStandardAudit,
+    qualityTestStandardParamList,
+    qualityTestStandardParamAdd,
+    qualityTestStandardParamUpdate,
+    qualityTestStandardParamDel,
+  } from "@/api/qualityManagement/metricMaintenance.js";
+  import { productProcessListPage } from "@/api/basicData/productProcess.js";
+  import StandardFormDialog from "./StandardFormDialog.vue";
+  import ParamFormDialog from "./ParamFormDialog.vue";
 
-const { proxy } = getCurrentInstance()
+  const { proxy } = getCurrentInstance();
 
-// 绫诲埆 Tab锛�0=鍘熸潗鏂欙紝1=杩囩▼锛�2=鍑哄巶锛�
-const activeTab = ref('0')
+  // 绫诲埆 Tab锛�0=鍘熸潗鏂欙紝1=杩囩▼锛�2=鍑哄巶锛�
+  const activeTab = ref("0");
 
-// 宸︿晶鏍囧噯鍒楄〃锛氭暣琛屽唴瀹瑰眳涓紙閰嶅悎鏍峰紡锛�
-const rowClassNameCenter = () => 'row-center'
+  // 宸︿晶鏍囧噯鍒楄〃锛氭暣琛屽唴瀹瑰眳涓紙閰嶅悎鏍峰紡锛�
+  const rowClassNameCenter = () => "row-center";
 
-// 鏍囧噯鐘舵�佷负鈥滈�氳繃(1)鈥濇椂锛屽彸渚у弬鏁扮姝㈠鍒犳敼
-const isStandardReadonly = computed(() => {
-  const state = currentStandard.value?.state
-  return state === 1 || state === '1'
-})
+  // 鏍囧噯鐘舵�佷负鈥滈�氳繃(1)鈥濇椂锛屽彸渚у弬鏁扮姝㈠鍒犳敼
+  const isStandardReadonly = computed(() => {
+    const state = currentStandard.value?.state;
+    return state === 1 || state === "1";
+  });
 
-// 鎼滅储鏉′欢
-const data = reactive({
-  searchForm: {
-    standardNo: '',
-    standardName: '',
-    remark: '',
-    state: '',
-    inspectType: '',
-    processId: ''
-  },
-  standardForm: {
-    id: undefined,
-    standardNo: '',
-    standardName: '',
-    remark: '',
-    state: '0',
-    inspectType: '',
-    processId: ''
-  },
-  standardRules: {
-    standardNo: [{ required: true, message: '璇疯緭鍏ユ爣鍑嗙紪鍙�', trigger: 'blur' }],
-    standardName: [{ required: true, message: '璇疯緭鍏ユ爣鍑嗗悕绉�', trigger: 'blur' }],
-    processId: [{
-      validator: (_rule, value, callback) => {
-        const inspectType = String(standardForm.value.inspectType ?? activeTab.value ?? '')
-        if (inspectType === '1' && (value === '' || value === null || value === undefined)) {
-          callback(new Error('璇烽�夋嫨宸ュ簭'))
-          return
-        }
-        callback()
-      },
-      trigger: 'change'
-    }]
-  }
-})
-
-const { searchForm, standardForm, standardRules } = toRefs(data)
-
-// 宸︿晶琛ㄦ牸
-const standardTableData = ref([])
-const selectedRows = ref([])
-const tableLoading = ref(false)
-const page = reactive({
-  current: 1,
-  size: 10,
-  total: 0
-})
-
-// 宸ュ簭涓嬫媺
-const processOptions = ref([])
-
-// 鑾峰彇宸ュ簭鍒楄〃
-const getProcessList = async () => {
-  try {
-    const res = await productProcessListPage({ current: 1, size: 1000 })
-    if (res?.code === 200) {
-      const records = res?.data?.records || []
-      processOptions.value = records.map(item => ({
-        label: item.processName || item.name || item.label,
-        value: item.id || item.processId || item.value
-      }))
-    }
-  } catch (error) {
-    console.error('鑾峰彇宸ュ簭鍒楄〃澶辫触:', error)
-  }
-}
-
-// 褰撳墠閫変腑鐨勬爣鍑� & 鍙充晶璇︽儏
-const currentStandard = ref(null)
-const detailTableData = ref([])
-const detailLoading = ref(false)
-const paramSelectedRows = ref([])
-const paramDialogVisible = ref(false)
-const paramOperationType = ref('add') // add | edit
-const paramFormDialogRef = ref(null)
-const paramForm = reactive({
-  id: undefined,
-  parameterItem: '',
-  unit: '',
-  standardValue: '',
-  controlValue: '',
-  defaultValue: ''
-})
-
-// 寮圭獥
-const standardDialogVisible = ref(false)
-const standardOperationType = ref('add') // add | edit | copy
-const standardFormDialogRef = ref(null)
-
-// 鍒楀畾涔�
-const standardColumns = ref([
-  {
-    label: '鏍囧噯缂栧彿',
-    prop: 'standardNo',
-    dataType: 'slot',
-    slot: 'standardNoCell',
-    minWidth: 160,
-    align: 'center',
-    headerSlot: 'standardNoHeader'
-  },
-  {
-    label: '鏍囧噯鍚嶇О',
-    prop: 'standardName',
-    minWidth: 180,
-    align: 'center',
-    headerSlot: 'standardNameHeader'
-  },
-  {
-    label: '绫诲埆',
-    prop: 'inspectType',
-    align: 'center',
-    dataType: 'tag',
-    minWidth: 120,
-    formatData: (val) => {
-      const map = {
-        0: '鍘熸潗鏂欐楠�',
-        1: '杩囩▼妫�楠�',
-        2: '鍑哄巶妫�楠�'
-      }
-      return map[val] || val
-    }
-  },
-  {
-    label: '宸ュ簭',
-    prop: 'processId',
-    align: 'center',
-    dataType: 'tag',
-    visible: visible => activeTab.value === '1',
-    formatData: (val) => {
-      const target = processOptions.value.find(
-        (item) => String(item.value) === String(val)
-      )
-      return target?.label || val
-    }
-  },
-  {
-    label: '鐘舵��',
-    prop: 'state',
-    headerSlot: 'stateHeader',
-    align: 'center',
-    dataType: 'tag',
-    formatData: (val) => {
-      const map = {
-        0: '鑽夌',
-        1: '閫氳繃',
-        2: '鎾ら攢'
-      }
-      return map[val] || val
+  // 鎼滅储鏉′欢
+  const data = reactive({
+    searchForm: {
+      standardNo: "",
+      standardName: "",
+      remark: "",
+      state: "",
+      inspectType: "",
+      processId: "",
     },
-    formatType: (val) => {
-      if (val === '1' || val === 1) return 'success'
-      if (val === '2' || val === 2) return 'warning'
-      return 'info'
-    }
-  },
-  {
-    label: '澶囨敞',
-    prop: 'remark',
-    minWidth: 160,
-    align: 'center'
-  },
-  {
-    dataType: 'action',
-    label: '鎿嶄綔',
-    align: 'center',
-    fixed: 'right',
-    width: 220,
-    operation: [
-      {
-        name: '缂栬緫',
-        type: 'text',
-        clickFun: (row) => {
-          openStandardDialog('edit', row)
-        }
-      },
-      {
-        name: '澶嶅埗',
-        type: 'text',
-        clickFun: async (row) => {
-          if (!row?.id) return
-          try {
-            await ElMessageBox.confirm('纭澶嶅埗璇ユ爣鍑嗗弬鏁帮紵', '鎻愮ず', { type: 'warning' })
-          } catch {
-            return
-          }
-          await qualityTestStandardCopyParam(row.id)
-          proxy.$message.success('澶嶅埗鎴愬姛')
-          getStandardList()
-          if (currentStandard.value?.id === row.id) {
-            loadDetail(row.id)
-          }
-        }
-      },
-      {
-        name: '鍒犻櫎',
-        type: 'text',
-        clickFun: (row) => {
-          handleDelete(row)
-        }
+    standardForm: {
+      id: undefined,
+      standardNo: "",
+      standardName: "",
+      remark: "",
+      state: "0",
+      inspectType: "",
+      processId: "",
+    },
+    standardRules: {
+      standardNo: [
+        { required: true, message: "璇疯緭鍏ユ爣鍑嗙紪鍙�", trigger: "blur" },
+      ],
+      standardName: [
+        { required: true, message: "璇疯緭鍏ユ爣鍑嗗悕绉�", trigger: "blur" },
+      ],
+      processId: [
+        {
+          validator: (_rule, value, callback) => {
+            const inspectType = String(
+              standardForm.value.inspectType ?? activeTab.value ?? ""
+            );
+            if (
+              (inspectType === "1" || inspectType === "2") &&
+              (value === "" || value === null || value === undefined)
+            ) {
+              callback(new Error("璇烽�夋嫨宸ュ簭"));
+              return;
+            }
+            callback();
+          },
+          trigger: "change",
+        },
+      ],
+    },
+  });
+
+  const { searchForm, standardForm, standardRules } = toRefs(data);
+
+  // 宸︿晶琛ㄦ牸
+  const standardTableData = ref([]);
+  const selectedRows = ref([]);
+  const tableLoading = ref(false);
+  const page = reactive({
+    current: 1,
+    size: 10,
+    total: 0,
+  });
+
+  // 宸ュ簭涓嬫媺
+  const processOptions = ref([]);
+
+  // 鑾峰彇宸ュ簭鍒楄〃
+  const getProcessList = async () => {
+    try {
+      const res = await productProcessListPage({ current: 1, size: 1000 });
+      if (res?.code === 200) {
+        const records = res?.data?.records || [];
+        processOptions.value = records.map(item => ({
+          label: item.processName || item.name || item.label,
+          value: item.id || item.processId || item.value,
+        }));
       }
-    ]
-  }
-])
-const handleTabChange = () => {
-  searchForm.value.standardNo = ''
-  searchForm.value.standardName = ''
-  searchForm.value.remark = ''
-  searchForm.value.state = ''
-  searchForm.value.processId = ''
-  searchForm.value.inspectType = activeTab.value
-  page.current = 1
-  currentStandard.value = null
-  detailTableData.value = []
-  paramSelectedRows.value = []
-  getStandardList()
-}
+    } catch (error) {
+      console.error("鑾峰彇宸ュ簭鍒楄〃澶辫触:", error);
+    }
+  };
 
-// 鏌ヨ鍒楄〃
-const getStandardList = () => {
-  tableLoading.value = true
-  const params = {
-    ...searchForm.value,
-    current: page.current,
-    size: page.size
-  }
-  qualityTestStandardListPage(params)
-    .then((res) => {
-      const records = res?.data?.records || []
-      standardTableData.value = records
-      page.total = res?.data?.total || records.length
+  // 褰撳墠閫変腑鐨勬爣鍑� & 鍙充晶璇︽儏
+  const currentStandard = ref(null);
+  const detailTableData = ref([]);
+  const detailLoading = ref(false);
+  const paramSelectedRows = ref([]);
+  const paramDialogVisible = ref(false);
+  const paramOperationType = ref("add"); // add | edit
+  const paramFormDialogRef = ref(null);
+  const paramForm = reactive({
+    id: undefined,
+    parameterItem: "",
+    unit: "",
+    standardValue: "",
+    controlValue: "",
+    defaultValue: "",
+  });
+
+  // 寮圭獥
+  const standardDialogVisible = ref(false);
+  const standardOperationType = ref("add"); // add | edit | copy
+  const standardFormDialogRef = ref(null);
+
+  // 鍒楀畾涔�
+  const standardColumns = ref([
+    {
+      label: "鏍囧噯缂栧彿",
+      prop: "standardNo",
+      dataType: "slot",
+      slot: "standardNoCell",
+      minWidth: 160,
+      align: "center",
+      headerSlot: "standardNoHeader",
+    },
+    {
+      label: "鏍囧噯鍚嶇О",
+      prop: "standardName",
+      minWidth: 180,
+      align: "center",
+      headerSlot: "standardNameHeader",
+    },
+    {
+      label: "绫诲埆",
+      prop: "inspectType",
+      align: "center",
+      dataType: "tag",
+      minWidth: 120,
+      formatData: val => {
+        const map = {
+          0: "鍘熸潗鏂欐楠�",
+          1: "杩囩▼妫�楠�",
+          2: "鍑哄巶妫�楠�",
+        };
+        return map[val] || val;
+      },
+    },
+    {
+      label: "宸ュ簭",
+      prop: "processId",
+      align: "center",
+      dataType: "tag",
+      visible: visible => ["1", "2"].includes(String(activeTab.value)),
+      formatData: val => {
+        const target = processOptions.value.find(
+          item => String(item.value) === String(val)
+        );
+        return target?.label || val;
+      },
+    },
+    {
+      label: "鐘舵��",
+      prop: "state",
+      headerSlot: "stateHeader",
+      align: "center",
+      dataType: "tag",
+      formatData: val => {
+        const map = {
+          0: "鑽夌",
+          1: "閫氳繃",
+          2: "鎾ら攢",
+        };
+        return map[val] || val;
+      },
+      formatType: val => {
+        if (val === "1" || val === 1) return "success";
+        if (val === "2" || val === 2) return "warning";
+        return "info";
+      },
+    },
+    {
+      label: "澶囨敞",
+      prop: "remark",
+      minWidth: 160,
+      align: "center",
+    },
+    {
+      dataType: "action",
+      label: "鎿嶄綔",
+      align: "center",
+      fixed: "right",
+      width: 220,
+      operation: [
+        {
+          name: "缂栬緫",
+          type: "text",
+          clickFun: row => {
+            openStandardDialog("edit", row);
+          },
+        },
+        {
+          name: "澶嶅埗",
+          type: "text",
+          clickFun: async row => {
+            if (!row?.id) return;
+            try {
+              await ElMessageBox.confirm("纭澶嶅埗璇ユ爣鍑嗗弬鏁帮紵", "鎻愮ず", {
+                type: "warning",
+              });
+            } catch {
+              return;
+            }
+            await qualityTestStandardCopyParam(row.id);
+            proxy.$message.success("澶嶅埗鎴愬姛");
+            getStandardList();
+            if (currentStandard.value?.id === row.id) {
+              loadDetail(row.id);
+            }
+          },
+        },
+        {
+          name: "鍒犻櫎",
+          type: "text",
+          clickFun: row => {
+            handleDelete(row);
+          },
+        },
+      ],
+    },
+  ]);
+  const handleTabChange = () => {
+    searchForm.value.standardNo = "";
+    searchForm.value.standardName = "";
+    searchForm.value.remark = "";
+    searchForm.value.state = "";
+    searchForm.value.processId = "";
+    searchForm.value.inspectType = activeTab.value;
+    page.current = 1;
+    currentStandard.value = null;
+    detailTableData.value = [];
+    paramSelectedRows.value = [];
+    getStandardList();
+  };
+
+  // 鏌ヨ鍒楄〃
+  const getStandardList = () => {
+    tableLoading.value = true;
+    const params = {
+      ...searchForm.value,
+      current: page.current,
+      size: page.size,
+    };
+    qualityTestStandardListPage(params)
+      .then(res => {
+        const records = res?.data?.records || [];
+        standardTableData.value = records;
+        page.total = res?.data?.total || records.length;
+      })
+      .finally(() => {
+        tableLoading.value = false;
+      });
+  };
+
+  const handleQuery = () => {
+    page.current = 1;
+    getStandardList();
+  };
+
+  const resetQuery = () => {
+    searchForm.value.standardNo = "";
+    searchForm.value.standardName = "";
+    searchForm.value.remark = "";
+    searchForm.value.state = "";
+    searchForm.value.inspectType = "";
+    searchForm.value.processId = "";
+    handleQuery();
+  };
+
+  const handlePagination = obj => {
+    page.current = obj.page;
+    page.size = obj.limit;
+    getStandardList();
+  };
+
+  const handleSelectionChange = selection => {
+    selectedRows.value = selection;
+  };
+
+  // 鎵归噺瀹℃牳锛氱姸鎬� 1=鎵瑰噯锛�2=鎾ら攢
+  const handleBatchAudit = async state => {
+    if (!selectedRows.value.length) {
+      proxy.$message.warning("璇烽�夋嫨鏁版嵁");
+      return;
+    }
+    const text = state === 1 ? "鎵瑰噯" : "鎾ら攢";
+    const payload = selectedRows.value
+      .filter(i => i?.id)
+      .map(item => ({ id: item.id, state }));
+
+    if (!payload.length) {
+      proxy.$message.warning("璇烽�夋嫨鏈夋晥鏁版嵁");
+      return;
+    }
+
+    try {
+      await ElMessageBox.confirm(`纭${text}閫変腑鐨勬爣鍑嗭紵`, "鎻愮ず", {
+        type: "warning",
+      });
+    } catch {
+      return;
+    }
+    await qualityTestStandardAudit(payload);
+    proxy.$message.success(`${text}鎴愬姛`);
+    getStandardList();
+  };
+
+  // 琛ㄦ牸琛岀偣鍑伙紝鍔犺浇鍙充晶鍙傛暟
+  const handleTableRowClick = row => {
+    currentStandard.value = row;
+    loadDetail(row.id);
+  };
+
+  // 宸︿晶琛岀偣鍑伙紝鍔犺浇鍙充晶鍙傛暟锛堜繚鐣欑敤浜庢爣鍑嗙紪鍙峰垪鐨勭偣鍑伙級
+  const handleStandardRowClick = row => {
+    currentStandard.value = row;
+    loadDetail(row.id);
+  };
+
+  const loadDetail = standardId => {
+    if (!standardId) {
+      detailTableData.value = [];
+      return;
+    }
+    detailLoading.value = true;
+    qualityTestStandardParamList({ testStandardId: standardId })
+      .then(res => {
+        detailTableData.value = res?.data || [];
+      })
+      .finally(() => {
+        detailLoading.value = false;
+      });
+  };
+
+  const handleParamSelectionChange = selection => {
+    paramSelectedRows.value = selection;
+  };
+
+  const openParamDialog = (type, row) => {
+    if (!currentStandard.value?.id) return;
+    if (isStandardReadonly.value) {
+      proxy.$message.warning("璇ユ爣鍑嗗凡閫氳繃锛屽弬鏁颁笉鍙紪杈�");
+      return;
+    }
+    paramOperationType.value = type;
+    if (type === "add") {
+      Object.assign(paramForm, {
+        id: undefined,
+        parameterItem: "",
+        unit: "",
+        standardValue: "",
+        controlValue: "",
+        defaultValue: "",
+      });
+    } else if (type === "edit" && row) {
+      Object.assign(paramForm, row);
+    }
+    paramDialogVisible.value = true;
+  };
+
+  const closeParamDialog = () => {
+    paramDialogVisible.value = false;
+    paramFormDialogRef.value?.resetFields?.();
+  };
+
+  const submitParamForm = async () => {
+    const testStandardId = currentStandard.value?.id;
+    if (!testStandardId) return;
+    if (isStandardReadonly.value) {
+      proxy.$message.warning("璇ユ爣鍑嗗凡閫氳繃锛屽弬鏁颁笉鍙紪杈�");
+      return;
+    }
+    const payload = { ...paramForm, testStandardId };
+    if (paramOperationType.value === "edit") {
+      await qualityTestStandardParamUpdate(payload);
+      proxy.$message.success("鎻愪氦鎴愬姛");
+    } else {
+      await qualityTestStandardParamAdd(payload);
+      proxy.$message.success("鎻愪氦鎴愬姛");
+    }
+    closeParamDialog();
+    loadDetail(testStandardId);
+  };
+
+  const handleParamDelete = async row => {
+    if (!row?.id) return;
+    if (isStandardReadonly.value) {
+      proxy.$message.warning("璇ユ爣鍑嗗凡閫氳繃锛屽弬鏁颁笉鍙紪杈�");
+      return;
+    }
+    try {
+      await ElMessageBox.confirm("纭鍒犻櫎璇ュ弬鏁帮紵", "鎻愮ず", { type: "warning" });
+    } catch {
+      return;
+    }
+    await qualityTestStandardParamDel([row.id]);
+    proxy.$message.success("鍒犻櫎鎴愬姛");
+    loadDetail(currentStandard.value?.id);
+  };
+
+  const handleParamBatchDelete = async () => {
+    if (isStandardReadonly.value) {
+      proxy.$message.warning("璇ユ爣鍑嗗凡閫氳繃锛屽弬鏁颁笉鍙紪杈�");
+      return;
+    }
+    if (!paramSelectedRows.value.length) {
+      proxy.$message.warning("璇烽�夋嫨鏁版嵁");
+      return;
+    }
+    const ids = paramSelectedRows.value.map(i => i.id);
+    try {
+      await ElMessageBox.confirm(
+        "閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�",
+        "鍒犻櫎鎻愮ず",
+        { type: "warning" }
+      );
+    } catch {
+      return;
+    }
+    await qualityTestStandardParamDel(ids);
+    proxy.$message.success("鍒犻櫎鎴愬姛");
+    loadDetail(currentStandard.value?.id);
+  };
+
+  // 鏂板 / 缂栬緫 / 澶嶅埗
+  const openStandardDialog = (type, row) => {
+    standardOperationType.value = type;
+    if (type === "add") {
+      Object.assign(standardForm.value, {
+        id: undefined,
+        standardNo: "",
+        standardName: "",
+        remark: "",
+        state: "0",
+        inspectType: activeTab.value,
+        processId: ["1", "2"].includes(String(activeTab.value)) ? "" : null,
+      });
+    } else if (type === "edit" && row) {
+      Object.assign(standardForm.value, {
+        ...row,
+        // 纭繚 inspectType 鍜� state 杞崲涓哄瓧绗︿覆锛屼互鍖归厤 el-select 鐨� value 绫诲瀷
+        inspectType:
+          row.inspectType !== null && row.inspectType !== undefined
+            ? String(row.inspectType)
+            : "",
+        state:
+          row.state !== null && row.state !== undefined ? String(row.state) : "0",
+        // 纭繚 processId 杞崲涓哄瓧绗︿覆鎴栨暟瀛楋紙鏍规嵁瀹為檯闇�瑕侊級
+        processId:
+          ["1", "2"].includes(String(row.inspectType)) &&
+          row.processId !== null &&
+          row.processId !== undefined
+            ? row.processId
+            : null,
+      });
+    } else if (type === "copy" && row) {
+      const { id, ...rest } = row;
+      Object.assign(standardForm.value, {
+        ...rest,
+        id: undefined,
+        standardNo: "",
+        state: "0",
+        // 纭繚 inspectType 杞崲涓哄瓧绗︿覆
+        inspectType: activeTab.value,
+        processId: ["1", "2"].includes(String(activeTab.value))
+          ? rest.processId ?? ""
+          : null,
+      });
+    }
+    standardDialogVisible.value = true;
+  };
+
+  const closeStandardDialog = () => {
+    standardDialogVisible.value = false;
+    standardFormDialogRef.value?.resetFields?.();
+  };
+
+  const submitStandardForm = () => {
+    const payload = { ...standardForm.value };
+    payload.inspectType = activeTab.value;
+    if (!["1", "2"].includes(String(payload.inspectType))) {
+      payload.processId = null;
+    }
+    const isEdit = standardOperationType.value === "edit";
+    if (isEdit) {
+      qualityTestStandardUpdate(payload).then(() => {
+        proxy.$message.success("鎻愪氦鎴愬姛");
+        standardDialogVisible.value = false;
+        getStandardList();
+      });
+    } else {
+      qualityTestStandardAdd(payload).then(() => {
+        proxy.$message.success("鎻愪氦鎴愬姛");
+        standardDialogVisible.value = false;
+        getStandardList();
+      });
+    }
+  };
+
+  // 鍒犻櫎锛堝崟鏉★級
+  const handleDelete = row => {
+    const ids = [row.id];
+    ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
+      confirmButtonText: "纭",
+      cancelButtonText: "鍙栨秷",
+      type: "warning",
     })
-    .finally(() => {
-      tableLoading.value = false
+      .then(() => {
+        tableLoading.value = true;
+        qualityTestStandardDel(ids)
+          .then(() => {
+            proxy.$message.success("鍒犻櫎鎴愬姛");
+            getStandardList();
+            if (currentStandard.value && currentStandard.value.id === row.id) {
+              currentStandard.value = null;
+              detailTableData.value = [];
+            }
+          })
+          .finally(() => {
+            tableLoading.value = false;
+          });
+      })
+      .catch(() => {
+        proxy.$modal?.msg("宸插彇娑�");
+      });
+  };
+
+  // 鎵归噺鍒犻櫎
+  const handleBatchDelete = () => {
+    if (!selectedRows.value.length) {
+      proxy.$message.warning("璇烽�夋嫨鏁版嵁");
+      return;
+    }
+    const ids = selectedRows.value.map(item => item.id);
+    ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
+      confirmButtonText: "纭",
+      cancelButtonText: "鍙栨秷",
+      type: "warning",
     })
-}
+      .then(() => {
+        tableLoading.value = true;
+        qualityTestStandardDel(ids)
+          .then(() => {
+            proxy.$message.success("鍒犻櫎鎴愬姛");
+            getStandardList();
+            if (currentStandard.value && ids.includes(currentStandard.value.id)) {
+              currentStandard.value = null;
+              detailTableData.value = [];
+            }
+          })
+          .finally(() => {
+            tableLoading.value = false;
+          });
+      })
+      .catch(() => {
+        proxy.$modal?.msg("宸插彇娑�");
+      });
+  };
 
-const handleQuery = () => {
-  page.current = 1
-  getStandardList()
-}
-
-const resetQuery = () => {
-  searchForm.value.standardNo = ''
-  searchForm.value.standardName = ''
-  searchForm.value.remark = ''
-  searchForm.value.state = ''
-  searchForm.value.inspectType = ''
-  searchForm.value.processId = ''
-  handleQuery()
-}
-
-const handlePagination = (obj) => {
-  page.current = obj.page
-  page.size = obj.limit
-  getStandardList()
-}
-
-const handleSelectionChange = (selection) => {
-  selectedRows.value = selection
-}
-
-// 鎵归噺瀹℃牳锛氱姸鎬� 1=鎵瑰噯锛�2=鎾ら攢
-const handleBatchAudit = async (state) => {
-  if (!selectedRows.value.length) {
-    proxy.$message.warning('璇烽�夋嫨鏁版嵁')
-    return
-  }
-  const text = state === 1 ? '鎵瑰噯' : '鎾ら攢'
-  const payload = selectedRows.value
-    .filter(i => i?.id)
-    .map((item) => ({ id: item.id, state }))
-
-  if (!payload.length) {
-    proxy.$message.warning('璇烽�夋嫨鏈夋晥鏁版嵁')
-    return
-  }
-
-  try {
-    await ElMessageBox.confirm(`纭${text}閫変腑鐨勬爣鍑嗭紵`, '鎻愮ず', { type: 'warning' })
-  } catch {
-    return
-  }
-  await qualityTestStandardAudit(payload)
-  proxy.$message.success(`${text}鎴愬姛`)
-  getStandardList()
-}
-
-// 琛ㄦ牸琛岀偣鍑伙紝鍔犺浇鍙充晶鍙傛暟
-const handleTableRowClick = (row) => {
-  currentStandard.value = row
-  loadDetail(row.id)
-}
-
-// 宸︿晶琛岀偣鍑伙紝鍔犺浇鍙充晶鍙傛暟锛堜繚鐣欑敤浜庢爣鍑嗙紪鍙峰垪鐨勭偣鍑伙級
-const handleStandardRowClick = (row) => {
-  currentStandard.value = row
-  loadDetail(row.id)
-}
-
-const loadDetail = (standardId) => {
-  if (!standardId) {
-    detailTableData.value = []
-    return
-  }
-  detailLoading.value = true
-  qualityTestStandardParamList({ testStandardId: standardId }).then((res) => {
-    detailTableData.value = res?.data || []
-  })
-    .finally(() => {
-      detailLoading.value = false
-    })
-}
-
-const handleParamSelectionChange = (selection) => {
-  paramSelectedRows.value = selection
-}
-
-const openParamDialog = (type, row) => {
-  if (!currentStandard.value?.id) return
-  if (isStandardReadonly.value) {
-    proxy.$message.warning('璇ユ爣鍑嗗凡閫氳繃锛屽弬鏁颁笉鍙紪杈�')
-    return
-  }
-  paramOperationType.value = type
-  if (type === 'add') {
-    Object.assign(paramForm, {
-      id: undefined,
-      parameterItem: '',
-      unit: '',
-      standardValue: '',
-      controlValue: '',
-      defaultValue: ''
-    })
-  } else if (type === 'edit' && row) {
-    Object.assign(paramForm, row)
-  }
-  paramDialogVisible.value = true
-}
-
-const closeParamDialog = () => {
-  paramDialogVisible.value = false
-  paramFormDialogRef.value?.resetFields?.()
-}
-
-const submitParamForm = async () => {
-  const testStandardId = currentStandard.value?.id
-  if (!testStandardId) return
-  if (isStandardReadonly.value) {
-    proxy.$message.warning('璇ユ爣鍑嗗凡閫氳繃锛屽弬鏁颁笉鍙紪杈�')
-    return
-  }
-  const payload = { ...paramForm, testStandardId }
-  if (paramOperationType.value === 'edit') {
-    await qualityTestStandardParamUpdate(payload)
-    proxy.$message.success('鎻愪氦鎴愬姛')
-  } else {
-    await qualityTestStandardParamAdd(payload)
-    proxy.$message.success('鎻愪氦鎴愬姛')
-  }
-  closeParamDialog()
-  loadDetail(testStandardId)
-}
-
-const handleParamDelete = async (row) => {
-  if (!row?.id) return
-  if (isStandardReadonly.value) {
-    proxy.$message.warning('璇ユ爣鍑嗗凡閫氳繃锛屽弬鏁颁笉鍙紪杈�')
-    return
-  }
-  try {
-    await ElMessageBox.confirm('纭鍒犻櫎璇ュ弬鏁帮紵', '鎻愮ず', { type: 'warning' })
-  } catch {
-    return
-  }
-  await qualityTestStandardParamDel([row.id])
-  proxy.$message.success('鍒犻櫎鎴愬姛')
-  loadDetail(currentStandard.value?.id)
-}
-
-const handleParamBatchDelete = async () => {
-  if (isStandardReadonly.value) {
-    proxy.$message.warning('璇ユ爣鍑嗗凡閫氳繃锛屽弬鏁颁笉鍙紪杈�')
-    return
-  }
-  if (!paramSelectedRows.value.length) {
-    proxy.$message.warning('璇烽�夋嫨鏁版嵁')
-    return
-  }
-  const ids = paramSelectedRows.value.map((i) => i.id)
-  try {
-    await ElMessageBox.confirm('閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�', '鍒犻櫎鎻愮ず', { type: 'warning' })
-  } catch {
-    return
-  }
-  await qualityTestStandardParamDel(ids)
-  proxy.$message.success('鍒犻櫎鎴愬姛')
-  loadDetail(currentStandard.value?.id)
-}
-
-// 鏂板 / 缂栬緫 / 澶嶅埗
-const openStandardDialog = (type, row) => {
-  standardOperationType.value = type
-  if (type === 'add') {
-    Object.assign(standardForm.value, {
-      id: undefined,
-      standardNo: '',
-      standardName: '',
-      remark: '',
-      state: '0',
-      inspectType: activeTab.value,
-      processId: activeTab.value === '1' ? '' : null
-    })
-  } else if (type === 'edit' && row) {
-    Object.assign(standardForm.value, {
-      ...row,
-      // 纭繚 inspectType 鍜� state 杞崲涓哄瓧绗︿覆锛屼互鍖归厤 el-select 鐨� value 绫诲瀷
-      inspectType: row.inspectType !== null && row.inspectType !== undefined ? String(row.inspectType) : '',
-      state: row.state !== null && row.state !== undefined ? String(row.state) : '0',
-      // 纭繚 processId 杞崲涓哄瓧绗︿覆鎴栨暟瀛楋紙鏍规嵁瀹為檯闇�瑕侊級
-      processId: String(row.inspectType) === '1' && row.processId !== null && row.processId !== undefined ? row.processId : null
-    })
-  } else if (type === 'copy' && row) {
-    const { id, ...rest } = row
-    Object.assign(standardForm.value, {
-      ...rest,
-      id: undefined,
-      standardNo: '',
-      state: '0',
-      // 纭繚 inspectType 杞崲涓哄瓧绗︿覆
-      inspectType: activeTab.value,
-      processId: activeTab.value === '1' ? (rest.processId ?? '') : null
-    })
-  }
-  standardDialogVisible.value = true
-}
-
-const closeStandardDialog = () => {
-  standardDialogVisible.value = false
-  standardFormDialogRef.value?.resetFields?.()
-}
-
-const submitStandardForm = () => {
-  const payload = { ...standardForm.value }
-  payload.inspectType = activeTab.value
-  if (String(payload.inspectType) !== '1') {
-    payload.processId = null
-  }
-  const isEdit = standardOperationType.value === 'edit'
-  if (isEdit) {
-    qualityTestStandardUpdate(payload).then(() => {
-      proxy.$message.success('鎻愪氦鎴愬姛')
-      standardDialogVisible.value = false
-      getStandardList()
-    })
-  } else {
-    qualityTestStandardAdd(payload).then(() => {
-       proxy.$message.success('鎻愪氦鎴愬姛')
-      standardDialogVisible.value = false
-      getStandardList()
-    })
-  }
-}
-
-// 鍒犻櫎锛堝崟鏉★級
-const handleDelete = (row) => {
-  const ids = [row.id]
-  ElMessageBox.confirm('閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�', '鍒犻櫎鎻愮ず', {
-    confirmButtonText: '纭',
-    cancelButtonText: '鍙栨秷',
-    type: 'warning'
-  })
-    .then(() => {
-      tableLoading.value = true
-      qualityTestStandardDel(ids)
-        .then(() => {
-          proxy.$message.success('鍒犻櫎鎴愬姛')
-          getStandardList()
-          if (currentStandard.value && currentStandard.value.id === row.id) {
-            currentStandard.value = null
-            detailTableData.value = []
-          }
-        })
-        .finally(() => {
-          tableLoading.value = false
-        })
-    })
-    .catch(() => {
-      proxy.$modal?.msg('宸插彇娑�')
-    })
-}
-
-// 鎵归噺鍒犻櫎
-const handleBatchDelete = () => {
-  if (!selectedRows.value.length) {
-    proxy.$message.warning('璇烽�夋嫨鏁版嵁')
-    return
-  }
-  const ids = selectedRows.value.map((item) => item.id)
-  ElMessageBox.confirm('閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�', '鍒犻櫎鎻愮ず', {
-    confirmButtonText: '纭',
-    cancelButtonText: '鍙栨秷',
-    type: 'warning'
-  })
-    .then(() => {
-      tableLoading.value = true
-      qualityTestStandardDel(ids)
-        .then(() => {
-           proxy.$message.success('鍒犻櫎鎴愬姛')
-          getStandardList()
-          if (currentStandard.value && ids.includes(currentStandard.value.id)) {
-            currentStandard.value = null
-            detailTableData.value = []
-          }
-        })
-        .finally(() => {
-          tableLoading.value = false
-        })
-    })
-    .catch(() => {
-      proxy.$modal?.msg('宸插彇娑�')
-    })
-}
-
-onMounted(() => {
-  searchForm.value.inspectType = activeTab.value
-  getProcessList()
-  getStandardList()
-})
+  onMounted(() => {
+    searchForm.value.inspectType = activeTab.value;
+    getProcessList();
+    getStandardList();
+  });
 </script>
 
 <style scoped>
-.metric-maintenance {
-  padding: 0;
-  min-width: 0;
-}
+  .metric-maintenance {
+    padding: 0;
+    min-width: 0;
+  }
 
-.metric-tabs {
-  margin: 10px;
-}
+  .metric-tabs {
+    margin: 10px;
+  }
 
-.metric-maintenance-row {
-  width: 100%;
-}
+  .metric-maintenance-row {
+    width: 100%;
+  }
 
-.metric-maintenance-row .left-col,
-.metric-maintenance-row .right-col {
-  margin-bottom: 16px;
-}
+  .metric-maintenance-row .left-col,
+  .metric-maintenance-row .right-col {
+    margin-bottom: 16px;
+  }
 
-.left-panel,
-.right-panel {
-  min-width: 0;
-  background: #ffffff;
-  padding: 16px;
-  box-sizing: border-box;
-  overflow: hidden;
-  height: 100%;
-  min-height: 400px;
-}
-
-@media (max-width: 768px) {
   .left-panel,
   .right-panel {
-    padding: 12px;
+    min-width: 0;
+    background: #ffffff;
+    padding: 16px;
+    box-sizing: border-box;
+    overflow: hidden;
+    height: 100%;
+    min-height: 400px;
   }
-}
 
-.toolbar {
-  display: flex;
-  justify-content: space-between;
-  align-items: center;
-  margin-bottom: 12px;
-  flex-wrap: wrap;
-  gap: 8px;
-}
+  @media (max-width: 768px) {
+    .left-panel,
+    .right-panel {
+      padding: 12px;
+    }
+  }
 
-.toolbar-left {
-  display: flex;
-  align-items: center;
-  flex-wrap: wrap;
-  gap: 4px;
-}
+  .toolbar {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    margin-bottom: 12px;
+    flex-wrap: wrap;
+    gap: 8px;
+  }
 
-.toolbar-right {
-  flex-shrink: 0;
-  display: flex;
-  flex-wrap: wrap;
-  gap: 8px;
-}
+  .toolbar-left {
+    display: flex;
+    align-items: center;
+    flex-wrap: wrap;
+    gap: 4px;
+  }
 
-.search-label {
-  margin: 0 4px 0 12px;
-}
+  .toolbar-right {
+    flex-shrink: 0;
+    display: flex;
+    flex-wrap: wrap;
+    gap: 8px;
+  }
 
-.search-label:first-of-type {
-  margin-left: 0;
-}
+  .search-label {
+    margin: 0 4px 0 12px;
+  }
 
-.right-header {
-  display: flex;
-  align-items: baseline;
-  justify-content: space-between;
-  margin-bottom: 10px;
-}
+  .search-label:first-of-type {
+    margin-left: 0;
+  }
 
-.right-header .title {
-  font-size: 16px;
-  font-weight: 600;
-}
+  .right-header {
+    display: flex;
+    align-items: baseline;
+    justify-content: space-between;
+    margin-bottom: 10px;
+  }
 
-.right-header .desc {
-  font-size: 13px;
-  color: #666;
-}
+  .right-header .title {
+    font-size: 16px;
+    font-weight: 600;
+  }
 
-.right-toolbar {
-  display: flex;
-  justify-content: flex-end;
-  gap: 10px;
-  margin-bottom: 10px;
-}
+  .right-header .desc {
+    font-size: 13px;
+    color: #666;
+  }
 
-.link-text {
-  color: #409eff;
-  cursor: default;
-}
+  .right-toolbar {
+    display: flex;
+    justify-content: flex-end;
+    gap: 10px;
+    margin-bottom: 10px;
+  }
 
-.clickable-link {
-  color: #409eff;
-  cursor: pointer;
-}
+  .link-text {
+    color: #409eff;
+    cursor: default;
+  }
 
-.clickable-link:hover {
-  text-decoration: underline;
-}
+  .clickable-link {
+    color: #409eff;
+    cursor: pointer;
+  }
 
-:deep(.row-center td) {
-  text-align: center !important;
-}
+  .clickable-link:hover {
+    text-decoration: underline;
+  }
 
-/* el-table 琛ㄥご/鍐呭缁熶竴灞呬腑锛坮ow-class-name 涓嶄綔鐢ㄤ簬琛ㄥご锛� */
-:deep(.center-table .el-table__header-wrapper th .cell) {
-  text-align: center !important;
-}
-:deep(.center-table .el-table__body-wrapper td .cell) {
-  text-align: center !important;
-}
+  :deep(.row-center td) {
+    text-align: center !important;
+  }
 
-/* PIMTable 琛ㄥご灞呬腑 */
-:deep(.lims-table .pim-table-header-cell) {
-  text-align: center;
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  justify-content: center;
-}
+  /* el-table 琛ㄥご/鍐呭缁熶竴灞呬腑锛坮ow-class-name 涓嶄綔鐢ㄤ簬琛ㄥご锛� */
+  :deep(.center-table .el-table__header-wrapper th .cell) {
+    text-align: center !important;
+  }
+  :deep(.center-table .el-table__body-wrapper td .cell) {
+    text-align: center !important;
+  }
 
-:deep(.lims-table .pim-table-header-title) {
-  text-align: center;
-  width: 100%;
-}
+  /* PIMTable 琛ㄥご灞呬腑 */
+  :deep(.lims-table .pim-table-header-cell) {
+    text-align: center;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    justify-content: center;
+  }
 
-:deep(.lims-table .pim-table-header-extra) {
-  width: 100%;
-  margin-top: 4px;
-}
+  :deep(.lims-table .pim-table-header-title) {
+    text-align: center;
+    width: 100%;
+  }
+
+  :deep(.lims-table .pim-table-header-extra) {
+    width: 100%;
+    margin-top: 4px;
+  }
 </style>

--
Gitblit v1.9.3