feat(@vben/web-antd): 对齐后端轨迹与工牌接口 DTO 类型定义

- TrajectoryRecord 新增 fullAreaName、TimelineQuery.deviceId 改为可选
- AreaStayStats 新增 fullAreaName 字段
- BadgeRealtimeStatus 字段对齐后端:lastHeartbeatTime→onlineTime,移除 rssi
- 新增 TrajectorySummary、HourlyTrend、AreaStayStats 统计接口及类型

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
lzh
2026-04-05 15:25:31 +08:00
parent c16d049c38
commit 1468a4062b
2 changed files with 64 additions and 11 deletions

View File

@@ -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; // 工单目标区域名称
}
/** 业务日志类型 */

View File

@@ -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<OpsTrajectoryApi.TrajectorySummary>(
'/ops/trajectory/summary',
{ params: { deviceId, date } },
{ params },
);
}
/** 获取时段出入趋势(按小时聚合) */
export function getHourlyTrend(params: {
date: string;
deviceId?: number;
}) {
return requestClient.get<OpsTrajectoryApi.HourlyTrend[]>(
'/ops/trajectory/hourly-trend',
{ params },
);
}
/** 获取区域停留分布 */
export function getAreaStayStats(params: {
date: string;
deviceId?: number;
}) {
return requestClient.get<OpsTrajectoryApi.AreaStayStats[]>(
'/ops/trajectory/area-stay-stats',
{ params },
);
}