Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "fix: updateTaskRecord api #3639\n\n",
"type": "none",
"packageName": "@visactor/vtable"
}
],
"packageName": "@visactor/vtable",
"email": "892739385@qq.com"
}
5 changes: 0 additions & 5 deletions docs/assets/guide/en/gantt/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,6 @@ If there is no field data for the task date in the original data, you can create
The button style can be configured via `taskBar.scheduleCreation.buttonStyle`.

If the current configuration does not meet your needs, you can also customize the display effect of the creation schedule through the `taskBar.scheduleCreation.customLayout` configuration item.
**Note: Different Gantt chart instances have different capabilities to create schedules.**

When `tasksShowMode` is `TasksShowMode.Tasks_Separate` or `TasksShowMode.Sub_Tasks_Separate`, each piece of data has a corresponding row position display, but when there is no `startDate` and `endDate` field set in the data, a create button will appear when the mouse hovers over the row, and clicking the button will create a schedule and display the task bar.

When `tasksShowMode` is `TasksShowMode.Sub_Tasks_Inline`, `TasksShowMode.Sub_Tasks_Arrange`, or `TasksShowMode.Sub_Tasks_Compact`, a create button will be displayed when the mouse hovers over the blank area, and clicking the button will trigger the event `GANTT_EVENT_TYPE.CREATE_TASK_SCHEDULE`, but it will not actually create a task schedule. The user needs to listen for this event and create a schedule update data according to business needs.

**Note: Different Gantt chart instances have different capabilities to create schedules.**

Expand Down
5 changes: 0 additions & 5 deletions docs/assets/guide/zh/gantt/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,6 @@ links:[
按钮的样式可以通过`taskBar.scheduleCreation.buttonStyle`配置。

如果当前配置不能满足需求,也可以通过`taskBar.scheduleCreation.customLayout`配置项自定义创建排期的展示效果。
**注意:不同的甘特图实例,创建排期能力不同。:**

当`tasksShowMode`为`TasksShowMode.Tasks_Separate`或`TasksShowMode.Sub_Tasks_Separate`,也就是每条数据有对应的一行位置展示,但是数据中没有设置 startDate 和 endDate 的字段时,鼠标 hover 到该行会出现创建按钮,点击按钮会创建排期并展示任务条。

当`tasksShowMode`为`TasksShowMode.Sub_Tasks_Inline`或`TasksShowMode.Sub_Tasks_Arrange`或`TasksShowMode.Sub_Tasks_Compact`,需要明确指明 scheduleCreatable 为`true`,才可出现创建按钮。当鼠标 hover 到空白区域即会显示创建按钮,点击按钮会触发事件`GANTT_EVENT_TYPE.CREATE_TASK_SCHEDULE`但不会真正的创建任务排期,使用者需要监听该事件根据业务需求来自行创建排期更新数据。

**注意:不同的甘特图实例,创建排期能力不同。:**

Expand Down
26 changes: 14 additions & 12 deletions packages/vtable-gantt/src/Gantt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,10 @@ export class Gantt extends EventTarget {
this.data.adjustOrder(source_index, source_sub_task_index, target_index, target_sub_task_index);
}
// 定义多个函数签名
/** 更新数据信息 */
/** 更新数据信息
* 如果TasksShowModes是 tasks_separate 模式 则需要传入task_index即可
* 如果TasksShowModes是 sub_tasks_*** 模式 则需要传入task_index和sub_task_index
*/
updateTaskRecord(record: any, task_index: number | number[]): void;
updateTaskRecord(record: any, task_index: number, sub_task_index: number): void;
updateTaskRecord(record: any, task_index: number | number[], sub_task_index?: number) {
Expand All @@ -947,17 +950,16 @@ export class Gantt extends EventTarget {
this._refreshTaskBar(index, sub_index);
return;
}
const index = task_index as number;

// if (this.taskListTableInstance.rowHierarchyType === 'tree' && typeof index === 'number') {
// //如果是树形结构 需要获取数据源对应的索引
// index = this.taskListTableInstance.getRecordIndexByCell(
// 0,
// index + this.taskListTableInstance.columnHeaderLevelCount
// );
// }
this._updateRecordToListTable(record, index);
this._refreshTaskBar(index, undefined);
let recordIndexs: number | number[] = task_index;
if (this.taskListTableInstance.rowHierarchyType === 'tree') {
//如果是树形结构 需要获取数据源对应的索引
recordIndexs = this.taskListTableInstance.getRecordIndexByCell(
0,
task_index + this.taskListTableInstance.columnHeaderLevelCount
);
}
this._updateRecordToListTable(record, recordIndexs);
this._refreshTaskBar(task_index, undefined);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/vtable-gantt/src/scenegraph/task-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ export class TaskBar {
// clip: true
});
barGroupBox.name = 'task-bar';
//如果TaskShowMode是tasks_separate模式 这里的task_index其实是table中的bodyIndex;如果TaskShowMode是sub_tasks_***模式 task_index也是对应父节点任务条在table中的bodyIndex(但不会渲染父节点,只是渲染子节点)
barGroupBox.task_index = index;
//如果TaskShowMode是tasks_separate模式,不会赋值sub_task_index;如果TaskShowMode是sub_tasks_***模式 这里的sub_task_index是父节点下子元素的index
barGroupBox.sub_task_index = childIndex;
barGroupBox.record = taskRecord;

Expand Down
Loading