From 195770f92f7d739ffba6447fdbf3a3d5b9e009fa Mon Sep 17 00:00:00 2001
From: 张诺 <zhang_12370@163.com>
Date: 星期五, 24 四月 2026 16:32:57 +0800
Subject: [PATCH] fix(生产订单): 修复绑定工艺路线时的材料规格验证和显示问题

---
 src/views/qualityManagement/metricMaintenance/index.vue |  130 ++++++++++++++++++++++++++-----------------
 1 files changed, 78 insertions(+), 52 deletions(-)

diff --git a/src/views/qualityManagement/metricMaintenance/index.vue b/src/views/qualityManagement/metricMaintenance/index.vue
index 44d3fae..89cc08f 100644
--- a/src/views/qualityManagement/metricMaintenance/index.vue
+++ b/src/views/qualityManagement/metricMaintenance/index.vue
@@ -1,7 +1,14 @@
 <template>
   <div class="app-container metric-maintenance">
-    <!-- 宸︿晶锛氭娴嬫爣鍑嗗垪琛� -->
-    <div class="left-panel">
+    <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-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">
@@ -51,21 +58,6 @@
             @clear="handleQuery"
           />
         </template>
-        <template #inspectTypeHeader>
-          <el-select
-            v-model="searchForm.inspectType"
-            placeholder="绫诲埆"
-            clearable
-            size="small"
-            style="width: 120px"
-            @change="handleQuery"
-            @clear="handleQuery"
-          >
-            <el-option label="鍘熸潗鏂欐楠�" value="0" />
-            <el-option label="杩囩▼妫�楠�" value="1" />
-            <el-option label="鍑哄巶妫�楠�" value="2" />
-          </el-select>
-        </template>
         <template #stateHeader>
           <el-select
             v-model="searchForm.state"
@@ -82,10 +74,12 @@
           </el-select>
         </template>
       </PIMTable>
-    </div>
+        </div>
+      </el-col>
 
-    <!-- 鍙充晶锛氭爣鍑嗗弬鏁板垪琛� -->
-    <div class="right-panel">
+      <!-- 鍙充晶锛氭爣鍑嗗弬鏁板垪琛� -->
+      <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">
@@ -132,7 +126,9 @@
           </template>
         </el-table-column>
       </el-table>
-    </div>
+        </div>
+      </el-col>
+    </el-row>
 
     <!-- 鏂板 / 缂栬緫妫�娴嬫爣鍑� -->
     <StandardFormDialog
@@ -141,6 +137,7 @@
       :operation-type="standardOperationType"
       :form="standardForm"
       :rules="standardRules"
+      :inspect-type="activeTab"
       :process-options="processOptions"
       @confirm="submitStandardForm"
       @close="closeStandardDialog"
@@ -151,6 +148,7 @@
       ref="paramFormDialogRef"
       v-model="paramDialogVisible"
       :operation-type="paramOperationType"
+      :inspectType="activeTab.value"
       :form="paramForm"
       @confirm="submitParamForm"
       @close="closeParamDialog"
@@ -180,6 +178,9 @@
 import ParamFormDialog from './ParamFormDialog.vue'
 
 const { proxy } = getCurrentInstance()
+
+// 绫诲埆 Tab锛�0=鍘熸潗鏂欙紝1=杩囩▼锛�2=鍑哄巶锛�
+const activeTab = ref('0')
 
 // 宸︿晶鏍囧噯鍒楄〃锛氭暣琛屽唴瀹瑰眳涓紙閰嶅悎鏍峰紡锛�
 const rowClassNameCenter = () => 'row-center'
@@ -212,8 +213,17 @@
   standardRules: {
     standardNo: [{ required: true, message: '璇疯緭鍏ユ爣鍑嗙紪鍙�', trigger: 'blur' }],
     standardName: [{ required: true, message: '璇疯緭鍏ユ爣鍑嗗悕绉�', trigger: 'blur' }],
-    inspectType: [{ required: true, message: '璇烽�夋嫨妫�娴嬬被鍨�', trigger: 'change' }],
-    processId: [{ required: false, message: '璇烽�夋嫨宸ュ簭', trigger: 'change' }]
+    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'
+    }]
   }
 })
 
