1.0.14 • Published 1 year ago

tp-gantt v1.0.14

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

tp-gantt

(Vue仿Teambition甘特图 基于ts-gantt改造)

简介

甘特图(Gantt chart)称为横道图、条状图(Bar chart)、生产计划进度图。其通过条状图来显示项目,进度,和其他时间相关的系统进展的内在关系随着时间进展的情况。

快速上手

npm install --save tp-gantt

import tpGantt from 'tp-gantt'
import 'tp-gantt/lib/tp-gantt.css'

components: {
    tpGantt
}
npm run serve

文档

Attributes 参数

序号参数说明类型可选值默认值注意
1data数据Task[][]
2columns表格列字段数据Column[]任务标题、执行者、截止时间、前置依赖不传
3viewType视图类型string支持日视图(day)、周视图(week)、月视图(month)、季视图(quarter)、年视图(halfYear)dayTODO 待实现(增加该参数)
4translateDate甘特图时间偏移值支持dayjs对象 或标准时间字符串、日期对象、或ms时间戳当前时间TODO 待增加该参数
...其他控制字段(待开发)控制排序,是否可编辑等

数据类型定义要包含字段

Task 配置项

序号参数说明类型默认值
1children数据的子集children字段,表示为树表 必须字段Task[][]
2content任务描述的内容,任务标题列必须字段string
3executor执行人必须字段String
4startDate开始时间必须字段标准日期即可 string或Date
5endDate截止日期必须字段标准日期即可 string或Date
6collapsed是否折叠子任务booleanfalse
7color外部可根据状态定义条状图颜色string
7x : tring : any其他扩展字段用户自定义any

Column 配置项

序号参数说明类型默认值
1width列的宽度配置number
2minWidth列最小宽度number
3name列的字段名称string
4visible是否隐藏列(暂未支持)boolean
5sortable是否可排序(暂未支持)boolean

Events 事件

序号事件名说明回调参数
1onTaskCreate创建任务function(parent, task) 依次为任务数据与父级任务数据
3onTaskDelete删除任务function(task) 依次为当前任务行数据
4onTaskIndent任务左右移动切换父子任务function(parent, task) 依次为左右移动的父任务、与移动当前任务
5onTaskChangeContent任务内容发生变更function(task, content, oldContent) 依次为当前行数据
6onTaskTimeChange任务时间变更(时间dayjs类型)function(task, startDate, endDate) 依次为当前行数据
7onToDetail进入详情function(task) 当前行数据
8onDragSort拖拽排序function(preParent, parentTask, preIndex, index, handleTask) 移动前后父级任务及位置
9changeTaskType切换任务类型function(task) 当前行数据

Methods 方法

版本记录

1.0.9 增加连线功能(注:点击端点连线实现连线)

1.0.0 基于ts-gantt完善修改基础功能

1.0.14

1 year ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

3 years ago

1.0.83

3 years ago

1.0.82

3 years ago

1.0.81

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago