zhangwencui
59 分钟以前 f08a81f01bc4a4104dd9ef04e071bb0bd0eb8afe
src/views/mes/pro/task/components/gantt-chart.vue
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { onBeforeUnmount, onMounted, ref, watch } from 'vue';
import { BarcodeBizTypeEnum } from '../../../../../packages/constants/src';
import { BarcodeBizTypeEnum } from '@vben/constants';
import { gantt } from 'dhtmlx-gantt';
@@ -13,7 +13,7 @@
 * 1. 按订单分组展示生产任务,订单为 project 行,任务为子行
 * 2. 支持只读预览和拖拽编辑两种模式
 * 3. 拖拽后触发 taskUpdate 事件,通知父组件批量保存
 * 4. 时间刻度:周 → 日 → 8 小时(1 工作日 = 8 小时)
 * 4. 时间刻度:周 → 日 → 小时
 */
defineOptions({ name: 'GanttChart', inheritAttrs: false });
@@ -47,8 +47,8 @@
  gantt.config.readonly = props.readonly;
  gantt.config.date_format = '%Y-%m-%d %H:%i:%s';
  gantt.config.duration_unit = 'hour'; // 持续时间单位为小时,配合 duration_step 实现工作日单位
  gantt.config.duration_step = 8; // 1 工作日 = 8 小时
  gantt.config.duration_unit = 'hour'; // 持续时间单位为小时
  gantt.config.duration_step = 1; // duration 字段即为实际小时数
  gantt.config.row_height = 36;
  gantt.config.bar_height = 24;
  gantt.config.fit_tasks = true;
@@ -70,7 +70,7 @@
  gantt.config.buttons_left = ['gantt_save_btn'];
  gantt.config.buttons_right = ['gantt_cancel_btn'];
  // 时间刻度:周 > 日 > 8 小时
  // 时间刻度:周 > 日 > 小时
  const weekScaleTemplate = (date: Date) => {
    const dateToStr = gantt.date.date_to_str('%M %d');
    const endDate = gantt.date.add(gantt.date.add(date, 1, 'week'), -1, 'day');
@@ -82,7 +82,7 @@
  gantt.config.scales = [
    { unit: 'week', step: 1, format: weekScaleTemplate },
    { unit: 'day', step: 1, format: dayTemplate, css: daysStyle },
    { unit: 'hour', step: 8, format: '%H:%i' },
    { unit: 'hour', step: 1, format: '%H:%i' },
  ];
  gantt.config.scale_height = 50;
  gantt.config.show_task_cells = true;