fix
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { ref, computed } from "vue";
|
||||
import { NODE_TYPE } from '../tools/index.d'
|
||||
import { NODE_TYPE, NODE_DATATYPE } from '../tools/index.d'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import i18n from '@/lang'
|
||||
const t = i18n.global.t
|
||||
@@ -35,12 +35,14 @@ export class StateManager {
|
||||
flowManager: any
|
||||
nodeManager: any
|
||||
toolManager: any
|
||||
generateManager: any
|
||||
// 设置管理器
|
||||
setManager(options) {
|
||||
options.eventManager && (this.eventManager = options.eventManager)
|
||||
options.flowManager && (this.flowManager = options.flowManager)
|
||||
options.nodeManager && (this.nodeManager = options.nodeManager)
|
||||
options.toolManager && (this.toolManager = options.toolManager)
|
||||
options.generateManager && (this.generateManager = options.generateManager)
|
||||
}
|
||||
constructor(options) {
|
||||
this.vueFlow = options.vueFlow
|
||||
@@ -87,12 +89,14 @@ export class StateManager {
|
||||
source: source,
|
||||
target: target,
|
||||
selectable: false,
|
||||
visible: (node.data.type !== NODE_DATATYPE.RESULT_IMAGE || node.data.isActive),
|
||||
type: 'default'
|
||||
})
|
||||
}
|
||||
})
|
||||
return arr
|
||||
})
|
||||
window.nodes = this.nodes
|
||||
|
||||
}
|
||||
/** 设置激活节点 */
|
||||
@@ -132,7 +136,7 @@ export class StateManager {
|
||||
getNodeById(id: string) { return this.nodes.value.find((node: NodesItem) => node.id === id) }
|
||||
/** 获取下级节点 */
|
||||
getSubordNodeByID(id: string) { return this.nodes.value.find((node: NodesItem) => node.data.superiorID === id) }
|
||||
getLastNode() { return this.nodes.value[this.nodes.value.length - 1] }
|
||||
getLastNode() { console.log(this.nodes.value); return this.nodes.value[this.nodes.value.length - 1] }
|
||||
/** 设置工具 */
|
||||
setTool(tool: string) { this.tool.value = tool }
|
||||
/** 设置光标 */
|
||||
@@ -183,6 +187,20 @@ export class StateManager {
|
||||
this.nodes.value = JSON.parse(state.nodes)
|
||||
}
|
||||
|
||||
/** 显示指定子节点和父节点连接线,隐藏父节点和其他子节点链接线, */
|
||||
showNodeConnections(id: string) {
|
||||
const node = this.getNodeById(id)
|
||||
if(node.data.component != NODE_DATATYPE.RESULT_IMAGE && node.data.superiorID) return
|
||||
let edges_ = JSON.parse(JSON.stringify(this.edges.value))
|
||||
this.nodes.value.forEach((nodeItem) => {
|
||||
if(node.data.superiorID === nodeItem.data.superiorID && nodeItem.id == id) {
|
||||
nodeItem.data.isActive = true
|
||||
}else if(node.data.superiorID == nodeItem.data.superiorID){
|
||||
nodeItem.data.isActive = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
dispose() {
|
||||
this.historyList.value = []
|
||||
this.historyIndex.value = 0
|
||||
|
||||
Reference in New Issue
Block a user