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

相关推荐
qq8406122332 小时前
Nodejs+vue基于elasticsearch的高校科研期刊信息管理系统_mb8od
前端·vue.js·elasticsearch
程序员林北北7 小时前
【前端进阶之旅】Svelte:编译即框架,让前端开发回归简洁
前端·javascript·vue.js·react.js·html5
pas1369 小时前
46-mini-vue 实现编译 template 为 render 函数
前端·javascript·vue.js
左夕9 小时前
深度解析vue的生命周期
vue.js
随逸17710 小时前
《彻底解决CSS冲突!模块化CSS实战指南》
vue.js·react.js
筱筱°10 小时前
创建一个基于 Vue 的微前端项目
vue.js·微前端
爱看书的小沐12 小时前
【小沐杂货铺】基于Three.js渲染三维无人机Drone(WebGL / vue / react )
javascript·vue.js·react.js·无人机·webgl·three.js·drone
ShenJLLL19 小时前
vue部分知识点.
前端·javascript·vue.js·前端框架
HelloReader1 天前
Tauri 2 创建项目全流程create-tauri-app 一键脚手架 + Tauri CLI 手动接入
前端·javascript·vue.js
哆啦A梦15881 天前
Vue3魔法手册 作者 张天禹 016_vue3中一些特定用法介绍
前端·vue.js·typescript