mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: 添加 判断器 为空,不为空,不包含的条件
This commit is contained in:
parent
84738d2832
commit
fe58586be0
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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])
|
||||
|
|
@ -25,7 +25,6 @@ const props = defineProps<{
|
|||
modelValue: Array<any>
|
||||
}>()
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
|
||||
const data = computed({
|
||||
set: (value) => {
|
||||
emit('update:modelValue', value)
|
||||
|
|
|
|||
|
|
@ -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: '大于' },
|
||||
|
|
|
|||
|
|
@ -67,6 +67,9 @@
|
|||
}"
|
||||
>
|
||||
<el-select
|
||||
@wheel="wheel"
|
||||
@keydown="isKeyDown = true"
|
||||
@keyup="isKeyDown = false"
|
||||
:teleported="false"
|
||||
v-model="condition.compare"
|
||||
placeholder="请选择条件"
|
||||
|
|
@ -153,7 +156,15 @@ const form = {
|
|||
}
|
||||
]
|
||||
}
|
||||
|
||||
const isKeyDown = ref(false)
|
||||
const wheel = (e: any) => {
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in New Issue