This commit is contained in:
戚辰先生 2024-12-05 14:54:35 +08:00
parent b6a5253f62
commit 8436ea74d4
2 changed files with 39 additions and 37 deletions

View File

@ -4,51 +4,47 @@
### 1. 工作流定义管理 (WorkflowDefinitionApiController) ### 1. 工作流定义管理 (WorkflowDefinitionApiController)
#### 1.1 保存工作流设计 #### 1.1 更新工作流定义
```typescript ```typescript
POST /api/v1/workflow-definitions/{id}/design PUT /api/v1/workflow-definitions/{id}
Request: { Request: {
nodes: [{ // 基本信息
id: string; code: string; // 工作流编码
type: string; name: string; // 工作流名称
position: { x: number; y: number }; description: string; // 工作流描述
data: { version: number; // 版本号
name: string;
description?: string; // 设计数据
config: Record<string, any>; design?: {
} nodes: [{
}]; id: string;
edges: [{ type: string;
id: string; position: { x: number; y: number };
source: string; data: {
target: string; name: string;
type: string; description?: string;
data?: { config: Record<string, any>;
condition?: string; }
} }];
}] edges: [{
id: string;
source: string;
target: string;
type: string;
data?: {
condition?: string;
}
}]
}
} }
Response: { Response: {
code: number; code: number;
data: boolean; data: WorkflowDefinitionDTO;
message: string; message: string;
} }
``` ```
#### 1.2 获取工作流设计 #### 1.2 导入工作流定义(待实现)
```typescript
GET /api/v1/workflow-definitions/{id}/design
Response: {
code: number;
data: {
nodes: Node[];
edges: Edge[];
};
message: string;
}
```
#### 1.3 导入工作流定义
```typescript ```typescript
POST /api/v1/workflow-definitions/import POST /api/v1/workflow-definitions/import
Request: FormData { Request: FormData {
@ -61,7 +57,7 @@ Response: {
} }
``` ```
#### 1.4 导出工作流定义 #### 1.3 导出工作流定义(待实现)
```typescript ```typescript
GET /api/v1/workflow-definitions/{id}/export GET /api/v1/workflow-definitions/{id}/export
Response: File // JSON格式的工作流定义文件 Response: File // JSON格式的工作流定义文件

View File

@ -304,6 +304,12 @@ const FlowDesigner: React.FC<FlowDesignerProps> = ({
graph.on('node:moved', updateGraph); graph.on('node:moved', updateGraph);
graph.on('edge:connected', updateGraph); graph.on('edge:connected', updateGraph);
graph.on('cell:removed', updateGraph); graph.on('cell:removed', updateGraph);
// 添加边的右键菜单删除功能
graph.on('edge:contextmenu', ({ cell, e }) => {
e.preventDefault();
cell.remove();
});
} }
// 加载流程数据 // 加载流程数据