网站首页

人工智能P2P分享Wind搜索发布信息网站地图标签大全

当前位置:诺佳网 > 软件工程 > 前端开发 > Vue >

vue甘特图 vxe-gantt 如何将子任务显示一行在父级中

时间:2026-01-29 20:47

人气:

作者:admin

标签:

导读:vue甘特图 vxe-gantt 如何将子任务显示一行在父级中,父级行内渲染显示子任务的用法,行内展示子任务由 task-bar-subview-config 和父级任务设置type= VxeGanttTaskType.Subview 来启用。启用后会将所...

vue甘特图 vxe-gantt 如何将子任务显示一行在父级中,父级行内渲染显示子任务的用法,行内展示子任务由 task-bar-subview-config 和父级任务设置type= VxeGanttTaskType.Subview 来启用。启用后会将所有子任务渲染到父级任务中,可以直观的看到任务全程进度, task-bar-subview-config.showOverview 设置是否任务总览,当子任务被展开后自动显示任务总览

https://gantt.vxeui.com

当没展开子任务时,自动将所有子任务渲染到父级中。可以直接看到任务总览

image

展开子任务后,自动按每行渲染任务条

image

还可以通过 task-bar-config.barStyle.overviewBgColor 自定义总览任务条颜色

<template>
  <div>
    <vxe-gantt v-bind="ganttOptions"></vxe-gantt>
  </div>
</template>

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

const ganttOptions = reactive({
  border: true,
  height: 500,
  treeConfig: {
    transform: true,
    rowField: 'id',
    parentField: 'parentId'
  },
  taskBarSubviewConfig: {
    showOverview: true
  },
  taskBarConfig: {
    showContent: true,
    barStyle: {
      round: true,
      bgColor: '#65c16f',
      overviewBgColor: '#59885e'
    }
  },
  taskViewConfig: {
    tableStyle: {
      width: 380
    }
  },
  columns: [
    { field: 'title', title: '任务名称', minWidth: 140, treeNode: true },
    { field: 'start', title: '开始时间', width: 100 },
    { field: 'end', title: '结束时间', width: 100 }
  ],
  data: [
    { id: 10001, parentId: null, title: '项目1', start: '', end: '', progress: 0, type: VxeGanttTaskType.Subview },
    { id: 10002, parentId: 10001, title: '项目2', start: '2024-03-03', end: '2024-03-08', progress: 70 },
    { id: 10003, parentId: null, title: '项目3', start: '', end: '', progress: 0, type: VxeGanttTaskType.Subview },
    { id: 10004, parentId: 10003, title: '项目4', start: '2024-03-05', end: '2024-03-08', progress: 50 },
    { id: 10006, parentId: 10003, title: '项目5', start: '2024-03-13', end: '2024-03-21', progress: 60 },
    { id: 10008, parentId: null, title: '项目6', start: '', end: '', progress: 0, type: VxeGanttTaskType.Subview },
    { id: 10009, parentId: 10008, title: '项目7', start: '2024-03-11', end: '2024-03-13', progress: 50 },
    { id: 10009, parentId: 10008, title: '项目8', start: '2024-03-14', end: '2024-03-16', progress: 50 },
    { id: 10009, parentId: 10008, title: '项目9', start: '2024-03-17', end: '2024-03-20', progress: 50 }
  ]
})
</script>

image

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

温馨提示:以上内容整理于网络,仅供参考,如果对您有帮助,留下您的阅读感言吧!
相关阅读
本类排行
相关标签
本类推荐

CPU | 内存 | 硬盘 | 显卡 | 显示器 | 主板 | 电源 | 键鼠 | 网站地图

Copyright © 2025-2035 诺佳网 版权所有 备案号:赣ICP备2025066733号
本站资料均来源互联网收集整理,作品版权归作者所有,如果侵犯了您的版权,请跟我们联系。

关注微信