111
This commit is contained in:
@@ -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,9 +68,11 @@
|
|||||||
const onAdd = () => {
|
const onAdd = () => {
|
||||||
const tier_ = tier.value + 1
|
const tier_ = tier.value + 1
|
||||||
// 从data中获取originalImage
|
// 从data中获取originalImage
|
||||||
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({
|
||||||
data: { tier: tier_, superiorID: props.node.id, originalImage }
|
data: { tier: tier_, superiorID: props.node.id, originalImage }
|
||||||
})
|
})
|
||||||
@@ -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 *,
|
||||||
@@ -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"
|
||||||
@@ -36,12 +36,12 @@
|
|||||||
: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($event, 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)"
|
||||||
/>
|
/>
|
||||||
</node>
|
</node-el>
|
||||||
</template>
|
</template>
|
||||||
</VueFlow>
|
</VueFlow>
|
||||||
</div>
|
</div>
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
@home="() => fitView({ maxZoom: 1 })"
|
@home="() => fitView({ maxZoom: 1 })"
|
||||||
/>
|
/>
|
||||||
<image-preview ref="imagePreviewRef" />
|
<image-preview ref="imagePreviewRef" />
|
||||||
<baseModal ref="threeModelRef" >
|
<baseModal ref="threeModelRef">
|
||||||
<threeModel />
|
<threeModel />
|
||||||
</baseModal>
|
</baseModal>
|
||||||
</template>
|
</template>
|
||||||
@@ -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
|
||||||
}
|
}
|
||||||
@@ -144,7 +144,7 @@
|
|||||||
const { layout } = useLayout()
|
const { layout } = useLayout()
|
||||||
const index = ref(0)
|
const index = ref(0)
|
||||||
async function layoutGraph(direction) {
|
async function layoutGraph(direction) {
|
||||||
if(props.config.json > 0)return
|
if (props.config.json > 0) return
|
||||||
if (index.value > 0) return
|
if (index.value > 0) return
|
||||||
index.value++
|
index.value++
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -173,8 +173,8 @@
|
|||||||
nodeManager.deleteNode(id)
|
nodeManager.deleteNode(id)
|
||||||
}
|
}
|
||||||
/** 复制节点 */
|
/** 复制节点 */
|
||||||
const copyNode = (clickTaskId,id) => {
|
const copyNode = (clickTaskId, id) => {
|
||||||
nodeManager.copyNodeById(clickTaskId,id)
|
nodeManager.copyNodeById(clickTaskId, id)
|
||||||
}
|
}
|
||||||
/** 节点zIndex设置最大 */
|
/** 节点zIndex设置最大 */
|
||||||
const bringToFont = (id) => {
|
const bringToFont = (id) => {
|
||||||
@@ -221,9 +221,9 @@
|
|||||||
// window['vueFlow'] = vueFlow
|
// window['vueFlow'] = vueFlow
|
||||||
// window['nodes'] = nodes
|
// window['nodes'] = nodes
|
||||||
|
|
||||||
if(props.config.json.length > 0){
|
if (props.config.json.length > 0) {
|
||||||
importFlow(props.config.json)
|
importFlow(props.config.json)
|
||||||
}else{
|
} else {
|
||||||
const timestamp = Date.now()
|
const timestamp = Date.now()
|
||||||
nodeManager.createResultNode({
|
nodeManager.createResultNode({
|
||||||
data: {
|
data: {
|
||||||
@@ -231,20 +231,19 @@
|
|||||||
isHeader: false,
|
isHeader: false,
|
||||||
data: {
|
data: {
|
||||||
selectable: false,
|
selectable: false,
|
||||||
imageProcessTasks:[
|
imageProcessTasks: [
|
||||||
{
|
{
|
||||||
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()
|
||||||
|
|||||||
Reference in New Issue
Block a user