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 | 104 +++++++++++++++++++++++++--------------------------
1 files changed, 51 insertions(+), 53 deletions(-)
diff --git a/src/views/qualityManagement/metricMaintenance/index.vue b/src/views/qualityManagement/metricMaintenance/index.vue
index 44d3fae..a26f1d7 100644
--- a/src/views/qualityManagement/metricMaintenance/index.vue
+++ b/src/views/qualityManagement/metricMaintenance/index.vue
@@ -1,7 +1,9 @@
<template>
<div class="app-container metric-maintenance">
- <!-- 宸︿晶锛氭娴嬫爣鍑嗗垪琛� -->
- <div class="left-panel">
+ <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">
@@ -82,10 +84,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">
@@ -123,16 +127,18 @@
<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>
</el-table-column>
</el-table>
- </div>
+ </div>
+ </el-col>
+ </el-row>
<!-- 鏂板 / 缂栬緫妫�娴嬫爣鍑� -->
<StandardFormDialog
@@ -175,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'
@@ -229,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)
@@ -392,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 || []
@@ -426,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=鎾ら攢
@@ -609,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(() => {
@@ -686,46 +698,32 @@
}
onMounted(() => {
- getProcessList()
getStandardList()
})
</script>
<style scoped>
-.metric-maintenance {
- display: flex;
- gap: 16px;
- min-width: 0; /* 鍏佽 flex 瀛愬厓绱犳敹缂� */
+.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 +829,4 @@
width: 100%;
margin-top: 4px;
}
-</style>
\ No newline at end of file
+</style>
--
Gitblit v1.9.3