跳到主要内容

getTaskBaselines

信息

此功能仅包含在PRO版本中。

Description

从数据存储中返回特定任务的基线数组

getTaskBaselines: (taskId: string | number) => Baseline[]

Parameters

  • taskId - (required) string | number - 任务 ID

Returns

  • param - (Baseline[]) - Baseline 对象数组

Example

gantt.getTaskBaselines(5); // -> 查看详情

Details

注释

如果关闭了 baselines 配置,getTaskBaselines 方法将无法使用。

此方法返回一个包含基线对象的数组,每个对象具有以下属性:

  • id - (string | number) - 基线 ID
  • task_id - (string | number) - 该基线所属任务的 ID
  • start_date - (Date) - 基线的开始日期
  • duration - (number) - 基线的持续时间
  • end_date - (Date | number) - 基线的结束日期
  • [customProperty: string] - (any) - 任意自定义属性
  • className - (string | number) - 此属性的值被 Gantt 用作 HTML 元素的自定义类名

例如:

[
{
task_id: 5,
id: 1,
duration: 2,
start_date: "03-04-2019 00:00",
end_date: "05-04-2019 00:00"
},
{
task_id: 5,
id: 2,
duration: 1,
start_date: "06-04-2019 00:00",
end_date: "07-04-2019 00:00"
}
]

Change log

  • 新增于 v9.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.