This commit is contained in:
X1627315083@163.com
2026-03-13 15:13:09 +08:00
parent 1333a885d1
commit dc0e5df212
3 changed files with 5 additions and 6 deletions

View File

@@ -135,7 +135,6 @@
const nodes = computed(() => stateManager.nodes_.value)
const edges = computed(() => stateManager.edges.value)
const edges_ = computed(() => {
console.log(123)
return edges.value.filter((v) => v?.visible)
})
const nodesDraggable = computed(() => stateManager.nodesDraggable.value)

View File

@@ -43,13 +43,11 @@ export class NodeManager {
/** 创建节点 */
createNode(options: NodeOptions) {
console.log(1)
const superiorID = options?.data?.superiorID
const snode = superiorID ? this.stateManager.flowManager.getNodeById(superiorID) : this.stateManager.flowManager.getLastNode();
const id = options.id || createId()
const positionX = options.positionX || 0
const positionY = options.positionY || 0
console.log(2)
const position = options.position ||
(!snode ?
{ x: positionX, y: positionY } :
@@ -64,9 +62,7 @@ export class NodeManager {
position,
data
}
console.log(3)
this.addNode(options_)
console.log(4)
return options_;
}
/** 创建结果节点 */
@@ -83,7 +79,6 @@ export class NodeManager {
...(options?.data || {}),
},
}
console.log(11)
return this.createNode(options_)
}
/** 创建卡片选择节点 */

View File

@@ -58,7 +58,9 @@ export class StateManager {
this.activeNodeID = ref("")
this.nodes = ref<NodesItem[]>([]);
this.nodes_ = computed(() => {
console.log(1)
return this.nodes.value.map((node, index) => {
console.log(2)
const obj = node;
const superiorID = node.data.superiorID;
const isSuperior = this.nodes.value.some((v) => v.id === superiorID)
@@ -72,12 +74,14 @@ export class StateManager {
} else {// 其他情况-没有上级 没有下级
obj.type = NODE_TYPE.ALONE;
}
console.log(22)
return obj
})
})
this.edges = computed(() => {
const arr = []
console.log(3)
this.nodes.value.forEach((node, index) => {
const superiorID = node.data.superiorID;
const isSuperior = this.nodes.value.some((v) => v.id === superiorID)
@@ -94,6 +98,7 @@ export class StateManager {
})
}
})
console.log(4)
return arr
})
window.nodes = this.nodes