From 88c6084f63fc70531607aaabd1295acada2cc96d Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Thu, 6 Jun 2024 10:20:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B7=A5=E4=BD=9C=E7=BC=96=E6=8E=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflow/nodes/condition-node/index.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ui/src/components/workflow/nodes/condition-node/index.vue b/ui/src/components/workflow/nodes/condition-node/index.vue index d73deedf3..aef74ae55 100644 --- a/ui/src/components/workflow/nodes/condition-node/index.vue +++ b/ui/src/components/workflow/nodes/condition-node/index.vue @@ -26,6 +26,7 @@ v-model="condition.field" placeholder="请选择变量" clearable + @visible-change="changeHandle" > @@ -82,6 +83,7 @@ import { cloneDeep, set } from 'lodash' import NodeContainer from '@/components/workflow/common/node-container/index.vue' import type { FormInstance } from 'element-plus' import { ref, computed, onMounted } from 'vue' +import { randomId } from '@/utils/utils' const props = defineProps<{ nodeModel: any }>() const form = { branch: [ @@ -93,7 +95,7 @@ const form = { value: '' } ], - id: 'xxxx', + id: randomId(), condition: 'and' } ] @@ -115,6 +117,10 @@ const form_data = computed({ const ConditionNodeFormRef = ref() +function changeHandle() { + console.log(props.nodeModel) +} + const validate = () => { ConditionNodeFormRef.value?.validate() } @@ -139,7 +145,7 @@ function addBranch() { value: '' } ], - id: 'xxxx', + id: randomId(), condition: 'and' }) set(props.nodeModel.properties.node_data, 'branch', list) @@ -158,6 +164,9 @@ function addCondition(index: number) { function deleteCondition(index: number, cIndex: number) { const list = cloneDeep(props.nodeModel.properties.node_data.branch) list[index]['conditions'].splice(cIndex, 1) + if (list[index]['conditions'].length === 0) { + list.splice(index, 1) + } set(props.nodeModel.properties.node_data, 'branch', list) }