筛选符修改

This commit is contained in:
caixiaofeng 2024-05-07 23:04:07 +08:00
parent edc39d8b42
commit 2b1ec33594
6 changed files with 12 additions and 11 deletions

View File

@ -6,20 +6,20 @@ const $props = defineProps<{
}>() }>()
const operatorOptions = [ const operatorOptions = [
{ {
value: 'equal', value: 'eq',
label: '等于' label: '等于'
}, },
{ {
value: 'not_equal', value: 'ne',
label: '不等于' label: '不等于'
}, },
{ {
label: '包含', label: '包含',
value: 'contains' value: 'lk'
}, },
{ {
label: '不包含', label: '不包含',
value: 'not_contain' value: 'nl'
} }
] ]
const $emits = defineEmits<{ const $emits = defineEmits<{

View File

@ -14,7 +14,7 @@ export interface Condition {
* *
*/ */
export interface FilterRules { export interface FilterRules {
logicalOperator: 'or' | 'and', operator: 'or' | 'and',
conditions: Condition[] conditions: Condition[]
groups: FilterRules[] groups: FilterRules[]
} }

View File

@ -25,7 +25,7 @@ const addRule = () => {
filterRules.value.conditions.push( filterRules.value.conditions.push(
{ {
field: null, field: null,
operator: 'equal', operator: 'eq',
value: null value: null
} }
) )
@ -46,7 +46,7 @@ const handleDel = (index: number) => {
*/ */
const addGroup = () => { const addGroup = () => {
filterRules.value.groups.push({ filterRules.value.groups.push({
logicalOperator: 'and', operator: 'and',
conditions: [{ conditions: [{
field: null, field: null,
operator: '', operator: '',
@ -69,7 +69,7 @@ const delGroup = (index: number) => {
<div class="logical-operator"> <div class="logical-operator">
<div class="logical-operator__line"></div> <div class="logical-operator__line"></div>
<el-switch <el-switch
v-model="filterRules.logicalOperator" v-model="filterRules.operator"
inline-prompt inline-prompt
style="--el-switch-on-color: #409EFF; --el-switch-off-color: #67C23A" style="--el-switch-on-color: #409EFF; --el-switch-off-color: #67C23A"
active-value="and" active-value="and"

View File

@ -81,7 +81,7 @@ const useNode = (node: Ref<FlowNode>, fields: Ref<Field[]>) => {
def: false, def: false,
name: `条件${exclusive.children.length + 1}`, name: `条件${exclusive.children.length + 1}`,
conditions: { conditions: {
logicalOperator: 'and', operator: 'and',
conditions: [], conditions: [],
groups: [] groups: []
} as FilterRules, } as FilterRules,

View File

@ -64,6 +64,7 @@ const converterBpmn = () => {
const processModel = { const processModel = {
code: 'test', code: 'test',
name: '测试', name: '测试',
enable: true,
icon: { icon: {
name: 'el:HomeFilled', name: 'el:HomeFilled',
color: '#409EFF', color: '#409EFF',

View File

@ -1,4 +1,4 @@
import { FlowNode } from '../Node/index' import type { FlowNode } from '../Node/index'
export interface ConditionNode extends FlowNode { export interface ConditionNode extends FlowNode {
def: boolean def: boolean
conditions: FilterRules conditions: FilterRules
@ -9,7 +9,7 @@ export interface ConditionNode extends FlowNode {
* *
*/ */
export interface FilterRules { export interface FilterRules {
logicalOperator: 'or' | 'and', operator: 'or' | 'and',
conditions: Condition[] conditions: Condition[]
groups: FilterRules[] groups: FilterRules[]
} }