阳光彩印web 指标维护,工序只在类型为过程检验的时候选.新增要优化,不需要选类别
已修改3个文件
47 ■■■■■ 文件已修改
src/views/qualityManagement/metricMaintenance/ParamFormDialog.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/metricMaintenance/StandardFormDialog.vue 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/metricMaintenance/index.vue 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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'])
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 '复制检测标准'
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(() => {