From 4229192fc1530e2dd401c40ae13aee1fc46168bd Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Wed, 6 Nov 2024 15:30:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B7=A5=E4=BD=9C=E6=B5=81=E7=BC=96?= =?UTF-8?q?=E6=8E=92=E5=BA=94=E7=94=A8=E8=AE=B0=E4=BD=8F=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E7=9A=84=E6=94=B6=E8=B5=B7/=E5=B1=95=E5=BC=80=E7=8A=B6?= =?UTF-8?q?=E6=80=81=20#1543?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit b2ac658c4f294f445d43e8f396fbd8824f8b4ef2) --- ui/src/workflow/common/NodeContainer.vue | 24 ++++++++++++------- ui/src/workflow/common/app-node.ts | 5 ++-- ui/src/workflow/nodes/condition-node/index.ts | 5 ++-- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/ui/src/workflow/common/NodeContainer.vue b/ui/src/workflow/common/NodeContainer.vue index 43c7e23ac..50619d2d1 100644 --- a/ui/src/workflow/common/NodeContainer.vue +++ b/ui/src/workflow/common/NodeContainer.vue @@ -26,19 +26,13 @@

{{ nodeModel.properties.stepName }}

-
+
- + @@ -130,7 +124,19 @@ const height = ref<{ }) const showAnchor = ref(false) const anchorData = ref() -const showNode = ref(true) +// const showNode = ref(true) +const showNode = computed({ + set: (v) => { + set(props.nodeModel.properties, 'showNode', v) + }, + get: () => { + if (props.nodeModel.properties.showNode !== undefined) { + return props.nodeModel.properties.showNode + } + set(props.nodeModel.properties, 'showNode', true) + return true + } +}) const node_status = computed(() => { if (props.nodeModel.properties.status) { return props.nodeModel.properties.status diff --git a/ui/src/workflow/common/app-node.ts b/ui/src/workflow/common/app-node.ts index fefe04d6c..f720ad422 100644 --- a/ui/src/workflow/common/app-node.ts +++ b/ui/src/workflow/common/app-node.ts @@ -234,13 +234,14 @@ class AppNodeModel extends HtmlResize.model { } getDefaultAnchor() { const { id, x, y, width } = this + const showNode = this.properties.showNode === undefined ? true : this.properties.showNode const anchors: any = [] if (this.type !== WorkflowType.Base) { if (this.type !== WorkflowType.Start) { anchors.push({ x: x - width / 2 + 10, - y: y, + y: showNode ? y : y - 15, id: `${id}_left`, edgeAddable: false, type: 'left' @@ -248,7 +249,7 @@ class AppNodeModel extends HtmlResize.model { } anchors.push({ x: x + width / 2 - 10, - y: y, + y: showNode ? y : y - 15, id: `${id}_right`, type: 'right' }) diff --git a/ui/src/workflow/nodes/condition-node/index.ts b/ui/src/workflow/nodes/condition-node/index.ts index 0b46a8464..275c63a2d 100644 --- a/ui/src/workflow/nodes/condition-node/index.ts +++ b/ui/src/workflow/nodes/condition-node/index.ts @@ -35,10 +35,11 @@ class ConditionModel extends AppNodeModel { if (this.height === undefined) { this.height = 200 } + const showNode = this.properties.showNode === undefined ? true : this.properties.showNode const anchors: any = [] anchors.push({ x: x - width / 2 + 10, - y: y, + y: showNode ? y : y - 15, id: `${id}_left`, edgeAddable: false, type: 'left' @@ -50,7 +51,7 @@ class ConditionModel extends AppNodeModel { const h = get_up_index_height(branch_condition_list, index) anchors.push({ x: x + width / 2 - 10, - y: y - height / 2 + 75 + h + element.height / 2, + y: showNode ? y - height / 2 + 75 + h + element.height / 2 : y - 15, id: `${id}_${element.id}_right`, type: 'right' })