修复WBS编码: 分支1→分支1.1层级正确(prefix空字符串处理)
This commit is contained in:
@ -143,16 +143,15 @@ export default {
|
||||
const traverse = (tasks, prefix) => {
|
||||
if (!tasks) return;
|
||||
tasks.forEach((t, 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);
|
||||
const num = prefix ? `${prefix}.${i + 1}` : `${i + 1}`;
|
||||
map[t.id] = `分支 ${num}`;
|
||||
traverse(t.child_tasks, num);
|
||||
});
|
||||
};
|
||||
traverse(this.product.task_tree, '');
|
||||
this.product.task_tree.forEach((t, i) => {
|
||||
map[t.id] = '主分支';
|
||||
traverse(t.child_tasks, '');
|
||||
});
|
||||
return map;
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user