feat(crm): 新增关系图谱和统计概览页面 + UI/UX 全面优化
后端: - manifest.rs 新增 Graph 和 Dashboard 页面类型到 PluginPageType 枚举 - 添加 graph 页面验证逻辑(entity/relationship_entity/source_field/target_field) CRM 插件: - plugin.toml 新增关系图谱页面(graph 类型,基于 customer_relationship 实体) - plugin.toml 新增统计概览页面(dashboard 类型) - 侧边栏菜单从 5 项扩展到 7 项 前端 — 关系图谱 (PluginGraphPage): - 渐变节点 + 曲线箭头连线 + 关系类型色彩区分 - 鼠标悬停高亮 + Canvas Tooltip + 点击设为中心节点 - 2-hop 邻居视图 + 统计卡片(客户总数/关系总数/当前中心) - 关系类型图例(可点击筛选)+ 暗色主题适配 - ResizeObserver 自适应 + requestAnimationFrame 动画循环 前端 — 统计概览 (PluginDashboardPage): - 5 实体统计卡片(渐变色条 + 图标 + 数字动画) - 可筛选字段分布卡片(Progress 进度条 + Tag 标签) - 响应式栅格布局 + 骨架屏加载态 + 错误状态持久展示
This commit is contained in:
@@ -142,6 +142,24 @@ pub enum PluginPageType {
|
||||
icon: Option<String>,
|
||||
tabs: Vec<PluginPageType>,
|
||||
},
|
||||
#[serde(rename = "graph")]
|
||||
Graph {
|
||||
entity: String,
|
||||
label: String,
|
||||
#[serde(default)]
|
||||
icon: Option<String>,
|
||||
relationship_entity: String,
|
||||
source_field: String,
|
||||
target_field: String,
|
||||
edge_label_field: String,
|
||||
node_label_field: String,
|
||||
},
|
||||
#[serde(rename = "dashboard")]
|
||||
Dashboard {
|
||||
label: String,
|
||||
#[serde(default)]
|
||||
icon: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
/// 插件页面区段(用于 detail 页面类型)
|
||||
@@ -263,6 +281,27 @@ fn validate_pages(pages: &[PluginPageType]) -> PluginResult<()> {
|
||||
}
|
||||
validate_pages(tabs)?;
|
||||
}
|
||||
PluginPageType::Graph {
|
||||
entity,
|
||||
relationship_entity,
|
||||
source_field,
|
||||
target_field,
|
||||
..
|
||||
} => {
|
||||
if entity.is_empty() || relationship_entity.is_empty() {
|
||||
return Err(PluginError::InvalidManifest(
|
||||
"graph page 的 entity/relationship_entity 不能为空".into(),
|
||||
));
|
||||
}
|
||||
if source_field.is_empty() || target_field.is_empty() {
|
||||
return Err(PluginError::InvalidManifest(
|
||||
"graph page 的 source_field/target_field 不能为空".into(),
|
||||
));
|
||||
}
|
||||
}
|
||||
PluginPageType::Dashboard { .. } => {
|
||||
// dashboard 无需额外验证
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user