feat(flows): 新增流程编辑器基础功能与相关组件
feat(backend): 添加流程模型与服务支持 feat(frontend): 实现流程编辑器UI与交互 feat(assets): 添加流程节点图标资源 feat(plugins): 实现上下文菜单和运行时插件 feat(components): 新增基础节点和侧边栏组件 feat(routes): 添加流程相关路由配置 feat(models): 创建流程和运行日志数据模型 feat(services): 实现流程服务层逻辑 feat(migration): 添加流程相关数据库迁移 feat(config): 更新前端配置支持流程编辑器 feat(utils): 增强axios错误处理和工具函数
This commit is contained in:
44
backend/src/flow/domain.rs
Normal file
44
backend/src/flow/domain.rs
Normal file
@ -0,0 +1,44 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash, Default)]
|
||||
pub struct NodeId(pub String);
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum NodeKind {
|
||||
Start,
|
||||
End,
|
||||
Task,
|
||||
Decision,
|
||||
}
|
||||
|
||||
impl Default for NodeKind {
|
||||
fn default() -> Self { Self::Task }
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
pub struct NodeDef {
|
||||
pub id: NodeId,
|
||||
#[serde(default)]
|
||||
pub kind: NodeKind,
|
||||
#[serde(default)]
|
||||
pub name: String,
|
||||
#[serde(default)]
|
||||
pub task: Option<String>, // 绑定的任务组件标识
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
pub struct LinkDef {
|
||||
pub from: NodeId,
|
||||
pub to: NodeId,
|
||||
#[serde(default)]
|
||||
pub condition: Option<String>, // 条件脚本,返回 bool
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
pub struct ChainDef {
|
||||
#[serde(default)]
|
||||
pub name: String,
|
||||
pub nodes: Vec<NodeDef>,
|
||||
#[serde(default)]
|
||||
pub links: Vec<LinkDef>,
|
||||
}
|
||||
Reference in New Issue
Block a user