From 696167a21c7a9d92834e9be097b52612ee39999c Mon Sep 17 00:00:00 2001
From: 张诺 <zhang_12370@163.com>
Date: 星期三, 22 四月 2026 11:24:52 +0800
Subject: [PATCH] 阳光彩印web 指标维护,工序只在类型为过程检验的时候选.新增要优化,不需要选类别

---
 src/views/qualityManagement/metricMaintenance/StandardFormDialog.vue |   15 +++++++--------
 src/views/qualityManagement/metricMaintenance/index.vue              |   28 ++++++++++++++++++++++------
 src/views/qualityManagement/metricMaintenance/ParamFormDialog.vue    |    4 +++-
 3 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/src/views/qualityManagement/metricMaintenance/ParamFormDialog.vue b/src/views/qualityManagement/metricMaintenance/ParamFormDialog.vue
index 4c958a0..e74f3b6 100644
--- a/src/views/qualityManagement/metricMaintenance/ParamFormDialog.vue
+++ b/src/views/qualityManagement/metricMaintenance/ParamFormDialog.vue
@@ -3,6 +3,7 @@
     v-model="dialogVisible"
     :title="computedTitle"
     :operation-type="operationType"
+    :inspectType="inspectType"
     width="520px"
     @close="emit('close')"
     @cancel="handleCancel"
@@ -40,7 +41,8 @@
 const props = defineProps({
   modelValue: { type: Boolean, default: false },
   operationType: { type: String, default: 'add' }, // add | edit
-  form: { type: Object, required: true }
+  form: { type: Object, required: true },
+  inspectType: { type: String, default: null },
 })
 
 const emit = defineEmits(['update:modelValue', 'close', 'cancel', 'confirm'])
diff --git a/src/views/qualityManagement/metricMaintenance/StandardFormDialog.vue b/src/views/qualityManagement/metricMaintenance/StandardFormDialog.vue
index 38d535a..0827a93 100644
--- a/src/views/qualityManagement/metricMaintenance/StandardFormDialog.vue
+++ b/src/views/qualityManagement/metricMaintenance/StandardFormDialog.vue
@@ -20,14 +20,7 @@
       <el-form-item label="鏍囧噯鍚嶇О" prop="standardName">
         <el-input v-model="form.standardName" placeholder="璇疯緭鍏ユ爣鍑嗗悕绉�" />
       </el-form-item>
-      <el-form-item label="绫诲埆" prop="inspectType">
-        <el-select v-model="form.inspectType" 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="processId">
+      <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"
@@ -84,6 +77,10 @@
   width: {
     type: String,
     default: '500px'
+  },
+  inspectType:{
+    type: String,
+    default: null
   }
 })
 
@@ -96,6 +93,8 @@
 
 const formRef = ref(null)
 
+const needProcess = computed(() => String(props.inspectType ?? '') === '1')
+
 const computedTitle = computed(() => {
   if (props.operationType === 'edit') return '缂栬緫妫�娴嬫爣鍑�'
   if (props.operationType === 'copy') return '澶嶅埗妫�娴嬫爣鍑�'
diff --git a/src/views/qualityManagement/metricMaintenance/index.vue b/src/views/qualityManagement/metricMaintenance/index.vue
index ee17428..6ea4afd 100644
--- a/src/views/qualityManagement/metricMaintenance/index.vue
+++ b/src/views/qualityManagement/metricMaintenance/index.vue
@@ -137,6 +137,7 @@
       :operation-type="standardOperationType"
       :form="standardForm"
       :rules="standardRules"
+      :inspect-type="activeTab"
       :process-options="processOptions"
       @confirm="submitStandardForm"
       @close="closeStandardDialog"
@@ -147,6 +148,7 @@
       ref="paramFormDialogRef"
       v-model="paramDialogVisible"
       :operation-type="paramOperationType"
+      :inspectType="activeTab.value"
       :form="paramForm"
       @confirm="submitParamForm"
       @close="closeParamDialog"
@@ -211,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'
+    }]
   }
 })
 
@@ -588,8 +599,8 @@
       standardName: '',
       remark: '',
       state: '0',
-      inspectType: '',
-      processId: ''
+      inspectType: activeTab.value,
+      processId: activeTab.value === '1' ? '' : null
     })
   } else if (type === 'edit' && row) {
     Object.assign(standardForm.value, {
@@ -598,7 +609,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
@@ -608,7 +619,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
@@ -621,6 +633,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(() => {

--
Gitblit v1.9.3