This commit is contained in:
dengqichen 2025-10-22 16:58:10 +08:00
parent 337320bfcd
commit c7bbdb3444
4 changed files with 5 additions and 87 deletions

View File

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { NodeCategory } from '../types';
import { NODE_DEFINITIONS } from '../nodes'; import { NODE_DEFINITIONS } from '../nodes';
import { NodeCategory } from '../nodes/types';
import type { WorkflowNodeDefinition } from '../nodes/types'; import type { WorkflowNodeDefinition } from '../nodes/types';
interface NodePanelProps { interface NodePanelProps {

View File

@ -2,8 +2,7 @@ import { useCallback, useState } from 'react';
import { message } from 'antd'; import { message } from 'antd';
import * as definitionService from '../../Definition/service'; import * as definitionService from '../../Definition/service';
import type { FlowNode, FlowEdge } from '../types'; import type { FlowNode, FlowEdge } from '../types';
import { NodeType } from '../types'; import { NodeType, isConfigurableNode } from '../nodes/types';
import { isConfigurableNode } from '../nodes/types';
interface WorkflowSaveData { interface WorkflowSaveData {
nodes: FlowNode[]; nodes: FlowNode[];

View File

@ -152,23 +152,6 @@ export interface ConfigurableNodeDefinition extends BaseNodeDefinition {
// 工作流节点定义(联合类型) // 工作流节点定义(联合类型)
export type WorkflowNodeDefinition = BaseNodeDefinition | ConfigurableNodeDefinition; export type WorkflowNodeDefinition = BaseNodeDefinition | ConfigurableNodeDefinition;
// 节点实例数据(运行时)
export interface NodeInstanceData {
nodeCode: string;
nodeName: string;
nodeType: NodeType;
category: NodeCategory;
description?: string;
// 运行时数据
configs?: Record<string, any>; // 基本配置数据(包含基本信息+节点配置)
inputMapping?: Record<string, any>; // 输入映射(用户配置)
outputs?: OutputField[]; // 输出能力定义(从节点定义中获取)
// UI位置信息
position: { x: number; y: number };
}
// 判断是否为可配置节点 // 判断是否为可配置节点
export const isConfigurableNode = (def: WorkflowNodeDefinition): def is ConfigurableNodeDefinition => { export const isConfigurableNode = (def: WorkflowNodeDefinition): def is ConfigurableNodeDefinition => {
return 'inputMappingSchema' in def || 'outputs' in def; return 'inputMappingSchema' in def || 'outputs' in def;

View File

@ -1,38 +1,7 @@
import type { Node, Edge } from '@xyflow/react'; import type { Node, Edge } from '@xyflow/react';
import type { NodeType, NodeCategory } from './nodes/types';
// 节点类型枚举 - 与原有系统保持一致 // ✅ NodeType 和 NodeCategory 已从 nodes/types.ts 导入,避免重复定义
export enum NodeType {
START_EVENT = 'START_EVENT',
END_EVENT = 'END_EVENT',
USER_TASK = 'USER_TASK',
SERVICE_TASK = 'SERVICE_TASK',
SCRIPT_TASK = 'SCRIPT_TASK',
DEPLOY_NODE = 'DEPLOY_NODE',
JENKINS_BUILD = 'JENKINS_BUILD',
NOTIFICATION = 'NOTIFICATION',
GATEWAY_NODE = 'GATEWAY_NODE',
SUB_PROCESS = 'SUB_PROCESS',
CALL_ACTIVITY = 'CALL_ACTIVITY'
}
// 节点分类
export enum NodeCategory {
EVENT = 'EVENT',
TASK = 'TASK',
GATEWAY = 'GATEWAY',
CONTAINER = 'CONTAINER'
}
// 节点定义数据结构
export interface NodeDefinitionData {
nodeCode: string;
nodeName: string;
nodeType: NodeType;
category: NodeCategory;
description?: string;
icon: string;
color: string;
}
// React Flow 节点数据 - 添加索引签名以满足React Flow的类型约束 // React Flow 节点数据 - 添加索引签名以满足React Flow的类型约束
export interface FlowNodeData extends Record<string, unknown> { export interface FlowNodeData extends Record<string, unknown> {
@ -68,12 +37,6 @@ export type FlowNode = Node<FlowNodeData>;
// 扩展的React Flow边类型 // 扩展的React Flow边类型
export type FlowEdge = Edge<FlowEdgeData>; export type FlowEdge = Edge<FlowEdgeData>;
// 工作流画布数据
export interface WorkflowFlowData {
nodes: FlowNode[];
edges: FlowEdge[];
}
// 节点配置模态框属性 // 节点配置模态框属性
export interface NodeConfigModalProps { export interface NodeConfigModalProps {
visible: boolean; visible: boolean;
@ -90,31 +53,4 @@ export interface EdgeConfigModalProps {
onOk: (edge: FlowEdge, updatedData: Partial<FlowEdgeData>) => void; onOk: (edge: FlowEdge, updatedData: Partial<FlowEdgeData>) => void;
} }
// 工具栏操作类型 // ✅ 已删除未使用的类型ToolbarActions, CanvasState, DragNodeData
export interface ToolbarActions {
onSave: () => void;
onUndo: () => void;
onRedo: () => void;
onZoomIn: () => void;
onZoomOut: () => void;
onFitView: () => void;
onCopy: () => void;
onPaste: () => void;
onDelete: () => void;
onBack: () => void;
}
// 画布状态
export interface CanvasState {
zoom: number;
canUndo: boolean;
canRedo: boolean;
selectedNodes: FlowNode[];
selectedEdges: FlowEdge[];
}
// 节点拖拽数据
export interface DragNodeData {
nodeType: NodeType;
nodeDefinition: NodeDefinitionData;
}