yeg
2026-09-09 528d52f2c7c6f911c54cae6e3f25500eab4384fe
1
2
3
4
5
6
7
8
9
10
11
12
import { request, type ApiResponse } from './request'
export interface DashboardTest { id: number; name: string; type: string; status: string; receptionStatus: string; step: string; warning: number }
export interface DashboardCabinet { id: number; name: string; capacity: number | null; channelCount: number; usedChannels: number; testCount: number; batteryCount: number; onlineStatus: string }
export interface DashboardSnapshot {
  summary: { testCount: number; batteryGroupCount: number; todayCount: number; monthCount: number }
  trends: Record<'week' | 'month' | 'year', { labels: string[]; values: number[] }>
  tests: DashboardTest[]
  cabinets: DashboardCabinet[]
  warnings: Array<{ id: number; testId: number; testName: string; item: string; occurredAt: number }>
}
/** 首页统计只读后端聚合,既不使用测试种子,也不在浏览器重算日期口径。 */
export async function getDashboard() { return (await request<ApiResponse & { data: DashboardSnapshot }>('/system/dashboard')).data }