This commit is contained in:
lzp
2026-03-13 16:33:23 +08:00
parent 33a35d556b
commit db06565dab
2 changed files with 29 additions and 26 deletions

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="node" :class="{ center: posCenter, mask: mask }"> <div class="node-el" :class="{ center: posCenter, mask: mask }">
<Handle <Handle
v-for="handle in handles[type] || []" v-for="handle in handles[type] || []"
:key="handle.id" :key="handle.id"
@@ -19,8 +19,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { Handle, Position } from '@vue-flow/core' import { Handle, Position } from '@vue-flow/core'
import { NODE_TYPE } from '../tools/index.d' import { NODE_DATATYPE, NODE_DATATIER, NODE_TYPE } from '../tools/index.d'
import { NODE_DATATYPE, NODE_DATATIER } from '../tools/index.d'
import { computed, ref, inject } from 'vue' import { computed, ref, inject } from 'vue'
const handles = ref({ const handles = ref({
[NODE_TYPE.INPUT]: [{ id: 'Right', type: 'source', position: Position.Right }], [NODE_TYPE.INPUT]: [{ id: 'Right', type: 'source', position: Position.Right }],
@@ -54,7 +53,10 @@
const isSubord = computed(() => nodes.value.some((v) => v.data.superiorID === props.node.id)) const isSubord = computed(() => nodes.value.some((v) => v.data.superiorID === props.node.id))
const tier = computed(() => Number(props.node?.data?.tier || 0)) const tier = computed(() => Number(props.node?.data?.tier || 0))
const isReturned = computed(() => { const isReturned = computed(() => {
return props.node.data.type == NODE_DATATYPE.RESULT_IMAGE && props.node.data.data.imageProcessTasks[0].status == 'RETURNED' return (
props.node.data.type == NODE_DATATYPE.RESULT_IMAGE &&
props.node.data.data.imageProcessTasks[0].status == 'RETURNED'
)
}) })
const isAdd = computed( const isAdd = computed(
() => () =>
@@ -66,7 +68,9 @@
const onAdd = () => { const onAdd = () => {
const tier_ = tier.value + 1 const tier_ = tier.value + 1
// dataoriginalImage // dataoriginalImage
let nodeData = props.node?.data?.data.imageProcessTasks.filter((v) => v.taskId === props.node?.data?.data.selectTaskId) let nodeData = props.node?.data?.data.imageProcessTasks.filter(
(v) => v.taskId === props.node?.data?.data.selectTaskId
)
const originalImage = nodeData[0]?.url const originalImage = nodeData[0]?.url
if (!originalImage) console.log('originalImage 找不到原始图片') if (!originalImage) console.log('originalImage 找不到原始图片')
props.stateManager.nodeManager.createCardsSelect({ props.stateManager.nodeManager.createCardsSelect({
@@ -80,7 +84,7 @@
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.node { .node-el {
position: relative; position: relative;
--top: 50px; --top: 50px;
&.mask *, &.mask *,

View File

@@ -17,7 +17,7 @@
:style="{ '--custom-cursor': stateManager.cursor.value }" :style="{ '--custom-cursor': stateManager.cursor.value }"
> >
<template v-for="v in nodeTypes" :key="v" #[`node-${v}`]="node"> <template v-for="v in nodeTypes" :key="v" #[`node-${v}`]="node">
<node <node-el
:type="v" :type="v"
:stateManager="stateManager" :stateManager="stateManager"
:node="node" :node="node"
@@ -41,7 +41,7 @@
@bring-to-font="bringToFont(node.id)" @bring-to-font="bringToFont(node.id)"
@send-to-back="sendToBack(node.id)" @send-to-back="sendToBack(node.id)"
/> />
</node> </node-el>
</template> </template>
</VueFlow> </VueFlow>
</div> </div>
@@ -73,13 +73,13 @@
// 工具 // 工具
import threeModel from './components/tools/threeModel/index.vue' import threeModel from './components/tools/threeModel/index.vue'
// 节点 // 节点
import node from './components/node.vue' import nodeEl from './components/node-el.vue'
import resultImage from './components/nodes/result-image.vue' import resultImage from './components/nodes/result-image.vue'
import card from './components/nodes/cards/index.vue' import card from './components/nodes/cards/index.vue'
import text from './components/nodes/text.vue' import text from './components/nodes/text.vue'
const components = { const components = {
[NODE_COMPONENT.RESULT_IMAGE]: text, [NODE_COMPONENT.RESULT_IMAGE]: resultImage,
[NODE_COMPONENT.CARD]: card, [NODE_COMPONENT.CARD]: card,
[NODE_COMPONENT.TEXT]: text [NODE_COMPONENT.TEXT]: text
} }
@@ -236,15 +236,14 @@
id: props.config.imgId, id: props.config.imgId,
url: props.config.url, url: props.config.url,
status: 'RETURNED', status: 'RETURNED',
taskId: timestamp + '', taskId: timestamp + ''
}, }
], ],
selectTaskId: timestamp + '', selectTaskId: timestamp + ''
} }
} }
}) })
} }
}) })
onBeforeMount(() => { onBeforeMount(() => {
stateManager.dispose() stateManager.dispose()