From fe58586be00535aebb737ce7abc2ce8378919a11 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Fri, 28 Jun 2024 11:14:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=20=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E5=99=A8=20=E4=B8=BA=E7=A9=BA,=E4=B8=8D=E4=B8=BA=E7=A9=BA,?= =?UTF-8?q?=E4=B8=8D=E5=8C=85=E5=90=AB=E7=9A=84=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../compare/is_not_null_compare.py | 21 +++++++++++++++++ .../condition_node/compare/is_null_compare.py | 21 +++++++++++++++++ .../compare/not_contain_compare.py | 23 +++++++++++++++++++ ui/src/workflow/common/NodeCascader.vue | 1 - ui/src/workflow/common/data.ts | 3 +++ .../workflow/nodes/condition-node/index.vue | 13 ++++++++++- 6 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 apps/application/flow/step_node/condition_node/compare/is_not_null_compare.py create mode 100644 apps/application/flow/step_node/condition_node/compare/is_null_compare.py create mode 100644 apps/application/flow/step_node/condition_node/compare/not_contain_compare.py diff --git a/apps/application/flow/step_node/condition_node/compare/is_not_null_compare.py b/apps/application/flow/step_node/condition_node/compare/is_not_null_compare.py new file mode 100644 index 000000000..e10b86070 --- /dev/null +++ b/apps/application/flow/step_node/condition_node/compare/is_not_null_compare.py @@ -0,0 +1,21 @@ +# coding=utf-8 +""" + @project: maxkb + @Author:虎 + @file: is_not_null_compare.py + @date:2024/6/28 10:45 + @desc: +""" +from typing import List + +from application.flow.step_node.condition_node.compare import Compare + + +class IsNotNullCompare(Compare): + + def support(self, node_id, fields: List[str], source_value, compare, target_value): + if compare == 'is_not_null': + return True + + def compare(self, source_value, compare, target_value): + return source_value is not None diff --git a/apps/application/flow/step_node/condition_node/compare/is_null_compare.py b/apps/application/flow/step_node/condition_node/compare/is_null_compare.py new file mode 100644 index 000000000..35db51f47 --- /dev/null +++ b/apps/application/flow/step_node/condition_node/compare/is_null_compare.py @@ -0,0 +1,21 @@ +# coding=utf-8 +""" + @project: maxkb + @Author:虎 + @file: is_null_compare.py + @date:2024/6/28 10:45 + @desc: +""" +from typing import List + +from application.flow.step_node.condition_node.compare import Compare + + +class IsNullCompare(Compare): + + def support(self, node_id, fields: List[str], source_value, compare, target_value): + if compare == 'is_null': + return True + + def compare(self, source_value, compare, target_value): + return source_value is None diff --git a/apps/application/flow/step_node/condition_node/compare/not_contain_compare.py b/apps/application/flow/step_node/condition_node/compare/not_contain_compare.py new file mode 100644 index 000000000..cfa0063a5 --- /dev/null +++ b/apps/application/flow/step_node/condition_node/compare/not_contain_compare.py @@ -0,0 +1,23 @@ +# coding=utf-8 +""" + @project: maxkb + @Author:虎 + @file: contain_compare.py + @date:2024/6/11 10:02 + @desc: +""" +from typing import List + +from application.flow.step_node.condition_node.compare.compare import Compare + + +class ContainCompare(Compare): + + def support(self, node_id, fields: List[str], source_value, compare, target_value): + if compare == 'not_contain': + return True + + def compare(self, source_value, compare, target_value): + if isinstance(source_value, str): + return str(target_value) not in source_value + return not any([str(item) == str(target_value) for item in source_value]) diff --git a/ui/src/workflow/common/NodeCascader.vue b/ui/src/workflow/common/NodeCascader.vue index 3613acc9b..feb6ba1f5 100644 --- a/ui/src/workflow/common/NodeCascader.vue +++ b/ui/src/workflow/common/NodeCascader.vue @@ -25,7 +25,6 @@ const props = defineProps<{ modelValue: Array }>() const emit = defineEmits(['update:modelValue']) - const data = computed({ set: (value) => { emit('update:modelValue', value) diff --git a/ui/src/workflow/common/data.ts b/ui/src/workflow/common/data.ts index 2008fe805..2aaaa988a 100644 --- a/ui/src/workflow/common/data.ts +++ b/ui/src/workflow/common/data.ts @@ -124,7 +124,10 @@ export const menuNodes = [ ] export const compareList = [ + { value: 'is_null', label: '为空' }, + { value: 'is_not_null', label: '不为空' }, { value: 'contain', label: '包含' }, + { value: 'not_contain', label: '不包含' }, { value: 'eq', label: '等于' }, { value: 'ge', label: '大于等于' }, { value: 'gt', label: '大于' }, diff --git a/ui/src/workflow/nodes/condition-node/index.vue b/ui/src/workflow/nodes/condition-node/index.vue index 1b9500e93..77fb9214e 100644 --- a/ui/src/workflow/nodes/condition-node/index.vue +++ b/ui/src/workflow/nodes/condition-node/index.vue @@ -67,6 +67,9 @@ }" > { + if (isKeyDown.value) { + e.preventDefault() + } else { + e.stopPropagation() + return true + } +} const resizeCondition = (wh: any, row: any, index: number) => { const branch_condition_list = cloneDeep( props.nodeModel.properties.branch_condition_list