* [perf story #59018] Bind onBeforeRowDragEnd event for gantt.

This commit is contained in:
wangyidong
2024-07-15 10:04:18 +08:00
committed by 谢杞钰
parent 3ee1cfaadf
commit 6c10696cb5
+16 -3
View File
@@ -601,9 +601,6 @@ function initGantt()
loadPage($.createLink('review', 'create', 'projectID=' + projectID));
}
let taskID = 0;
if(ganttType == 'assignedTo') taskID = id;
/* The id of task item is like executionID-taskID. e.g. 1507-37829, 37829 is task id. */
let taskID = ganttType == 'assignedTo' ? id : 0;
let position = id.indexOf('-');
@@ -611,6 +608,22 @@ function initGantt()
if(!isNaN(taskID) && taskID > 0) zui.Modal.open({url: $.createLink('task', 'view', 'taskID=' + taskID, 'html', true), 'size': 'lg'});
});
gantt.attachEvent("onBeforeRowDragEnd", function(id, parent, tindex)
{
let tasks = gantt.getChildren(parent);
let task = gantt.getTask(id);
let link = $.createLink('programplan', 'ajaxResponseGanttMoveEvent');
//prevent moving to another position.
if(task.parent != parent || id.indexOf('-') == -1) return false;
$.post(link, {id: id, tasks: tasks});
return true;
});
/* Link attachEvent onAfterTaskDrag */
gantt.attachEvent("onBeforeTaskChanged", function(id, mode, task){return validateResources(id)});
}
$(function()