vue2 甘特图 vxe-gantt 一行渲染多个子任务的配置

vue2 甘特图 vxe-gantt 一行渲染多个子任务的配置,但需要在父级任务直接显示所有子任务时,可以通过 task-bar-subview-config 和父级任务设置type= VxeGanttTaskType.Subview 来设置,会自动将所有子任务渲染到父级任务中

https://gantt.vxeui.com

设置 task-bar-subview-config.showOverview 设置是否任务总览,当子任务被展开后自动显示任务总览

html 复制代码
<template>
  <div>
    <vxe-gantt v-bind="ganttOptions"></vxe-gantt>
  </div>
</template>

<script>
import { VxeGanttTaskType } from 'vxe-gantt'

export default {
    data() {
        const ganttOptions = {
              border: true,
			  treeConfig: {
			    transform: true,
			    rowField: 'id',
			    parentField: 'parentId'
			  },
			  taskConfig: {
			    startField: 'start',
			    endField: 'end',
			    typeField: 'type',
			    progressField: 'progress'
			  },
			  taskBarSubviewConfig: {
			    showOverview: true 
			  },
			  taskBarConfig: {
			    showContent: true,
			    barStyle: {
			      round: true
			    }
			  },
			  taskViewConfig: {
			    tableStyle: {
			      width: 280
			    }
			  },
			  columns: [
			    { field: 'title', title: '任务名称', minWidth: 140, treeNode: true },
			    { field: 'start', title: '开始时间', width: 100 },
			    { field: 'end', title: '结束时间', width: 100 },
			    { field: 'progress', title: '进度(%)', width: 80 }
			  ],
			  data: [
			    { id: 10001, parentId: null, title: '我的项目1', start: '', end: '', progress: 0, type: VxeGanttTaskType.Subview },
			    { id: 10002, parentId: 10001, title: '我的项目2', start: '2024-03-02', end: '2024-03-05', progress: 70 },
			    { id: 10003, parentId: null, title: '我的项目3', start: '', end: '', progress: 0, type: VxeGanttTaskType.Subview },
			    { id: 10004, parentId: 10003, title: '我的项目4', start: '2024-03-03', end: '2024-03-04', progress: 50 },
			    { id: 10005, parentId: 10003, title: '我的项目5', start: '2024-03-05', end: '2024-03-06', progress: 50 },
			    { id: 10006, parentId: 10003, title: '我的项目6', start: '2024-03-08', end: '2024-03-11', progress: 60 },
			    { id: 10008, parentId: null, title: '我的项目7', start: '', end: '', progress: 0, type: VxeGanttTaskType.Subview },
			    { id: 10009, parentId: 10008, title: '我的项目8', start: '2024-03-07', end: '2024-03-09', progress: 50 },
			    { id: 10010, parentId: 10008, title: '我的项目9', start: '2024-03-10', end: '2024-03-12', progress: 50 },
			    { id: 10011, parentId: 10008, title: '我的项目10', start: '2024-03-13', end: '2024-03-15', progress: 50 }
			  ]
        };
        return {
            ganttOptions
        };
    }
};
</script>

https://gitee.com/x-extends/vxe-gantt

相关推荐
用户831348593069814 小时前
Cesium 实现行政区内部遮罩
vue.js·webgl·cesium
卤蛋fg614 小时前
vxe-table 自定义复制粘贴逻辑:精确控制单元格数据转换
vue.js
张人玉16 小时前
基于 Vue 3 + ECharts + Express + SQLite 构建的新能源汽车销量数据分析与可视化平台——新能源汽车销量数据分析系统
数据库·vue.js·sqlite·echarts
清风programmer19 小时前
H5与小程序通信
前端·vue.js·uni-app
Cobyte19 小时前
通过 Vite 运行手写的模板编译器
前端·javascript·vue.js
张人玉20 小时前
基于 Vue 3 + ECharts + Express + SQLite 构—— LDA 模型的新闻舆论主题识别与情感分析系统
vue.js·echarts·express
无人生还20 小时前
从 Vue3 到 React · 快速上手系列第 4 篇:条件渲染与列表渲染
前端·vue.js·react.js
咩咩啃树皮20 小时前
第46篇:Vue3 Router工程化进阶——懒加载+嵌套路由+全局守卫+权限控制
javascript·vue.js·ecmascript
咩咩啃树皮20 小时前
第44篇:Vue3侦听器完全精讲——watch与watchEffect区别、深度监听、异步业务落地
前端·javascript·vue.js
晓得迷路了21 小时前
栗子前端技术周刊第 139 期 - Nuxt 4.5、Vue 3.6 RC、Angular 发布节奏...
前端·javascript·vue.js