| | |
| | | import { HandleType } from '@vue-flow/core'; |
| | | import { HandleType, useNode, useVueFlow } from '@vue-flow/core'; |
| | | import { v4 as uuid } from 'uuid'; |
| | | import { VueFlowConstant } from './VueFlowConstant'; |
| | | import { CompareOperation, ConditionOperator, NodeType, VarType, nodeTypeMap } from './vueFlowEnum'; |
| | |
| | | key: 'condition', |
| | | label: '', |
| | | type: 'condition', |
| | | value: [ConditionHelper.getDefaultConditionGroup()], |
| | | value: [ConditionHelper.getDefaultConditionGroup(),ConditionHelper.getDefaultConditionGroup(true)], |
| | | }, |
| | | ], |
| | | }, |
| | |
| | | case NodeType.Agent: |
| | | data[VueFlowConstant.GROUP_PARAMS_KEY] = [ |
| | | { |
| | | |
| | | [VueFlowConstant.PARAMS_KEY]: [ |
| | | { |
| | | key: 'agent', |
| | |
| | | }, |
| | | ], |
| | | }, |
| | | |
| | | ]; |
| | | break; |
| | | case NodeType.Output: |
| | | data[VueFlowConstant.GROUP_PARAMS_KEY] = [ |
| | | { |
| | | |
| | | [VueFlowConstant.PARAMS_KEY]: [ |
| | | { |
| | | key: 'output_msg', |
| | |
| | | type: 'output_form', |
| | | required: true, |
| | | value: { type: 'none', value: '' }, |
| | | options: [ |
| | | |
| | | ], |
| | | options: [], |
| | | }, |
| | | ], |
| | | }, |
| | |
| | | left_label: left?.label ?? '', |
| | | left_value: left?.var ?? '', |
| | | comparison_operation: operation ?? '', |
| | | right_value_type: right?.type ?? VarType.Input, |
| | | // right_value_type: right?.type ?? VarType.Input, |
| | | // 固定选择 input |
| | | right_value_type: VarType.Input, |
| | | |
| | | right_value: right?.value ?? '', |
| | | right_label: right?.label ?? '', |
| | | }; |
| | | }; |
| | | |
| | | static getDefaultConditionGroup = () => { |
| | | return { |
| | | id: VueFlowHelper.genId(), |
| | | operator: ConditionOperator.And, |
| | | conditions: [], |
| | | }; |
| | | static getDefaultConditionGroup = (isElse = false) => { |
| | | return isElse |
| | | ? { |
| | | id: VueFlowHelper.genId(), |
| | | } |
| | | : { |
| | | id: VueFlowHelper.genId(), |
| | | operator: ConditionOperator.And, |
| | | conditions: [ |
| | | ConditionHelper.getConditionItem() |
| | | ], |
| | | }; |
| | | }; |
| | | } |