From 62edc8fceb830c85f2a81a525fb9dbbefaac7153 Mon Sep 17 00:00:00 2001
From: yaowanxin <3588231647@qq.com>
Date: 星期五, 30 一月 2026 17:10:55 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_New' into dev_New

---
 src/views/qualityManagement/metricBinding/index.vue |  156 ++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 132 insertions(+), 24 deletions(-)

diff --git a/src/views/qualityManagement/metricBinding/index.vue b/src/views/qualityManagement/metricBinding/index.vue
index 80eb66f..2a78e1d 100644
--- a/src/views/qualityManagement/metricBinding/index.vue
+++ b/src/views/qualityManagement/metricBinding/index.vue
@@ -1,7 +1,9 @@
 <template>
   <div class="app-container metric-binding">
-    <!-- 宸︿晶锛氭娴嬫爣鍑嗗垪琛紙鍙锛� -->
-    <div class="left-panel">
+    <el-row :gutter="16" class="metric-binding-row">
+      <!-- 宸︿晶锛氭娴嬫爣鍑嗗垪琛� -->
+      <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"
@@ -10,6 +12,7 @@
         :isSelection="false"
         :rowClassName="rowClassNameCenter"
         :tableLoading="tableLoading"
+        :rowClick="handleTableRowClick"
         @pagination="handlePagination"
         :total="page.total"
       >
@@ -71,10 +74,12 @@
           </el-select>
         </template>
       </PIMTable>
-    </div>
+        </div>
+      </el-col>
 
-    <!-- 鍙充晶锛氱粦瀹氬垪琛� -->
-    <div class="right-panel">
+      <!-- 鍙充晶锛氱粦瀹氬垪琛� -->
+      <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">
@@ -107,7 +112,9 @@
           </template>
         </el-table-column>
       </el-table>
-    </div>
+        </div>
+      </el-col>
+    </el-row>
 
     <!-- 娣诲姞缁戝畾寮规 -->
     <el-dialog
@@ -151,6 +158,7 @@
 import {
   qualityTestStandardListPage
 } from '@/api/qualityManagement/metricMaintenance.js'
+import { productProcessListPage } from '@/api/basicData/productProcess.js'
 import {
   qualityTestStandardBindingList,
   qualityTestStandardBindingAdd,
@@ -177,19 +185,56 @@
 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, headerSlot: 'standardNoHeader' },
-  { label: '鏍囧噯鍚嶇О', prop: 'standardName', minWidth: 180, headerSlot: 'standardNameHeader' },
+  { label: '鏍囧噯缂栧彿', prop: 'standardNo', dataType: 'slot', slot: 'standardNoCell', minWidth: 160, align: 'center', headerSlot: 'standardNoHeader' },
+  { label: '鏍囧噯鍚嶇О', prop: 'standardName', minWidth: 180, align: 'center', headerSlot: 'standardNameHeader' },
   {
-    label: '妫�娴嬬被鍨�',
+    label: '绫诲埆',
     prop: 'inspectType',
     headerSlot: 'inspectTypeHeader',
+    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',
@@ -269,6 +314,13 @@
     })
 }
 
+// 琛ㄦ牸琛岀偣鍑伙紝鍔犺浇鍙充晶缁戝畾鍒楄〃
+const handleTableRowClick = (row) => {
+  currentStandard.value = row
+  loadBindingList()
+}
+
+// 宸︿晶琛岀偣鍑伙紝鍔犺浇鍙充晶缁戝畾鍒楄〃锛堜繚鐣欑敤浜庢爣鍑嗙紪鍙峰垪鐨勭偣鍑伙級
 const handleStandardRowClick = (row) => {
   currentStandard.value = row
   loadBindingList()
@@ -282,7 +334,13 @@
   bindingLoading.value = true
   qualityTestStandardBindingList({ testStandardId: currentStandard.value.id })
     .then((res) => {
-      bindingTableData.value = res?.data || []
+      const base = res?.data || []
+      // 灏嗗綋鍓嶆爣鍑嗙殑宸ュ簭鍜屽娉ㄥ甫鍒扮粦瀹氬垪琛ㄤ腑灞曠ず
+      bindingTableData.value = base.map((item) => ({
+        ...item,
+        processId: currentStandard.value?.processId,
+        remark: currentStandard.value?.remark
+      }))
     })
     .finally(() => {
       bindingLoading.value = false
@@ -323,15 +381,21 @@
 }
 
 const handleUnbind = async (row) => {
-  if (!row?.id) return
+  const id = row?.id ?? row?.qualityTestStandardBindingId
+  if (id == null || id === '') return
   try {
     await ElMessageBox.confirm('纭鍒犻櫎璇ョ粦瀹氾紵', '鎻愮ず', { type: 'warning' })
   } catch {
     return
   }
-  await qualityTestStandardBindingDel([row.qualityTestStandardBindingId])
-  proxy.$message.success('鍒犻櫎鎴愬姛')
-  loadBindingList()
+  try {
+    await qualityTestStandardBindingDel([id])
+    proxy.$message.success('鍒犻櫎鎴愬姛')
+    loadBindingList()
+  } catch (err) {
+    console.error('鍒犻櫎缁戝畾澶辫触:', err)
+    proxy.$message?.error(err?.message || '鍒犻櫎澶辫触')
+  }
 }
 
 const handleBatchUnbind = async () => {
@@ -339,34 +403,59 @@
     proxy.$message.warning('璇烽�夋嫨鏁版嵁')
     return
   }
-  const ids = bindingSelectedRows.value.map((i) => i.qualityTestStandardBindingId)
+  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
   }
-  await qualityTestStandardBindingDel(ids)
-  proxy.$message.success('鍒犻櫎鎴愬姛')
-  loadBindingList()
+  try {
+    await qualityTestStandardBindingDel(ids)
+    proxy.$message.success('鍒犻櫎鎴愬姛')
+    loadBindingList()
+  } catch (err) {
+    console.error('鎵归噺鍒犻櫎缁戝畾澶辫触:', err)
+    proxy.$message?.error(err?.message || '鍒犻櫎澶辫触')
+  }
 }
 
 onMounted(() => {
   getStandardList()
+  getProcessList()
 })
 </script>
 
 <style scoped>
 .metric-binding {
-  display: flex;
-  gap: 16px;
+  padding: 0;
+}
+
+.metric-binding-row {
+  width: 100%;
+}
+
+.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;
 }
 
 .left-panel,
 .right-panel {
-  flex: 1;
-  background: #ffffff;
-  padding: 16px;
-  box-sizing: border-box;
+  height: 100%;
 }
 
 .toolbar {
@@ -429,4 +518,23 @@
 :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;
+}
+
+: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