1.1.2 • Published 3 years ago

wyg-gantt v1.1.2

Weekly downloads
145
License
ISC
Repository
-
Last release
3 years ago

wyg-gantt

简介

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

本插件基于wl-gantt技术支持,如有侵权请联系

邮箱704429524@qq.com

已支持el-table参数及事件列表

    :fit="fit"
    :size="size"
    :border="border"
    :data="selfData"
    :stripe="stripe"
    :height="height"
    :row-key="rowKey"
    :row-style="rowStyle"
    :class="dateTypeClass"
    :cell-style="cellStyle"
    :max-height="maxHeight"
    :tree-props="selfProps"
    :current-row-key="rowKey"
    :row-class-name="rowClassName"
    :cell-class-name="cellClassName"
    :expand-row-keys="expandRowKeys"
    :header-row-style="headerRowStyle"
    :header-cell-style="headerCellStyle"
    :default-expand-all="defaultExpandAll"
    :header-row-class-name="headerRowClassName"
    :highlight-current-row="highlightCurrentRow"
    :header-cell-class-name="headerCellClassName"
    :currentPage="pages.currentPage"
    :pageSizes="pages.pageSizes"
    :pageSize="pages.pageSize"
    :total="pages.total"
    @header-contextmenu="handleHeaderContextMenu"
    @selection-change="handleSelectionChange"
    @row-contextmenu="handleRowContextMenu"
    @current-change="handleCurrentChange"
    @cell-mouse-enter="handleMouseEnter"
    @cell-mouse-leave="handleMouseLeave"
    @expand-change="handleExpandChange"
    @filter-change="handleFilterChange"
    @cell-dblclick="handleCellDbClick"
    @header-click="handleHeaderClick"
    @row-dblclick="handleRowDbClick"
    @sort-change="handleSortChange"
    @cell-click="handleCellClick"
    @select-all="handleSelectAll"
    @row-click="handleRowClick"
    @select="handleSelect"
    @rowClick="rowClick"
    @current-change-page="currentChange"

快速上手

npm i wyg-gantt --save

npm i wyg-gantt -S

import wygGantt from "wyg-gantt/src/pages/wl-gantt" components:{wygGantt},

Attributes 参数

序号参数说明类型可选值默认值注意
1data数据Array-[]-
2dateTypegantt图区日期表头类型StringmonthAndDay、yearAndMonth、yearAndDayyearAndMonth-
3treeProps树表配置项Object--见下方props
4startDate项目开始时间String、Object必填-注意:不要求任务时间线在项目开始时间内,并且当任务时间超出项目时间时,将更新项目时间
5endDate项目结束时间String、Object必填-注意:不要求任务时间线在项目开始时间内,并且当任务时间超出项目时间时,将更新项目时间
6checkSource是否检查源数据符合规则Boolean--检查源数据为自动修改不符合规范的时间为符合规则的期望值
7treatIdAsIdentityId是否使用id来作为自增idBoolean-false如果是请保证id本来就简短的数字型而不是较长的字符串或guid
8autoGanttDateType自动调整gantt时间跨度类型,具体规则见版本记录1Boolean-true-
9nameFormatter名称列格式化内容函数Function--Function(row, column, cellValue, index)
10其他Table Attributes文档地址----
11usePreColumn是否使用内置前置任务列Boolean-false-
12preMultiple前置任务是否可以多选Boolean-true如果开启多选则pre字段必须是Array,否则可以是Number\String
13preFormatter前置内容列格式化函数Function--如不传则根据prop name字段+,拼接
14emptyCellText空值单元格占位符String-'-'-
15useCheckColumn是否使用内置复选框列Boolean-false-
16useIndexColumn是否使用内置序号列Boolean-false-
17edit是否可编辑Boolean-true-
18parentChild使用复选框时,是否父子关联Boolean-true必须配置props的id、children字段
19ganttOnly是否只显示图形Boolean-false-
20lazy同el-tableBoolean-false-
21load同el-tableFunction---
22contextMenuOptions右键浮窗配置项,如果存在则点击gantt右键显示配置的浮窗信息Array--数组内对象属性有: @param {String} label 展示名称 @param {String} prop 绑定的字段 * @param {String} icon 可选 字体图标class
23useRealTime是否使用实际开始时间、实际结束时间,开启则在计划时间蓝色条外展示实际时间棕红色条Boolean-false-
24color项目开始时间颜色String-blue-
25realColor时间开发时间颜色String-pick-
26otherColor其他时间颜色String-black-
27alreadyColor真实开发时间颜色String-green-
28currentPage状态布局String-center-
29pageSizes每页显示个数选择器的选项设置Array-10, 20, 30, 50, 100-
30pageSize每页显示条目个数Number-10-
31total总条目数Number-0-

props 配置项

序号参数说明默认值
1children数据的子集children字段,表示为树表children
2name用于显示名字的字段name
3id每条数据的id,必须唯一id
4pid每条数据的父节点id字段pid
5startDate每条数据的开始时间字段startDate
6endDate每条数据的结束时间字段endDate
7identityId数据自增ididentityId
8parents自增父级id树,逗号分隔parents
9pre前置任务字段,字段值应是前置任务的idpre
10hasChildren指定哪些行是包含子节点hasChildren
11realStartDate实际开始时间字段realEndDate
12realEndDate实际结束时间字段realEndDate

Events 事件

序号事件名说明回调参数
1timeChange当任务时间发生更改时触发function(row) 依次为当前行数据
2其他Table Events文档地址--
3preChange前置任务修改事件function(row) 依次为当前行数据
4nameChange名称修改事件function(row) 依次为当前行数据
5taskAdd添加任务事件function(row) 依次为当前行数据
6taskRemove删除任务事件function(row) 依次为当前行数据
7rowClick右键点击事件function(row) 依次为当前行数据
8current-change-pagecurrentPage 改变时会触发function(row) 当前页
9size-changecurrentPage 改变时会触发function(row) 每页条数

Methods 方法

序号方法名说明回调参数
1loadTree手动调用树表懒加载function(row) 依次为要展开的行信息
2loadTreeAdd更新树表懒加载后的子节点function(id, list) 依次为要更新的节点id,要添加的子节点list,注意此为合并list和原来的子节点数据
3loadTreeRemove移除懒加载数据的子节点function(id, list) 依次为要更新的节点id,要删掉的子字节的rowKey
1.1.1

3 years ago

1.1.2

3 years ago

1.1.0

3 years ago

1.0.9

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.2

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

0.1.6

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.5

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago