This commit is contained in:
X1627315083@163.com
2026-03-30 10:02:59 +08:00
parent c1aff5b566
commit 4c7cb4e01d
3 changed files with 5 additions and 6 deletions

View File

@@ -122,7 +122,7 @@
{ immediate: true } { immediate: true }
) )
const menus = ref([ const menus = ref([
{ label: 'Copy', tip: 'Ctrl+C', on: () => emit('copy-node', clickTaskId.value) }, { label: 'Copy', tip: 'Ctrl+C', on: () => emit('copy-node') },
{ {
label: 'Delete', label: 'Delete',
tip: 'Del', tip: 'Del',

View File

@@ -38,7 +38,7 @@
:data="node.data.data" :data="node.data.data"
v-bind="node.data" v-bind="node.data"
@delete-node="deleteNode(node.id)" @delete-node="deleteNode(node.id)"
@copy-node="copyNode($event, node.id)" @copy-node="copyNode(node.id)"
@update-data="(v) => (node.data.data = v)" @update-data="(v) => (node.data.data = v)"
@bring-to-font="bringToFont(node.id)" @bring-to-font="bringToFont(node.id)"
@send-to-back="sendToBack(node.id)" @send-to-back="sendToBack(node.id)"
@@ -179,8 +179,8 @@
nodeManager.deleteNode(id) nodeManager.deleteNode(id)
} }
/** 复制节点 */ /** 复制节点 */
const copyNode = (clickTaskId, id) => { const copyNode = (id) => {
nodeManager.copyNodeById(clickTaskId, id) nodeManager.copyNodeById(id)
} }
/** 节点zIndex设置最大 */ /** 节点zIndex设置最大 */
const bringToFont = (id) => { const bringToFont = (id) => {

View File

@@ -139,10 +139,9 @@ export class NodeManager {
return this.createNode(options_) return this.createNode(options_)
} }
copyNodeById(clickTaskId:string, id: string) { copyNodeById(id: string) {
const node = this.stateManager.getNodeById(id) const node = this.stateManager.getNodeById(id)
let copyNode = JSON.parse(JSON.stringify(node)) 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) const flowNode = this.stateManager.flowManager.getNodeById(id)
if (!node) return console.warn(`${id}找不到对应节点`) if (!node) return console.warn(`${id}找不到对应节点`)
if (node.data?.disableCopy) return console.warn(`${id}节点已禁用复制`) if (node.data?.disableCopy) return console.warn(`${id}节点已禁用复制`)