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,
|
);
|
}
|