onAutoScheduleConflict
信息
此功能仅在 PRO 版本中可用。
Description
自動調度過程中發現的每個衝突都會觸發警報
onAutoScheduleConflict: (conflict: object) => void;
Parameters
conflict- (必填) object - 调度过程中发现的冲突。冲突的字段集合取决于冲突kind。
Example
gantt.attachEvent("onAutoScheduleConflict", function(conflict){
if (conflict.kind === "constraint-violation") {
console.warn(`Task ${conflict.taskId}: the ${conflict.constraintType} constraint could not be satisfied`);
}
});
Related samples
Details
注释
该事件在 auto_scheduling 扩展中定义,因此需要激活 auto_scheduling 插件。请在 Auto Scheduling 文章中阅读详细信息。
该事件会针对自动排程遇到的每一个冲突触发一次。自动排程仍然会产生一个结果——通过该事件可以在界面上暴露冲突或对其进行处理。
字段 conflict.kind 定义了冲突的类型以及可用字段:
kind | 说明 | 字段 |
|---|---|---|
"constraint-violation" | 任务在其计划位置所设定的约束无法被满足。 | taskId, constraintType, required (Date), actual (Date) |
"calendar-non-working" | 任务落在其非工作时间。仅在启用 strict_calendar 时报告。 | taskId, proposedDate (Date), snappedDate (Date) |
"unscheduled-dependency" | 任务依赖于尚未排程的任务。 | taskId, blockedBy |
依赖循环通过单独的 onAutoScheduleCircularLink 事件报告,而不是这里。
Related API
- auto_scheduling
- auto_scheduling_move_projects
- auto_scheduling_use_progress
- findCycles
- isCircularLink
- onAfterAutoSchedule
- onAfterTaskAutoSchedule
- onBeforeAutoSchedule
- onBeforeTaskAutoSchedule
- onAutoScheduleCircularLink
- onAutoScheduleNoConverge
Related Guides
Change log
- 于 10.0 版本新增
Need help?
Got a question about the documentation? Reach out to our technical support team for help and guidance. For custom component solutions, visit the Services page.