From d7d22b8a8f60a65c007852899d2396c684741869 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 24 Feb 2026 04:55:28 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(mes):=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E5=92=8C=E7=89=A9=E6=96=99=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E6=80=A7=E6=A0=A1=E9=AA=8C=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mes/qc/iqc/IqcForm.vue | 100 +++++++++++++++++-------------- src/views/mes/qc/iqc/index.vue | 8 ++- 2 files changed, 61 insertions(+), 47 deletions(-) diff --git a/src/views/mes/qc/iqc/IqcForm.vue b/src/views/mes/qc/iqc/IqcForm.vue index 7329a92b2..a77c167c1 100644 --- a/src/views/mes/qc/iqc/IqcForm.vue +++ b/src/views/mes/qc/iqc/IqcForm.vue @@ -8,6 +8,7 @@ :rules="formRules" label-width="120px" v-loading="formLoading" + :disabled="isDetail" > @@ -143,43 +144,41 @@ - + 缺陷情况 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -196,7 +195,9 @@ @@ -218,15 +219,21 @@ const { t } = useI18n() // 国际化 const message = useMessage() // 消息弹窗 const dialogVisible = ref(false) // 弹窗的是否展示 -const dialogTitle = ref('') // 弹窗的标题 const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 -const formType = ref('') // 表单的类型:create - 新增;update - 修改 +const formType = ref('') // 表单的类型:create - 新增;update - 修改;detail - 详情 const activeTab = ref('line') // 当前激活的标签页 - -/** 是否来自待检任务(有预填的来源单据信息) */ +const dialogTitle = computed(() => { + const titles = { + create: '新增来料检验单', + update: '修改来料检验单', + detail: '查看来料检验单' + } + return titles[formType.value] || t('action.' + formType.value) +}) // 弹窗标题,根据 formType 自动显示 +const isDetail = computed(() => formType.value === 'detail') // 表单是否为详情模式(只读) const isFromPendingTask = computed( () => formType.value === 'create' && formData.value.sourceDocId != null -) +) // 是否来自待检任务(有预填的来源单据信息) const formData = ref({ id: undefined as number | undefined, @@ -274,7 +281,6 @@ const generateCode = () => { /** 打开弹窗 */ const open = async (type: string, id?: number, data?: QcIqcVO) => { dialogVisible.value = true - dialogTitle.value = t('action.' + type) formType.value = type activeTab.value = 'line' resetForm() @@ -305,13 +311,15 @@ const submitForm = async () => { try { const data = formData.value as unknown as QcIqcVO if (formType.value === 'create') { - await QcIqcApi.createIqc(data) + const res = await QcIqcApi.createIqc(data) message.success(t('common.createSuccess')) + // 新增成功后,切换到修改模式,设置 id + formData.value.id = res + formType.value = 'update' } else { await QcIqcApi.updateIqc(data) message.success(t('common.updateSuccess')) } - dialogVisible.value = false // 发送操作成功的事件 emit('success') } finally { diff --git a/src/views/mes/qc/iqc/index.vue b/src/views/mes/qc/iqc/index.vue index e2438fd97..de11ee875 100644 --- a/src/views/mes/qc/iqc/index.vue +++ b/src/views/mes/qc/iqc/index.vue @@ -115,7 +115,13 @@ - + + +