wujingjing
2024-12-13 d2da078b40578cf72901442c7a2b878dfc34cae5
src/components/vue-flow/VueFlowHelper.ts
@@ -1,4 +1,4 @@
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';
@@ -40,7 +40,7 @@
                        key: 'condition',
                        label: '',
                        type: 'condition',
                        value: [ConditionHelper.getDefaultConditionGroup()],
                        value: [ConditionHelper.getDefaultConditionGroup(), ConditionHelper.getDefaultConditionGroup(true)],
                     },
                  ],
               },
@@ -73,7 +73,6 @@
         case NodeType.Agent:
            data[VueFlowConstant.GROUP_PARAMS_KEY] = [
               {
                  [VueFlowConstant.PARAMS_KEY]: [
                     {
                        key: 'agent',
@@ -86,13 +85,29 @@
                     },
                  ],
               },
            ];
            break;
         case NodeType.Func:
            data[VueFlowConstant.GROUP_PARAMS_KEY] = [
               {
                  [VueFlowConstant.PARAMS_KEY]: [
                     {
                        key: 'func_name',
                        label: '函数名称',
                        type: 'func_name_select',
                        value: '',
                        // value_label:'',
                        required: true,
                        placeholder: '函数名称',
                     },
                  ],
               },
            ];
            break;
         case NodeType.Output:
            data[VueFlowConstant.GROUP_PARAMS_KEY] = [
               {
                  [VueFlowConstant.PARAMS_KEY]: [
                     {
                        key: 'output_msg',
@@ -110,9 +125,7 @@
                        type: 'output_form',
                        required: true,
                        value: { type: 'none', value: '' },
                        options: [
                        ],
                        options: [],
                     },
                  ],
               },
@@ -200,17 +213,24 @@
         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()],
           };
   };
}