From 0a0cd5f165c730885e37b33ff93baca929e662c3 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 16 Mar 2026 23:28:27 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(mes):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E4=BB=BB=E5=8A=A1=E4=BF=9D=E5=AD=98=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E5=92=8C=E9=AA=8C=E8=AF=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 调整生产任务保存请求的字段为可选,简化编辑时的请求参数。更新任务验证逻辑,确保在更新时只校验存在的字段,提升用户体验和代码可维护性。同时,新增甘特图编辑页面,支持批量保存任务修改。 --- src/router/modules/remaining.ts | 106 ++++++++++-------- .../mes/pro/task/components/GanttChart.vue | 21 ++-- .../task/{GanttEdit.vue => edit/index.vue} | 65 +++++------ src/views/mes/pro/task/index.vue | 11 +- 4 files changed, 102 insertions(+), 101 deletions(-) rename src/views/mes/pro/task/{GanttEdit.vue => edit/index.vue} (51%) diff --git a/src/router/modules/remaining.ts b/src/router/modules/remaining.ts index b27fda30d..ac59b3ab0 100644 --- a/src/router/modules/remaining.ts +++ b/src/router/modules/remaining.ts @@ -127,43 +127,6 @@ const remainingRouter: AppRouteRecordRaw[] = [ } ] }, - { - path: '/mes', - component: Layout, - name: 'MesWmRouter', - meta: { - hidden: true - }, - children: [ - { - path: 'wm/warehouse/location', - component: () => import('@/views/mes/wm/warehouse/location/index.vue'), - name: 'MesWmLocation', - meta: { - noCache: true, - hidden: true, - canTo: true, - icon: '', - title: '库区设置', - activeMenu: '/mes/wm/warehouse' - } - }, - { - path: 'wm/warehouse/area', - component: () => import('@/views/mes/wm/warehouse/area/index.vue'), - name: 'MesWmArea', - meta: { - noCache: true, - hidden: true, - canTo: true, - icon: '', - title: '库位设置', - activeMenu: '/mes/wm/warehouse' - } - } - ] - }, - { path: '/codegen', component: Layout, @@ -270,6 +233,16 @@ const remainingRouter: AppRouteRecordRaw[] = [ noTagsView: true } }, + { + path: '/:pathMatch(.*)*', + component: () => import('@/views/Error/404.vue'), + name: '', + meta: { + title: '404', + hidden: true, + breadcrumb: false + } + }, { path: '/bpm', component: Layout, @@ -730,16 +703,6 @@ const remainingRouter: AppRouteRecordRaw[] = [ } ] }, - { - path: '/:pathMatch(.*)*', - component: () => import('@/views/Error/404.vue'), - name: '', - meta: { - title: '404', - hidden: true, - breadcrumb: false - } - }, { path: '/iot', component: Layout, @@ -782,6 +745,55 @@ const remainingRouter: AppRouteRecordRaw[] = [ component: () => import('@/views/iot/ota/firmware/detail/index.vue') } ] + }, + { + path: '/mes', + component: Layout, + name: 'MesWmRouter', + meta: { + hidden: true + }, + children: [ + { + path: 'wm/warehouse/location', + component: () => import('@/views/mes/wm/warehouse/location/index.vue'), + name: 'MesWmLocation', + meta: { + noCache: true, + hidden: true, + canTo: true, + icon: '', + title: '库区设置', + activeMenu: '/mes/wm/warehouse' + } + }, + { + path: 'wm/warehouse/area', + component: () => import('@/views/mes/wm/warehouse/area/index.vue'), + name: 'MesWmArea', + meta: { + noCache: true, + hidden: true, + canTo: true, + icon: '', + title: '库位设置', + activeMenu: '/mes/wm/warehouse' + } + }, + { + path: 'pro/task/gantt-edit', + component: () => import('@/views/mes/pro/task/edit/index.vue'), + name: 'MesProTaskGanttEdit', + meta: { + noCache: true, + hidden: true, + canTo: true, + icon: '', + title: '甘特图编辑', + activeMenu: '/mes/pro/task' + } + } + ] } ] diff --git a/src/views/mes/pro/task/components/GanttChart.vue b/src/views/mes/pro/task/components/GanttChart.vue index 3b57c9cbc..eba86b846 100644 --- a/src/views/mes/pro/task/components/GanttChart.vue +++ b/src/views/mes/pro/task/components/GanttChart.vue @@ -64,10 +64,16 @@ const initGantt = () => { gantt.config.show_progress = true // KTG 无显式设置,但 gantt 默认会渲染 progress。保留:确保进度条显示 gantt.config.open_tree_initially = true // 初始展开树结构。KTG 也有:open_tree_initially = true gantt.config.auto_types = false // 禁止自动升级为 project。KTG 也有:auto_types = false - gantt.config.drag_resize = false // 禁止调整任务持续时间 gantt.config.drag_move = false // 禁止拖动任务 - gantt.config.drag_progress = false // 禁止拖动进度条。KTG 也有:drag_progress = false - // 注:xml_date 是旧版写法,等价于 date_format(已在上方设置) + gantt.config.drag_resize = false // 禁止调整任务持续时间 + gantt.config.drag_progress = false // 禁止拖动进度条 + + // lightbox 弹窗配置:只保留时间编辑,去掉描述编辑和删除按钮 + gantt.config.lightbox.sections = [ + { name: 'time', type: 'duration', map_to: 'auto' } + ] + gantt.config.buttons_left = ['gantt_save_btn'] + gantt.config.buttons_right = ['gantt_cancel_btn'] // 时间刻度:周 > 日 > 8小时 const weekScaleTemplate = (date: Date) => { @@ -131,19 +137,18 @@ const initGantt = () => { } return '' } - gantt.templates.task_cell_class = () => '' // KTG 无此配置。保留:防止 gantt 添加默认样式类 + gantt.templates.timeline_cell_class = () => '' // 防止 gantt 添加默认样式类 gantt.templates.task_row_class = () => '' // KTG 无此配置。保留:防止 gantt 添加默认样式类 - // 事件监听 - // KTG 用 onAfterTaskUpdate 收集修改 id;这里用 onAfterTaskDrag 直接 emit 结构化数据,更完善 + // 编辑事件监听(通过 lightbox 弹窗编辑后触发) if (!props.readonly) { - gantt.attachEvent('onAfterTaskDrag', (id: string | number) => { + gantt.attachEvent('onAfterTaskUpdate', (id: string | number) => { const task = gantt.getTask(id) emit('task-update', { id: task.originalId || id, startTime: task.start_date, endTime: task.end_date, - duration: (task.duration as number) / 8 // 转回工作日 + duration: task.duration }) }) } diff --git a/src/views/mes/pro/task/GanttEdit.vue b/src/views/mes/pro/task/edit/index.vue similarity index 51% rename from src/views/mes/pro/task/GanttEdit.vue rename to src/views/mes/pro/task/edit/index.vue index 306ec90c7..fafd6eac9 100644 --- a/src/views/mes/pro/task/GanttEdit.vue +++ b/src/views/mes/pro/task/edit/index.vue @@ -1,16 +1,14 @@ - + - diff --git a/src/views/mes/pro/task/index.vue b/src/views/mes/pro/task/index.vue index 5724fca98..61bf06c42 100644 --- a/src/views/mes/pro/task/index.vue +++ b/src/views/mes/pro/task/index.vue @@ -149,10 +149,7 @@ /> - - -