diff --git a/apps/web-antd/src/api/iot/statistics/index.ts b/apps/web-antd/src/api/iot/statistics/index.ts index 9f3a04266..a02b342d2 100644 --- a/apps/web-antd/src/api/iot/statistics/index.ts +++ b/apps/web-antd/src/api/iot/statistics/index.ts @@ -1,21 +1,20 @@ import { requestClient } from '#/api/request'; export namespace IotStatisticsApi { - // TODO @haohao:需要跟后端对齐,必要的 ReqVO、RespVO /** 统计摘要数据 */ - export interface StatisticsSummary { - productCategoryCount: number; - productCount: number; - deviceCount: number; - deviceMessageCount: number; - productCategoryTodayCount: number; - productTodayCount: number; - deviceTodayCount: number; - deviceMessageTodayCount: number; - deviceOnlineCount: number; - deviceOfflineCount: number; - deviceInactiveCount: number; - productCategoryDeviceCounts: Record; + export interface StatisticsSummaryRespVO { + productCategoryCount: number; // 品类数量 + productCount: number; // 产品数量 + deviceCount: number; // 设备数量 + deviceMessageCount: number; // 上报数量 + productCategoryTodayCount: number; // 今日新增品类数量 + productTodayCount: number; // 今日新增产品数量 + deviceTodayCount: number; // 今日新增设备数量 + deviceMessageTodayCount: number; // 今日新增上报数量 + deviceOnlineCount: number; // 在线数量 + deviceOfflineCount: number; // 离线数量 + deviceInactiveCount: number; // 待激活设备数量 + productCategoryDeviceCounts: Record; // 按品类统计的设备数量 } /** 时间戳-数值的键值对类型 */ @@ -30,15 +29,15 @@ export namespace IotStatisticsApi { downstreamCounts: TimeValueItem[]; } - /** 消息统计数据项(按日期) */ - export interface DeviceMessageSummaryByDate { - time: string; - upstreamCount: number; - downstreamCount: number; + /** 设备消息数量统计(按日期) */ + export interface DeviceMessageSummaryByDateRespVO { + time: string; // 时间轴 + upstreamCount: number; // 上行消息数量 + downstreamCount: number; // 下行消息数量 } - /** 消息统计接口参数 */ - export interface DeviceMessageReq { + /** 设备消息统计请求 */ + export interface DeviceMessageReqVO { interval: number; times?: string[]; } @@ -46,26 +45,17 @@ export namespace IotStatisticsApi { /** 获取 IoT 统计摘要数据 */ export function getStatisticsSummary() { - return requestClient.get( + return requestClient.get( '/iot/statistics/get-summary', ); } /** 获取设备消息的数据统计(按日期) */ export function getDeviceMessageSummaryByDate( - params: IotStatisticsApi.DeviceMessageReq, + params: IotStatisticsApi.DeviceMessageReqVO, ) { - return requestClient.get( + return requestClient.get( '/iot/statistics/get-device-message-summary-by-date', { params }, ); } - -// TODO @haohao:貌似这里,没用到?是不是后面哪里用,或者可以删除哈? -/** 获取设备消息统计摘要 */ -export function getDeviceMessageSummary(statType: number) { - return requestClient.get( - '/iot/statistics/get-device-message-summary', - { params: { statType } }, - ); -} diff --git a/apps/web-antd/src/views/iot/home/data.ts b/apps/web-antd/src/views/iot/home/data.ts index 562490f34..5a84bd8e9 100644 --- a/apps/web-antd/src/views/iot/home/data.ts +++ b/apps/web-antd/src/views/iot/home/data.ts @@ -1,7 +1,10 @@ import type { IotStatisticsApi } from '#/api/iot/statistics'; +/** 统计数据 */ +export type StatsData = IotStatisticsApi.StatisticsSummaryRespVO; + /** 默认统计数据 */ -export const defaultStatsData: IotStatisticsApi.StatisticsSummary = { +export const defaultStatsData: StatsData = { productCategoryCount: 0, productCount: 0, deviceCount: 0, diff --git a/apps/web-antd/src/views/iot/home/index.vue b/apps/web-antd/src/views/iot/home/index.vue index 763c03e0c..4a51e6873 100644 --- a/apps/web-antd/src/views/iot/home/index.vue +++ b/apps/web-antd/src/views/iot/home/index.vue @@ -1,5 +1,4 @@