From 529c2b0204fb8378e3baf2bf4d313e70a93f694a Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期三, 29 四月 2026 17:36:52 +0800
Subject: [PATCH] 更新工序选择逻辑,改用字典数据源 `product_process_type`,并调整相关字段以兼容后端接口

---
 src/views/qualityManagement/metricMaintenance/index.vue |   56 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/src/views/qualityManagement/metricMaintenance/index.vue b/src/views/qualityManagement/metricMaintenance/index.vue
index 5b2c6bd..a26f1d7 100644
--- a/src/views/qualityManagement/metricMaintenance/index.vue
+++ b/src/views/qualityManagement/metricMaintenance/index.vue
@@ -127,10 +127,10 @@
         <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 link type="primary" :disabled="isStandardReadonly" @click="openParamDialog('edit', row)">
               缂栬緫
             </el-button>
-            <el-button link type="danger" size="small" :disabled="isStandardReadonly" @click="handleParamDelete(row)">
+            <el-button link type="danger" :disabled="isStandardReadonly" @click="handleParamDelete(row)">
               鍒犻櫎
             </el-button>
           </template>
@@ -181,7 +181,6 @@
   qualityTestStandardParamUpdate,
   qualityTestStandardParamDel
 } from '@/api/qualityManagement/metricMaintenance.js'
-import { productProcessListPage } from '@/api/basicData/productProcess.js'
 import StandardFormDialog from './StandardFormDialog.vue'
 import ParamFormDialog from './ParamFormDialog.vue'
 
@@ -235,24 +234,14 @@
   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)
-  }
-}
+// 宸ュ簭涓嬫媺锛氭潵婧愪簬瀛楀吀 product_process_type
+const { product_process_type } = proxy.useDict('product_process_type')
+const processOptions = computed(() => {
+  return (product_process_type?.value || []).map(item => ({
+    label: item.label,
+    value: item.value
+  }))
+})
 
 // 褰撳墠閫変腑鐨勬爣鍑� & 鍙充晶璇︽儏
 const currentStandard = ref(null)
@@ -398,6 +387,9 @@
     current: page.current,
     size: page.size
   }
+  // processType锛氬瓧鍏� product_process_type 鐨� value
+  // 鍏煎锛氬鏋滃悗绔粛鎺ュ彈 processId锛岃繖閲屼袱鑰呴兘浼氬甫涓�
+  params.processType = params.processId
   qualityTestStandardListPage(params)
     .then((res) => {
       const records = res?.data?.records || []
@@ -432,6 +424,18 @@
 
 const handleSelectionChange = (selection) => {
   selectedRows.value = selection
+
+  if (!selection.length) {
+    currentStandard.value = null
+    detailTableData.value = []
+    return
+  }
+
+  const nextStandard = selection[selection.length - 1]
+  if (currentStandard.value?.id === nextStandard.id) return
+
+  currentStandard.value = nextStandard
+  loadDetail(nextStandard.id)
 }
 
 // 鎵归噺瀹℃牳锛氱姸鎬� 1=鎵瑰噯锛�2=鎾ら攢
@@ -615,6 +619,8 @@
 
 const submitStandardForm = () => {
   const payload = { ...standardForm.value }
+  // processType锛氬瓧鍏� product_process_type 鐨� value
+  payload.processType = payload.processId
   const isEdit = standardOperationType.value === 'edit'
   if (isEdit) {
     qualityTestStandardUpdate(payload).then(() => {
@@ -692,17 +698,11 @@
 }
 
 onMounted(() => {
-  getProcessList()
   getStandardList()
 })
 </script>
 
 <style scoped>
-.metric-maintenance {
-  padding: 0;
-  min-width: 0;
-}
-
 .metric-maintenance-row {
   width: 100%;
 }
@@ -829,4 +829,4 @@
   width: 100%;
   margin-top: 4px;
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3