修复: 删除2D连线+spawn确认parent_task_id已正确+WBS算法重写(递归前缀)
This commit is contained in:
@ -130,17 +130,20 @@ export default {
|
||||
lockedTask() { return this.focusTasks.find(t => t.id === this.lockedTaskId) || null; },
|
||||
branchLabelsMap() {
|
||||
const map = {};
|
||||
const walk = (tasks, prefix, idx) => {
|
||||
if (!this.product || !this.product.task_tree) return map;
|
||||
const traverse = (tasks, prefix) => {
|
||||
if (!tasks) return;
|
||||
tasks.forEach((t, i) => {
|
||||
const label = prefix === '' ? '主分支' : `${prefix}${i + 1}`;
|
||||
map[t.id] = label;
|
||||
if (t.child_tasks && t.child_tasks.length) {
|
||||
walk(t.child_tasks, prefix === '' ? '' : `${label}.`, i);
|
||||
if (prefix === '') {
|
||||
map[t.id] = '主分支';
|
||||
} else {
|
||||
map[t.id] = `分支 ${prefix}${i + 1}`;
|
||||
}
|
||||
const nextPrefix = prefix === '' ? `${i + 1}.` : `${prefix}${i + 1}.`;
|
||||
traverse(t.child_tasks, nextPrefix);
|
||||
});
|
||||
};
|
||||
if (this.product) walk(this.product.task_tree, '', 0);
|
||||
traverse(this.product.task_tree, '');
|
||||
return map;
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user