修复: 删除2D连线+spawn确认parent_task_id已正确+WBS算法重写(递归前缀)
This commit is contained in:
@ -17,9 +17,6 @@
|
||||
:style="{ width: canvasWidth + 'px', height: canvasHeight + 'px' }"
|
||||
>
|
||||
<view class="canvas-inner">
|
||||
<!-- 连线层 -->
|
||||
<view v-for="line in treeLines" :key="line.key" class="canvas-line" :style="lineStyle(line)"></view>
|
||||
|
||||
<!-- 节点卡片层 -->
|
||||
<view v-for="node in treeNodes" :key="node.id"
|
||||
class="canvas-node" :class="statusColor(node.status)"
|
||||
@ -62,7 +59,6 @@ export default {
|
||||
|
||||
const CARD_W = 320, CARD_H = 460, GAP_X = 80, GAP_Y = 120;
|
||||
const nodes = [];
|
||||
nodes._lines = [];
|
||||
|
||||
// 按行组织:每行是一个 { y, tasks: [...] }
|
||||
const rows = [];
|
||||
@ -80,18 +76,6 @@ export default {
|
||||
const node = { ...t, x, y: 0, _rowIdx: rowIdx, _xEnd: x + CARD_W };
|
||||
row.tasks.push(node);
|
||||
nodes.push(node);
|
||||
|
||||
// 连线到父节点
|
||||
if (t.parent_task_id) {
|
||||
const parent = nodes.find(n => n.id === t.parent_task_id);
|
||||
if (parent) {
|
||||
nodes._lines.push({
|
||||
key: parent.id + '-' + t.id,
|
||||
x1: parent.x + CARD_W / 2, y1: parent.y + CARD_H,
|
||||
x2: node.x + CARD_W / 2, y2: node.y,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 递归子任务
|
||||
@ -122,7 +106,6 @@ export default {
|
||||
if (this.product) walk(this.product.task_tree);
|
||||
return map;
|
||||
},
|
||||
treeLines() { return this.treeNodes._lines || []; },
|
||||
canvasWidth() { if (!this.treeNodes.length) return 400; return Math.max(800, Math.max(...this.treeNodes.map(n => n.x)) + 300); },
|
||||
canvasHeight() { if (!this.treeNodes.length) return 400; return Math.max(800, Math.max(...this.treeNodes.map(n => n.y)) + 300); }
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user