|
@@ -50,7 +50,7 @@ export function GanttChartDay(options) {
|
|
|
// 当前视图开始时间,向前推N天
|
|
|
this.startAt = moment().subtract(this.daysCount / 3, 'days');
|
|
|
this.endAt = moment(this.startAt).add(this.daysCount, 'days');
|
|
|
- this.graphDiv = document.getElementById(options['chartContainer']);
|
|
|
+ this.graphDiv = document.getElementById(options['chartParentContainer']);
|
|
|
// 图形容器组
|
|
|
this.graphGroup = null;
|
|
|
// 上一次拖动的事件
|
|
@@ -168,7 +168,7 @@ let lastClickAt = null;
|
|
|
* 改变graphDiv 滚动距离
|
|
|
* 到达边界距离后,刷新页面
|
|
|
*/
|
|
|
-GanttChartDay.prototype.doDrag = function(sEvent, eEvent) {
|
|
|
+GanttChartDay.prototype.doDrag = function(sEvent, eEvent) {
|
|
|
if (sEvent == null) {
|
|
|
sEvent = this.startEvent;
|
|
|
}
|
|
@@ -192,6 +192,7 @@ GanttChartDay.prototype.doDrag = function(sEvent, eEvent) {
|
|
|
this.offsetDis = this.viewWidth;
|
|
|
this.pageTo('next');
|
|
|
}
|
|
|
+ // console.log()
|
|
|
this.graphDiv.scrollLeft = this.offsetDis;
|
|
|
}
|
|
|
|
|
@@ -200,7 +201,7 @@ GanttChartDay.prototype.doDrag = function(sEvent, eEvent) {
|
|
|
*/
|
|
|
GanttChartDay.prototype.initDragHandler = function() {
|
|
|
this.graphDiv.scrollLeft = this.offsetDis;
|
|
|
- let _canvas = document.getElementsByTagName('canvas')[1];
|
|
|
+ let _canvas = this._canvas;
|
|
|
_canvas.addEventListener('mousedown', (ev) => {
|
|
|
this.draging = true;
|
|
|
this.startEvent = ev;
|
|
@@ -256,6 +257,7 @@ GanttChartDay.prototype.drawTimeZone = function() {
|
|
|
console.log('时间段', this.startAt.format('YYYY-MM-DD'),this.endAt.format('YYYY-MM-DD'));
|
|
|
let start = moment(this.startAt);
|
|
|
let timeGroup = this.gCanvas.addGroup();
|
|
|
+ this.timeGroupEl = timeGroup
|
|
|
timeGroup._tname = 'TimeGroup';
|
|
|
// 绘制第一级
|
|
|
timeGroup.addShape('text', {
|
|
@@ -464,19 +466,21 @@ GanttChartDay.prototype.drawTasks = function() {
|
|
|
taskGroup = this.graphGroup.addGroup();
|
|
|
taskGroup._tname = 'TaskGroup_' + topTask.id;
|
|
|
topTask.gGroup = taskGroup;
|
|
|
-
|
|
|
- // 组名背景矩形
|
|
|
- let TopGroupRectEl = taskGroup.addShape('rect', {
|
|
|
- attrs: {
|
|
|
- x: 0,
|
|
|
- y: topTask.renderOptions.startY,
|
|
|
- width: this.cWidth,
|
|
|
- height: this.taskRowHeight,
|
|
|
- fill: '#F5F6F7',
|
|
|
- radius: [2, 4],
|
|
|
- },
|
|
|
- });
|
|
|
- TopGroupRectEl.setZIndex(-1)
|
|
|
+
|
|
|
+ if (false) {
|
|
|
+ // 组名背景矩形
|
|
|
+ let TopGroupRectEl = taskGroup.addShape('rect', {
|
|
|
+ attrs: {
|
|
|
+ x: 0,
|
|
|
+ y: topTask.renderOptions.startY,
|
|
|
+ width: this.cWidth,
|
|
|
+ height: this.taskRowHeight,
|
|
|
+ fill: '#F5F6F7',
|
|
|
+ radius: [2, 4],
|
|
|
+ },
|
|
|
+ });
|
|
|
+ TopGroupRectEl.setZIndex(-1)
|
|
|
+ }
|
|
|
// 第二层循环,用于 区分具体多少任务,例如,维保-商管1/商管2...
|
|
|
topTask.dataList.forEach((taskP, index) => {
|
|
|
let taskPGroup = taskGroup.addGroup()
|