From 71c7d498f12af37ba07ac844e6f3357191ac98c3 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 2 Apr 2026 00:34:22 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(mes):=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E6=A8=A1=E5=BC=8F=E4=B8=8B=E7=9A=84=E5=8F=AA?= =?UTF-8?q?=E8=AF=BB=E5=8A=9F=E8=83=BD=E5=8F=8A=E7=9B=B8=E5=85=B3=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mes/cal/plan/CalPlanForm.vue | 56 ++++++++++++++-------- src/views/mes/cal/plan/CalPlanTeamList.vue | 11 ++++- src/views/mes/cal/plan/CalShiftList.vue | 1 - src/views/mes/cal/plan/index.vue | 8 ++-- 4 files changed, 49 insertions(+), 27 deletions(-) diff --git a/src/views/mes/cal/plan/CalPlanForm.vue b/src/views/mes/cal/plan/CalPlanForm.vue index a911e37b2..2d8c275a8 100644 --- a/src/views/mes/cal/plan/CalPlanForm.vue +++ b/src/views/mes/cal/plan/CalPlanForm.vue @@ -6,6 +6,7 @@ :rules="formRules" label-width="100px" v-loading="formLoading" + :disabled="formType === 'detail'" > @@ -111,27 +112,32 @@ - - + + - + - + @@ -148,6 +154,7 @@ import { import CalShiftList from './CalShiftList.vue' import CalPlanTeamList from './CalPlanTeamList.vue' +// TODO @AI:isDetail,这种 compute 计算; defineOptions({ name: 'CalPlanForm' }) const { t } = useI18n() // 国际化 @@ -174,23 +181,27 @@ const formData = ref({ const formRules = reactive({ code: [{ required: true, message: '计划编码不能为空', trigger: 'blur' }], name: [{ required: true, message: '计划名称不能为空', trigger: 'blur' }], + calendarType: [{ required: true, message: '班组类型不能为空', trigger: 'change' }], startDate: [{ required: true, message: '开始日期不能为空', trigger: 'change' }], - endDate: [{ required: true, message: '结束日期不能为空', trigger: 'change' }] + endDate: [{ required: true, message: '结束日期不能为空', trigger: 'change' }], + shiftType: [{ required: true, message: '轮班方式不能为空', trigger: 'change' }] }) const formRef = ref() /** 生成计划编码 */ const generateCode = () => { + // TODO @AI:接入编码规则; formData.value.code = 'PLAN' + generateRandomStr(8) } /** 打开弹窗 */ const open = async (type: string, id?: number) => { dialogVisible.value = true - dialogTitle.value = t('action.' + type) + // TODO @AI:dialogtitle,通过 compute 实现; + dialogTitle.value = type === 'detail' ? '查看' : t('action.' + type) formType.value = type resetForm() - // 修改时,设置数据 + // 修改/查看时,设置数据 if (id) { formLoading.value = true try { @@ -223,11 +234,16 @@ const submitForm = async () => { } } -/** 确认计划 */ +/** 确认计划(先自动保存再确认) */ const handleConfirm = async () => { try { - await message.confirm('确认该排班计划?确认后将不可修改或删除。') + // 1. 先校验并保存表单 + await formRef.value.validate() formLoading.value = true + const data = formData.value as unknown as CalPlanVO + await CalPlanApi.updatePlan(data) + // 2. 再确认计划 + await message.confirm('确认该排班计划?确认后将不可修改或删除。') await CalPlanApi.confirmPlan(formData.value.id!) message.success('确认成功') dialogVisible.value = false diff --git a/src/views/mes/cal/plan/CalPlanTeamList.vue b/src/views/mes/cal/plan/CalPlanTeamList.vue index 3691876fc..af53663a8 100644 --- a/src/views/mes/cal/plan/CalPlanTeamList.vue +++ b/src/views/mes/cal/plan/CalPlanTeamList.vue @@ -2,10 +2,18 @@ + diff --git a/src/views/mes/cal/plan/CalShiftList.vue b/src/views/mes/cal/plan/CalShiftList.vue index a6d42bd3f..a46a6fbc9 100644 --- a/src/views/mes/cal/plan/CalShiftList.vue +++ b/src/views/mes/cal/plan/CalShiftList.vue @@ -40,7 +40,6 @@ - + +