refactor(api-rfid-dashboard): 优化接口设计并更新类型定义

- 调整实时统计数据接口参数,支持不传限制数量获取全部告警
- 替换设备状态列表接口为位置树接口,位置类型3表示设备节点
- 移除设备状态列表接口参数,简化请求调用
- 成功率趋势接口取消类型参数,改为返回包含今日与昨日的数据
- 新增兼容旧接口名的函数,方便代码逐步迁移
- 类型定义中将设备状态列表替换为位置树结构
- 位置树节点新增设备及层级相关字段,支持树形结构及WebSocket数据匹配
- 新增WebSocket实时读取记录类型定义,完善实时数据结构
- 成功率趋势数据接口更新,区分今日与昨日成功率字段
main
zangch@mesnac.com 3 weeks ago
parent 631a88fd03
commit ecdf6e18b9

@ -3,7 +3,7 @@ import { AxiosPromise } from 'axios';
import {
DashboardVO,
RealtimeStats,
DeviceStatusVO,
LocationTreeNode,
SuccessRateTrend,
StatisticsOverview,
AlarmStatVO
@ -12,44 +12,41 @@ import {
// ==================== 新增接口(按需刷新) ====================
/**
* 1
* 1
* 线线+
*
* @param alarmLimit 10
* @param alarmLimit
*/
export const getRealtimeStats = (alarmLimit?: number): AxiosPromise<RealtimeStats> => {
return request({
url: '/rfid/dashboard/realtime',
method: 'get',
params: { alarmLimit }
params: alarmLimit ? { alarmLimit } : {}
});
};
/**
* 2
* 线
*
* @param locationId ID
* 2
* 3
* WebSocket
* deviceId WebSocket
*/
export const getDeviceStatusList = (locationId?: number): AxiosPromise<DeviceStatusVO[]> => {
export const getLocationTree = (): AxiosPromise<LocationTreeNode[]> => {
return request({
url: '/rfid/dashboard/deviceStatus',
method: 'get',
params: { locationId }
method: 'get'
});
};
/**
* 3
* 3
*
*
* @param type today-yesterday-
* 24
*/
export const getSuccessRateTrends = (type?: string): AxiosPromise<SuccessRateTrend[]> => {
export const getSuccessRateTrends = (): AxiosPromise<SuccessRateTrend[]> => {
return request({
url: '/rfid/dashboard/successRate',
method: 'get',
params: { type }
method: 'get'
});
};
@ -90,3 +87,11 @@ export const getAlarmStats = (limit?: number): AxiosPromise<AlarmStatVO[]> => {
params: { limit }
});
};
/**
* getDashboardStats
* getDashboardData便
*/
export const getDashboardStats = (locationId?: number): AxiosPromise<DashboardVO> => {
return getDashboardData(locationId);
};

@ -8,8 +8,8 @@
export interface DashboardVO {
/** 统计概览 */
overview: StatisticsOverview;
/** 设备状态列表 */
deviceStatusList: DeviceStatusVO[];
/** 位置树(含设备信息) */
locationTree: LocationTreeNode[];
/** 成功率趋势数据 */
successRateTrends: SuccessRateTrend[];
/** 告警统计列表 */
@ -58,49 +58,74 @@ export interface RealtimeStats {
}
/**
*
* 2
* locationType = 3
* deviceId WebSocket
*/
export interface LatestReadRecord {
/** 工位名称 */
stationName: string;
/** 条码信息 */
barcode: string;
/** 读取时间 */
recordTime: string;
/** 读取状态 (1-成功;0-失败) */
readStatus: string;
export interface LocationTreeNode {
// ==================== 位置信息 ====================
/** 位置ID */
id: number;
/** 位置编号 */
locationCode: string;
/** 位置别名 */
locationAlias: string;
/** 位置类型 (1-车间; 2-工序; 3-工位/设备) */
locationType: string;
/** 父级位置ID */
parentId: number | null;
// ==================== 设备信息(仅当 locationType=3 时有值) ====================
/** 设备ID前端用于匹配 WebSocket 数据) */
deviceId?: number;
/** 设备编号 */
deviceCode?: string;
/** 设备名称 */
deviceName?: string;
/** 在线状态 (1-在线; 0-离线) */
onlineStatus?: string;
/** 告警状态 (0-正常; 1-告警) */
alarmStatus?: string;
// ==================== 子节点 ====================
/** 子节点列表 */
children?: LocationTreeNode[];
}
/**
* 2
* +
* WebSocket
* C# deviceId
*/
export interface DeviceStatusVO {
/** 设备ID */
export interface WebSocketReadRecord {
/** 记录ID */
objid: number;
/** 设备ID用于匹配位置树中的设备节点 */
deviceId: number;
/** 设备编号 */
deviceCode: string;
/** 设备名称 */
deviceName: string;
/** 所属位置ID */
locationId: number;
/** 位置别名 */
locationAlias: string;
/** 在线状态 (1-在线;0-离线) */
onlineStatus: string;
/** 告警状态 (0-正常;1-告警) */
alarmStatus: string;
/** 最新读取记录 */
latestRecord?: LatestReadRecord;
/** 读取状态 (1-成功; 0-失败) */
readStatus: string;
/** 标签信息/条码 */
epcStr: string;
/** 是否报警 (1-是; 0-否) */
alarmFlag: string;
/** 告警级别 */
alarmLevel: string;
/** 告警类型 */
alarmType: string;
/** 告警内容 */
alarmAction: string;
/** 记录时间 (ISO 8601 格式) */
recordTime: string;
}
/**
* 3
*
*
*/
export interface SuccessRateTrend {
/** 时间点(小时,如 "09:00" */
timePoint: string;
/** 成功率(百分比,如 98.5 */
/** 今日成功率(百分比,如 98.5 */
successRate: number | null;
/** 昨日同一小时成功率 */
yesterdaySuccessRate: number | null;
}

Loading…
Cancel
Save