diff --git a/src/components/Canvas/FlowCanvas/components/cards/cards-select.vue b/src/components/Canvas/FlowCanvas/components/cards/cards-select.vue index 637de8e..e2933d9 100644 --- a/src/components/Canvas/FlowCanvas/components/cards/cards-select.vue +++ b/src/components/Canvas/FlowCanvas/components/cards/cards-select.vue @@ -55,7 +55,8 @@ const id = props.node.id if (!id) return stateManager.deleteNode(id) - nodeManager.createCardNode({ data: { type: v.type } }) + const superiorID = props.node.data.superiorID + nodeManager.createCardNode({ data: { type: v.type, superiorID } }) } defineExpose({}) diff --git a/src/components/Canvas/FlowCanvas/components/cards/index.vue b/src/components/Canvas/FlowCanvas/components/cards/index.vue index 9319afb..d2875b4 100644 --- a/src/components/Canvas/FlowCanvas/components/cards/index.vue +++ b/src/components/Canvas/FlowCanvas/components/cards/index.vue @@ -83,6 +83,7 @@ } ] const nodeManager = inject('nodeManager') as any + const stateManager = inject('stateManager') as any const props = defineProps({ type: { type: String as () => @@ -107,15 +108,22 @@ const componentRef = ref(null) const onGenerateClick = () => { const data = { ...componentRef.value.data } + const subordNode = stateManager.getSubordNodeByID(attrs.node.id) if (attrs.node.data) attrs.node.data.data = data - nodeManager.createResultNode({ - data: { - tier: currentComponent.value.tier, + if (!subordNode) { + nodeManager.createResultNode({ data: { - url: 'https://s3-alpha-sig.figma.com/img/ea2f/590e/9638f62a2fc91e31f33db0022db1642c?Expires=1773014400&Key-Pair-Id=APKAQ4GOSFWCW27IBOMQ&Signature=M0B8oJJOk~dGG0aZAqOIocAp7T0LFdJ9FYmCrEZVTCRzYxM6SJRNtYMTX-rTO3Z~s14QINh~o-S41XiZnBv-0zcKjuWot~VVaNHfd0~1LesfNe2KwvCinT~72btFut1pheLnKE-wWCX5ewtonxU77bnw386YPMTqv7DBZzksf2udsJA7NmOYD6~TUG3Q2dWSt~zPH~lkaidscPqpCnCbqzljCEi4RiHY4U3A45l5XypcX2umqn1UaYUFCTqV9471J4qdB6Dg2pcKocdp-7-3s1De6Q~2SmBOrSgDQ~KEADCB2lhKfhxgWmy0lwMvhTd4l90ygVZDWZRABgjHNrGUvg__' + superiorID: attrs.node.id, + tier: currentComponent.value.tier, + data: { + url: 'https://s3-alpha-sig.figma.com/img/ea2f/590e/9638f62a2fc91e31f33db0022db1642c?Expires=1773014400&Key-Pair-Id=APKAQ4GOSFWCW27IBOMQ&Signature=M0B8oJJOk~dGG0aZAqOIocAp7T0LFdJ9FYmCrEZVTCRzYxM6SJRNtYMTX-rTO3Z~s14QINh~o-S41XiZnBv-0zcKjuWot~VVaNHfd0~1LesfNe2KwvCinT~72btFut1pheLnKE-wWCX5ewtonxU77bnw386YPMTqv7DBZzksf2udsJA7NmOYD6~TUG3Q2dWSt~zPH~lkaidscPqpCnCbqzljCEi4RiHY4U3A45l5XypcX2umqn1UaYUFCTqV9471J4qdB6Dg2pcKocdp-7-3s1De6Q~2SmBOrSgDQ~KEADCB2lhKfhxgWmy0lwMvhTd4l90ygVZDWZRABgjHNrGUvg__' + } } - } - }) + }) + } else { + subordNode.data.data.url = + 'https://s3-alpha-sig.figma.com/img/ea2f/590e/9638f62a2fc91e31f33db0022db1642c?Expires=1773014400&Key-Pair-Id=APKAQ4GOSFWCW27IBOMQ&Signature=M0B8oJJOk~dGG0aZAqOIocAp7T0LFdJ9FYmCrEZVTCRzYxM6SJRNtYMTX-rTO3Z~s14QINh~o-S41XiZnBv-0zcKjuWot~VVaNHfd0~1LesfNe2KwvCinT~72btFut1pheLnKE-wWCX5ewtonxU77bnw386YPMTqv7DBZzksf2udsJA7NmOYD6~TUG3Q2dWSt~zPH~lkaidscPqpCnCbqzljCEi4RiHY4U3A45l5XypcX2umqn1UaYUFCTqV9471J4qdB6Dg2pcKocdp-7-3s1De6Q~2SmBOrSgDQ~KEADCB2lhKfhxgWmy0lwMvhTd4l90ygVZDWZRABgjHNrGUvg__' + } } onMounted(() => { for (const key in props.data) { diff --git a/src/components/Canvas/FlowCanvas/components/node.vue b/src/components/Canvas/FlowCanvas/components/node.vue index d51161b..ae39946 100644 --- a/src/components/Canvas/FlowCanvas/components/node.vue +++ b/src/components/Canvas/FlowCanvas/components/node.vue @@ -44,18 +44,19 @@ } }) const nodes = computed(() => props.stateManager.nodes.value) - const firstNode = computed(() => nodes.value[0]) - const lastNode = computed(() => nodes.value[nodes.value.length - 1]) + const isSubord = computed(() => nodes.value.some((v) => v.data.superiorID === props.node.id)) const tier = computed(() => Number(props.node?.data?.tier || 0)) const isAdd = computed( () => - props.node.id === lastNode.value.id && + !isSubord.value && NODE_DATATYPE.RESULT_IMAGE === props.node.data.type && !(tier.value === NODE_DATATIER.TO_3VIEW) ) const onAdd = () => { const tier_ = tier.value + 1 - props.stateManager.nodeManager.createCardsSelect({ data: { tier: tier_ } }) + props.stateManager.nodeManager.createCardsSelect({ + data: { tier: tier_, superiorID: props.node.id } + }) } const posCenter = computed(() => { const arr = [NODE_DATATYPE.RESULT_IMAGE] diff --git a/src/components/Canvas/FlowCanvas/components/result/result-image.vue b/src/components/Canvas/FlowCanvas/components/result/result-image.vue index cb4f9d6..1bc5f7f 100644 --- a/src/components/Canvas/FlowCanvas/components/result/result-image.vue +++ b/src/components/Canvas/FlowCanvas/components/result/result-image.vue @@ -37,25 +37,31 @@