1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
| import type { BiDashboardApi } from '#/api/bi/dashboard';
|
| export interface DashboardMeta {
| code: string;
| title: string;
| subtitle: string;
| gradient: string;
| icon: string;
| }
|
| /** 仪表盘元信息映射 */
| export const DASHBOARD_META: Record<string, DashboardMeta> = {
| 'purchase-sales': {
| code: 'purchase_sales',
| title: '采购 · 销售 · 售后',
| subtitle: '供应链全链路经营决策看板',
| gradient: 'from-indigo-600 via-blue-600 to-cyan-500',
| icon: 'lucide:shopping-cart',
| },
| warehouse: {
| code: 'warehouse',
| title: '仓储物流',
| subtitle: '库存周转与物流效率看板',
| gradient: 'from-emerald-600 via-green-600 to-teal-500',
| icon: 'lucide:warehouse',
| },
| 'production-equipment': {
| code: 'production_equipment',
| title: '生产 · 设备',
| subtitle: '生产执行与设备运行效率看板',
| gradient: 'from-orange-600 via-amber-600 to-yellow-500',
| icon: 'lucide:factory',
| },
| quality: {
| code: 'quality',
| title: '质量管理',
| subtitle: '质检达标与质量趋势监控看板',
| gradient: 'from-rose-600 via-pink-600 to-fuchsia-500',
| icon: 'lucide:shield-check',
| },
| 'hr-oa': {
| code: 'hr_oa',
| title: '人力资源 · 协同办公',
| subtitle: '组织效能与协同效率分析看板',
| gradient: 'from-violet-600 via-purple-600 to-indigo-500',
| icon: 'lucide:users',
| },
| };
|
| /** 根据路由路径获取仪表盘编码 */
| export function getDashboardCode(path: string): string {
| const segments = path.split('/').filter(Boolean);
| return segments[segments.length - 1] || '';
| }
|
| /** 默认空仪表盘数据 */
| export function getDefaultCharts(): BiDashboardApi.ChartItem[] {
| return [
| {
| id: 0,
| name: '暂无数据',
| chartType: 'number',
| refreshInterval: 0,
| position: { x: 0, y: 0, w: 24, h: 6 },
| data: [],
| error: '请配置图表数据',
| },
| ];
| }
|
|