@@ -291,9 +301,9 @@
   {
     label: '绫诲埆',
     prop: 'inspectType',
-    headerSlot: 'inspectTypeHeader',
     align: 'center',
     dataType: 'tag',
+    minWidth: 120,
     formatData: (val) => {
       const map = {
         0: '鍘熸潗鏂欐楠�',
@@ -308,6 +318,7 @@
     prop: 'processId',
     align: 'center',
     dataType: 'tag',
+    visible: visible => activeTab.value === '1',
     formatData: (val) => {
       const target = processOptions.value.find(
         (item) => String(item.value) === String(val)
@@ -383,6 +394,19 @@
     ]
   }
 ])
+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 = () => {
@@ -576,8 +600,8 @@
       standardName: '',
       remark: '',
       state: '0',
-      inspectType: '',
-      processId: ''
+      inspectType: activeTab.value,
+      processId: activeTab.value === '1' ? '' : null
     })
   } else if (type === 'edit' && row) {
     Object.assign(standardForm.value, {
@@ -586,7 +610,7 @@
       inspectType: row.inspectType !== null && row.inspectType !== undefined ? String(row.inspectType) : '',
       state: row.state !== null && row.state !== undefined ? String(row.state) : '0',
       // 纭繚 processId 杞崲涓哄瓧绗︿覆鎴栨暟瀛楋紙鏍规嵁瀹為檯闇�瑕侊級
-      processId: row.processId !== null && row.processId !== undefined ? row.processId : ''
+      processId: String(row.inspectType) === '1' && row.processId !== null && row.processId !== undefined ? row.processId : null
     })
   } else if (type === 'copy' && row) {
     const { id, ...rest } = row
@@ -596,7 +620,8 @@
       standardNo: '',
       state: '0',
       // 纭繚 inspectType 杞崲涓哄瓧绗︿覆
-      inspectType: rest.inspectType !== null && rest.inspectType !== undefined ? String(rest.inspectType) : ''
+      inspectType: activeTab.value,
+      processId: activeTab.value === '1' ? (rest.processId ?? '') : null
     })
   }
   standardDialogVisible.value = true
@@ -609,6 +634,10 @@
 
 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(() => {
@@ -686,6 +715,7 @@
 }
 
 onMounted(() => {
+  searchForm.value.inspectType = activeTab.value
   getProcessList()
   getStandardList()
 })
@@ -693,39 +723,35 @@
 
 <style scoped>
 .metric-maintenance {
-  display: flex;
-  gap: 16px;
-  min-width: 0; /* 鍏佽 flex 瀛愬厓绱犳敹缂� */
+  padding: 0;
+  min-width: 0;
+}
+
+.metric-tabs {
+  margin: 10px;
+}
+
+.metric-maintenance-row {
+  width: 100%;
+}
+
+.metric-maintenance-row .left-col,
+.metric-maintenance-row .right-col {
+  margin-bottom: 16px;
 }
 
 .left-panel,
 .right-panel {
-  flex: 1;
-  min-width: 0; /* 鍏佽 flex 瀛愬厓绱犳敹缂� */
+  min-width: 0;
   background: #ffffff;
   padding: 16px;
   box-sizing: border-box;
-  overflow: hidden; /* 闃叉鍐呭婧㈠嚭 */
-}
-
-/* 浣庡垎杈ㄧ巼閫傞厤 */
-@media (max-width: 1400px) {
-  .metric-maintenance {
-    flex-direction: column;
-  }
-  
-  .left-panel,
-  .right-panel {
-    width: 100%;
-    min-width: 0;
-  }
+  overflow: hidden;
+  height: 100%;
+  min-height: 400px;
 }
 
 @media (max-width: 768px) {
-  .metric-maintenance {
-    gap: 12px;
-  }
-  
   .left-panel,
   .right-panel {
     padding: 12px;
@@ -831,4 +857,4 @@
   width: 100%;
   margin-top: 4px;
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3