|
@@ -114,7 +114,7 @@
|
|
|
};
|
|
};
|
|
|
// 条形图里的文字
|
|
// 条形图里的文字
|
|
|
gantt.templates.task_text = function (start, end, task) {
|
|
gantt.templates.task_text = function (start, end, task) {
|
|
|
- return `<div style='text-align:left;'> 名称:${task.executor}</div>`;
|
|
|
|
|
|
|
+ return `<div style='text-align:left;'> ${task.title}名称:${task.executor}</div>`;
|
|
|
};
|
|
};
|
|
|
// 条形图自定义class
|
|
// 条形图自定义class
|
|
|
gantt.templates.task_class = function (start, end, task) {
|
|
gantt.templates.task_class = function (start, end, task) {
|
|
@@ -139,16 +139,16 @@
|
|
|
});
|
|
});
|
|
|
// 自定义tooltip内容
|
|
// 自定义tooltip内容
|
|
|
gantt.templates.tooltip_text = function (start, end, task) {
|
|
gantt.templates.tooltip_text = function (start, end, task) {
|
|
|
- // <p style="margin: 4px 0;">当前进度:${
|
|
|
|
|
- // task.level == 5
|
|
|
|
|
- // ? proStatusEnum[task.status]?.label
|
|
|
|
|
- // : task.progress * 100 + '%'
|
|
|
|
|
- // }</p>
|
|
|
|
|
- // <p style="margin: 4px 0;">标准工时:${task.standardTime}</p>
|
|
|
|
|
- // <p style="margin: 4px 0;">实际工时:${task.actualTime}</p>
|
|
|
|
|
|
|
+ // <p style="margin: 4px 0;">当前进度:${
|
|
|
|
|
+ // task.level == 5
|
|
|
|
|
+ // ? proStatusEnum[task.status]?.label
|
|
|
|
|
+ // : task.progress * 100 + '%'
|
|
|
|
|
+ // }</p>
|
|
|
|
|
+ // <p style="margin: 4px 0;">标准工时:${task.standardTime}</p>
|
|
|
|
|
+ // <p style="margin: 4px 0;">实际工时:${task.actualTime}</p>
|
|
|
const t = gantt;
|
|
const t = gantt;
|
|
|
return `<div style="font-size:14px;padding: 0 10px;width:250px;line-height:20px;white-space:normal;">
|
|
return `<div style="font-size:14px;padding: 0 10px;width:250px;line-height:20px;white-space:normal;">
|
|
|
- <p style="font-weight:bold;margin: 8px 0;">名称:${task.text}</p>
|
|
|
|
|
|
|
+ <p style="font-weight:bold;margin: 8px 0;">${task.title}名称:${task.text}</p>
|
|
|
|
|
|
|
|
<p style="margin: 4px 0;">状态:${proStatusEnum[task.status]?.label}</p>
|
|
<p style="margin: 4px 0;">状态:${proStatusEnum[task.status]?.label}</p>
|
|
|
</div>`;
|
|
</div>`;
|
|
@@ -206,29 +206,26 @@
|
|
|
initData() {
|
|
initData() {
|
|
|
this.ganttData = this.ganttTasks.map((current, ind, arry) => {
|
|
this.ganttData = this.ganttTasks.map((current, ind, arry) => {
|
|
|
let newObj = {};
|
|
let newObj = {};
|
|
|
- if (current.level) {
|
|
|
|
|
- //存在type字段 说明非一级菜单,判断阶段的具体类型 设置不同颜色
|
|
|
|
|
- if (current.level == 1) {
|
|
|
|
|
- //项目
|
|
|
|
|
- newObj = Object.assign({}, current, { color: '#fcca02' });
|
|
|
|
|
- } else if (current.level == 2) {
|
|
|
|
|
- //项目阶段
|
|
|
|
|
- newObj = Object.assign({}, current, { color: '#fec0dc' });
|
|
|
|
|
- } else if (current.level == 3) {
|
|
|
|
|
- //计划
|
|
|
|
|
- newObj = Object.assign({}, current, { color: '#62ddd4' });
|
|
|
|
|
- } else if (current.level == 4) {
|
|
|
|
|
- //计划节点
|
|
|
|
|
- newObj = Object.assign({}, current, { color: '#d1a6ff' });
|
|
|
|
|
- } else if (current.level == 5) {
|
|
|
|
|
- //任务
|
|
|
|
|
- newObj = Object.assign({}, current, { color: '#0e85fa' });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (current.type == 0) {
|
|
|
|
|
+ //项目
|
|
|
|
|
+ newObj = Object.assign({}, current, { color: '#fcca02',title:'项目' });
|
|
|
|
|
+ } else if (current.type == 2) {
|
|
|
|
|
+ //项目阶段
|
|
|
|
|
+ newObj = Object.assign({}, current, { color: '#fec0dc',title:'阶段' });
|
|
|
|
|
+ } else if (current.type == 3) {
|
|
|
|
|
+ //计划
|
|
|
|
|
+ newObj = Object.assign({}, current, { color: '#62ddd4',title:'计划' });
|
|
|
|
|
+ } else if (current.type == 4) {
|
|
|
|
|
+ //计划节点
|
|
|
|
|
+ newObj = Object.assign({}, current, { color: '#d1a6ff',title:'计划节点' });
|
|
|
|
|
+ } else if (current.type == 5) {
|
|
|
|
|
+ //任务
|
|
|
|
|
+ newObj = Object.assign({}, current, { color: '#0e85fa',title:'任务' });
|
|
|
} else {
|
|
} else {
|
|
|
//默认色
|
|
//默认色
|
|
|
- newObj = Object.assign({}, current, { color: '#5b0b83' });
|
|
|
|
|
|
|
+ newObj = Object.assign({}, current, { color: '#5b0b83',title:'项目BOM' });
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
return newObj;
|
|
return newObj;
|
|
|
});
|
|
});
|
|
|
console.log(this.ganttData);
|
|
console.log(this.ganttData);
|