wujingjing
2024-12-13 667c08a39b523e7afdf00a6af17ac2d4274b659a
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,11 @@
                     },
                  ],
               },
            ];
            break;
         case NodeType.Output:
            data[VueFlowConstant.GROUP_PARAMS_KEY] = [
               {
                  [VueFlowConstant.PARAMS_KEY]: [
                     {
                        key: 'output_msg',
@@ -110,9 +107,7 @@
                        type: 'output_form',
                        required: true,
                        value: { type: 'none', value: '' },
                        options: [
                        ],
                        options: [],
                     },
                  ],
               },
@@ -200,17 +195,26 @@
         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()
               ],
           };
   };
}