diff --git a/apps/web-antd/src/api/ops/cleaning/index.ts b/apps/web-antd/src/api/ops/cleaning/index.ts index 628017ac0..5ddbd9b7f 100644 --- a/apps/web-antd/src/api/ops/cleaning/index.ts +++ b/apps/web-antd/src/api/ops/cleaning/index.ts @@ -98,11 +98,13 @@ export namespace OpsCleaningApi { deviceKey: string; // 设备Key status: BadgeStatus | string; // 设备状态(兼容大小写) batteryLevel: null | number; // 电量(可能为空) - lastHeartbeatTime: string; // 最后心跳时间 - rssi?: null | number; // 信号强度(可能为空) + onlineTime?: null | string; // 设备上线时间 isInArea: boolean; // 是否在区域内 areaId?: number; // 当前区域ID areaName?: null | string; // 当前区域名称(可能为空) + currentOrderId?: null | number; // 当前工单ID + currentOrderStatus?: null | string; // 当前工单状态 + orderAreaName?: null | string; // 工单目标区域名称 } /** 业务日志类型 */ diff --git a/apps/web-antd/src/api/ops/trajectory/index.ts b/apps/web-antd/src/api/ops/trajectory/index.ts index 44d10aff3..2f11edd00 100644 --- a/apps/web-antd/src/api/ops/trajectory/index.ts +++ b/apps/web-antd/src/api/ops/trajectory/index.ts @@ -33,6 +33,7 @@ export namespace OpsTrajectoryApi { areaName: string; buildingName?: string; floorNo?: number; + fullAreaName?: string; beaconMac?: string; enterTime: string; leaveTime?: string; @@ -43,7 +44,7 @@ export namespace OpsTrajectoryApi { /** 时间线查询参数 */ export interface TimelineQuery { - deviceId: number; + deviceId?: number; date: string; // yyyy-MM-dd } @@ -57,13 +58,38 @@ export namespace OpsTrajectoryApi { inArea: boolean; } - /** 轨迹统计摘要 */ + /** 轨迹统计摘要(KPI 卡片) */ export interface TrajectorySummary { + /** 作业时长(秒) */ + workDurationSeconds: number; + /** 覆盖区域数 */ + coveredAreaCount: number; + /** 出入次数 */ totalEvents: number; - uniqueAreaCount: number; - onlineDurationSeconds: number; - firstOnlineTime?: string; - lastOnlineTime?: string; + /** 平均停留时长(秒) */ + avgStaySeconds: number; + } + + /** 时段出入趋势(按小时聚合) */ + export interface HourlyTrend { + /** 小时 0-23 */ + hour: number; + /** 该小时进入次数 */ + enterCount: number; + /** 该小时离开次数 */ + leaveCount: number; + } + + /** 区域停留分布 */ + export interface AreaStayStats { + /** 区域名称 */ + areaName: string; + /** 完整区域路径 */ + fullAreaName?: string; + /** 累计停留秒数 */ + totalStaySeconds: number; + /** 进出次数 */ + visitCount: number; } } @@ -103,10 +129,35 @@ export function getCurrentLocation(deviceId: number) { ); } -/** 获取轨迹统计摘要 */ -export function getTrajectorySummary(deviceId: number, date: string) { +/** 获取轨迹统计摘要(KPI 卡片) */ +export function getTrajectorySummary(params: { + date: string; + deviceId?: number; +}) { return requestClient.get( '/ops/trajectory/summary', - { params: { deviceId, date } }, + { params }, + ); +} + +/** 获取时段出入趋势(按小时聚合) */ +export function getHourlyTrend(params: { + date: string; + deviceId?: number; +}) { + return requestClient.get( + '/ops/trajectory/hourly-trend', + { params }, + ); +} + +/** 获取区域停留分布 */ +export function getAreaStayStats(params: { + date: string; + deviceId?: number; +}) { + return requestClient.get( + '/ops/trajectory/area-stay-stats', + { params }, ); }