fix
This commit is contained in:
33
src/components/Canvas/FlowCanvas/manager/GenerateManager.ts
Normal file
33
src/components/Canvas/FlowCanvas/manager/GenerateManager.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { getTaskidResult } from '@/api/flow-canvas'
|
||||
interface NodeOptions {
|
||||
id?: string
|
||||
position?: { x: number, y: number }
|
||||
positionX?: number
|
||||
positionY?: number
|
||||
component?: any
|
||||
}
|
||||
|
||||
export class GenerateManager {
|
||||
stateManager: any
|
||||
taskIds: string[] = []
|
||||
constructor(options) {
|
||||
this.stateManager = options.stateManager;
|
||||
}
|
||||
|
||||
/** 删除taskId */
|
||||
deleteTaskId(taskId: string) {
|
||||
|
||||
}
|
||||
/** 添加taskId */
|
||||
addTaskId(TaskId: any) {
|
||||
this.stateManager.addTaskId(TaskId)
|
||||
}
|
||||
/** 添加taskId */
|
||||
async getTasksIdImg(list) {
|
||||
let taskIds = list.map((item)=>item.taskId)
|
||||
getTaskidResult({taskIds}).then((rv)=>{
|
||||
console.log(rv)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ interface NodeData {
|
||||
superiorID?: string// 上级节点ID
|
||||
disableDelete?: boolean// 是否禁用删除
|
||||
disableCopy?: boolean// 是否禁用复制
|
||||
originalImage?: string// 要进行生成的图片
|
||||
}
|
||||
interface NodeOptions {
|
||||
id?: string
|
||||
@@ -113,13 +114,15 @@ export class NodeManager {
|
||||
return this.createNode(options_)
|
||||
}
|
||||
|
||||
copyNodeById(id: string) {
|
||||
copyNodeById(clickTaskId:string, id: string) {
|
||||
const node = this.stateManager.getNodeById(id)
|
||||
let copyNode = JSON.parse(JSON.stringify(node))
|
||||
copyNode.data.data.imageProcessTasks = copyNode.data.data.imageProcessTasks.filter((item:any)=>item.taskId == clickTaskId)
|
||||
const flowNode = this.stateManager.flowManager.getNodeById(id)
|
||||
if (!node) return console.warn(`${id}找不到对应节点`)
|
||||
if (node.data?.disableCopy) return console.warn(`${id}节点已禁用复制`)
|
||||
const node_ = {
|
||||
...JSON.parse(JSON.stringify(node)),
|
||||
...copyNode,
|
||||
id: createId(),
|
||||
position: {
|
||||
x: node.position.x,
|
||||
|
||||
Reference in New Issue
Block a user