dashboard.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import request from '@/utils/request';
  2. import { AxiosPromise } from 'axios';
  3. /**
  4. * 工作台 Dashboard 统计 API
  5. */
  6. // 顶部 4 张统计卡片数据
  7. export interface DashboardStatsVo {
  8. dangerTotal: number;
  9. dangerHandled: number;
  10. dangerPending: number;
  11. dangerYesterdayTotal: number;
  12. dangerDayRatio: number;
  13. equipmentTotal: number;
  14. equipmentMaintaining: number;
  15. dangerTypeStats: Array<{ name: string; value: number }>;
  16. monthlyTrend: Array<{ month: string; reported: number; handled: number }>;
  17. }
  18. export interface RecentDangerVo {
  19. dangerCode: string;
  20. dangerTitle: string;
  21. location: string;
  22. dangerType: string;
  23. dangerLevel: string;
  24. reportTime: string;
  25. handleStatus: string;
  26. }
  27. export interface RecentTrainingVo {
  28. trainingName: string;
  29. trainingTime: string;
  30. }
  31. export interface RecentNoticeVo {
  32. title: string;
  33. summary: string;
  34. publishTime: string;
  35. }
  36. /** 工作台统计数据 */
  37. export const getDashboardStats = (): AxiosPromise<DashboardStatsVo> => {
  38. return request({
  39. url: '/risk/dashboard/stats',
  40. method: 'get'
  41. });
  42. };
  43. /** 最新安全隐患 */
  44. export const getRecentDangers = (): AxiosPromise<RecentDangerVo[]> => {
  45. return request({
  46. url: '/risk/dashboard/recent/dangers',
  47. method: 'get'
  48. });
  49. };
  50. /** 近期安全培训 */
  51. export const getRecentTrainings = (): AxiosPromise<RecentTrainingVo[]> => {
  52. return request({
  53. url: '/risk/dashboard/recent/trainings',
  54. method: 'get'
  55. });
  56. };
  57. /** 最近公告 */
  58. export const getRecentNotices = (): AxiosPromise<RecentNoticeVo[]> => {
  59. return request({
  60. url: '/risk/dashboard/recent/notices',
  61. method: 'get'
  62. });
  63. };