feat(web): 完善插件前端页面 — 数据 API、筛选、视图切换和统计展示

- 新增 pluginData API 层:count/aggregate/stats 端点调用
- PluginCRUDPage 支持 visible_when 条件字段、筛选器下拉、视图切换
- PluginTabsPage 支持 tabs 布局和子实体 CRUD
- PluginTreePage 实现树形数据加载和节点展开/收起
- PluginGraphPage 实现关系图谱可视化展示
- PluginDashboardPage 实现统计卡片和聚合数据展示
- PluginAdmin 状态显示优化
- plugin store 增强 schema 加载逻辑和菜单生成
This commit is contained in:
iven
2026-04-16 23:42:57 +08:00
parent 3483395f5e
commit ae62e2ecb2
10 changed files with 401 additions and 217 deletions

View File

@@ -8,7 +8,7 @@ export interface PluginMenuItem {
label: string;
pluginId: string;
entity?: string;
pageType: 'crud' | 'tree' | 'tabs' | 'detail';
pageType: 'crud' | 'tree' | 'tabs' | 'detail' | 'graph' | 'dashboard';
menuGroup?: string;
}
@@ -63,31 +63,47 @@ export const usePluginStore = create<PluginStore>((set, get) => ({
if (pages && pages.length > 0) {
for (const page of pages) {
if (page.type === 'tabs') {
// tabs 类型聚合为一个菜单项
items.push({
key: `/plugins/${plugin.id}/tabs/${encodeURIComponent('label' in page ? page.label : '')}`,
icon: ('icon' in page ? page.icon : 'AppstoreOutlined') || 'AppstoreOutlined',
label: ('label' in page ? page.label : plugin.name) as string,
key: `/plugins/${plugin.id}/tabs/${encodeURIComponent(page.label)}`,
icon: page.icon || 'AppstoreOutlined',
label: page.label,
pluginId: plugin.id,
pageType: 'tabs',
pageType: 'tabs' as const,
});
} else if (page.type === 'tree') {
items.push({
key: `/plugins/${plugin.id}/tree/${page.entity}`,
icon: ('icon' in page ? page.icon : 'ApartmentOutlined') || 'ApartmentOutlined',
label: ('label' in page ? page.label : page.entity) as string,
icon: page.icon || 'ApartmentOutlined',
label: page.label,
pluginId: plugin.id,
entity: page.entity,
pageType: 'tree',
pageType: 'tree' as const,
});
} else if (page.type === 'crud') {
items.push({
key: `/plugins/${plugin.id}/${page.entity}`,
icon: ('icon' in page ? page.icon : 'TableOutlined') || 'TableOutlined',
label: ('label' in page ? page.label : page.entity) as string,
icon: page.icon || 'TableOutlined',
label: page.label,
pluginId: plugin.id,
entity: page.entity,
pageType: 'crud',
pageType: 'crud' as const,
});
} else if (page.type === 'graph') {
items.push({
key: `/plugins/${plugin.id}/graph/${page.entity}`,
icon: 'ApartmentOutlined',
label: page.label,
pluginId: plugin.id,
entity: page.entity,
pageType: 'graph' as const,
});
} else if (page.type === 'dashboard') {
items.push({
key: `/plugins/${plugin.id}/dashboard`,
icon: 'DashboardOutlined',
label: page.label,
pluginId: plugin.id,
pageType: 'dashboard' as const,
});
}
// detail 类型不生成菜单项