- link_class: (link: any) => {
- // console.log(link)
- const {type} = link;
- return `link-type-${type}`;
- },
-
-
-
- target.forEach((linkId: any) => {
- const link = this.gantt.getLink(linkId);
- const {
- sourceTask,
- targetTask,
- type,
- } = this.getSourceTaskAndTargetTaskByLink(link);
- switch (type) {
- case LinkType.fs:
- if ( +targetTask.start_date < +sourceTask.end_date ) {
- fsLimit(task, sourceTask);
- }
- break;
- case LinkType.ss:
- if (+targetTask.start_date > +sourceTask.start_date) {
- limitLeft(task, targetTask);
- }
- break;
- case LinkType.ff:
- if (+targetTask.end_date > +sourceTask.end_date) {
- limitRight(task, targetTask);
- }
- break;
- case LinkType.sf:
- if (+targetTask.start_date > +sourceTask.end_date) {
- limitRight(task, targetTask);
- }
- break;
- default:
- break;
- }
-
-
- fsMoveLimit(task: any, limit: any) {
- const dur = task.end_date - task.start_date;
- if (task.type === GANTT_TYPE.计划 && limit.type === GANTT_TYPE.计划) {
- task.start_date = new Date(limit.end_date);
- task.end_date = new Date(limit.start_date + dur);
- }
- if (task.type === GANTT_TYPE.计划 && limit.type === GANTT_TYPE.里程碑) {
- task.start_date = new Date(limit.end_date);
- task.end_date = new Date(limit.start_date + dur);
- }
- if (task.type === GANTT_TYPE.里程碑 && limit.type === GANTT_TYPE.里程碑) {
- task.start_date = new Date(limit.start_date);
- }
- if (task.type === GANTT_TYPE.里程碑 && limit.type === GANTT_TYPE.计划) {
- task.start_date = new Date(limit.end_date);
- }
- }
- fsResizeLimit(task: any, limit: any) {
- const dur = task.end_date - task.start_date;
- if (task.type === GANTT_TYPE.计划 && limit.type === GANTT_TYPE.计划) {
- task.start_date = new Date(limit.end_date);
- }
- if (task.type === GANTT_TYPE.计划 && limit.type === GANTT_TYPE.里程碑) {
- task.start_date = new Date(limit.end_date);
- }
- }
-
-
-
- .gantt_task_link.link-type-0 .gantt_line_wrapper:nth-of-type(2)::before{
- content: "fs";
- position: absolute;
- top: 10px;
- left: 15px;
- font-size: 16px;
- }
- .gantt_task_link.link-type-1 .gantt_line_wrapper:nth-of-type(2)::before{
- content: "ss";
- position: absolute;
- top: 10px;
- left: 15px;
- font-size: 16px;
- }
- .gantt_task_link.link-type-2 .gantt_line_wrapper:nth-of-type(2)::before{
- content: "ff";
- position: absolute;
- top: 10px;
- left: 15px;
- font-size: 16px;
- }
- .gantt_task_link.link-type-3 .gantt_line_wrapper:nth-of-type(2)::before{
- content: "sf";
- position: absolute;
- top: 10px;
- left: 15px;
- font-size: 16px;
- }