2026-08-10 f9e6eb6fc2c2e0c2a2b17238b817fcbfcb6bab56
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
import { requestClient } from '#/api/request';
 
export namespace BiDashboardApi {
  export interface ChartItem {
    id: number;
    name: string;
    chartType: 'bar' | 'line' | 'pie' | 'scatter' | 'gauge' | 'table' | 'number';
    refreshInterval: number;
    position?: { x: number; y: number; w: number; h: number };
    chartOptions?: Record<string, unknown>;
    data?: Record<string, unknown>[];
    error?: string;
  }
}
 
/**
 * 获取仪表盘列表
 */
export function getDashboardList() {
  return requestClient.get<Array<{ id: number; name: string; code: string; groupCode: string; icon: string; sort: number; status: number; remark: string }>>('/bi/dashboard/list');
}
 
/**
 * 获取仪表盘数据
 * @param dashboardCode 仪表盘编码
 * @param params 查询参数
 */
export function getDashboardData(
  dashboardCode: string,
  params?: Record<string, unknown>,
) {
  return requestClient.post<BiDashboardApi.ChartItem[]>(
    `/bi/dashboard/${dashboardCode}/data`,
    params,
  );
}