feat(api/rfid): 新增看板按需刷新相关接口及类型定义

- 添加获取实时统计数据接口,支持告警列表数量限制
- 新增设备状态列表接口,支持按位置筛选
- 新增成功率趋势接口,按小时统计,支持类型参数
- 保留原有完整看板数据接口及统计概览接口
- 新增告警统计列表接口,支持限制数量
- 新增完整看板数据相关类型定义,涵盖统计概览、设备状态、
  成功率趋势和告警统计等结构
- 定义最新读取记录类型,用于设备状态最新读取信息描述
main
zangch@mesnac.com 2 months ago
parent ba37248df3
commit 97916765d5

@ -1,11 +1,92 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import {
DashboardVO,
RealtimeStats,
DeviceStatusVO,
SuccessRateTrend,
StatisticsOverview,
AlarmStatVO
} from './types';
// ==================== 新增接口(按需刷新) ====================
/**
*
* 1
* 线线+
*
* @param alarmLimit 10
*/
export const getDashboardStats = () => {
export const getRealtimeStats = (alarmLimit?: number): AxiosPromise<RealtimeStats> => {
return request({
url: '/rfid/dashboard/stats',
url: '/rfid/dashboard/realtime',
method: 'get',
params: { alarmLimit }
});
};
/**
* 2
* 线
*
* @param locationId ID
*/
export const getDeviceStatusList = (locationId?: number): AxiosPromise<DeviceStatusVO[]> => {
return request({
url: '/rfid/dashboard/deviceStatus',
method: 'get',
params: { locationId }
});
};
/**
* 3
*
*
* @param type today-yesterday-
*/
export const getSuccessRateTrends = (type?: string): AxiosPromise<SuccessRateTrend[]> => {
return request({
url: '/rfid/dashboard/successRate',
method: 'get',
params: { type }
});
};
// ==================== 原有接口(保留) ====================
/**
*
*
* @param locationId ID
*/
export const getDashboardData = (locationId?: number): AxiosPromise<DashboardVO> => {
return request({
url: '/rfid/dashboard/data',
method: 'get',
params: { locationId }
});
};
/**
*
*/
export const getOverview = (): AxiosPromise<StatisticsOverview> => {
return request({
url: '/rfid/dashboard/overview',
method: 'get'
})
}
});
};
/**
*
*
* @param limit 10
*/
export const getAlarmStats = (limit?: number): AxiosPromise<AlarmStatVO[]> => {
return request({
url: '/rfid/dashboard/alarmStats',
method: 'get',
params: { limit }
});
};

@ -0,0 +1,106 @@
/**
*
*/
/**
*
*/
export interface DashboardVO {
/** 统计概览 */
overview: StatisticsOverview;
/** 设备状态列表 */
deviceStatusList: DeviceStatusVO[];
/** 成功率趋势数据 */
successRateTrends: SuccessRateTrend[];
/** 告警统计列表 */
alarmStats: AlarmStatVO[];
}
/**
*
*/
export interface StatisticsOverview {
/** 设备总数 */
deviceTotal: number;
/** 在线数量 */
onlineCount: number;
/** 离线数量 */
offlineCount: number;
/** 告警数量 */
alarmCount: number;
}
/**
*
*/
export interface AlarmStatVO {
/** 告警时间 */
alarmTime: string;
/** 设备名称 */
deviceName: string;
/** 位置 */
location: string;
/** 告警级别 */
alarmLevel: string;
/** 告警行为 */
alarmAction: string;
}
/**
* 1
* +
*/
export interface RealtimeStats {
/** 统计概览 */
overview: StatisticsOverview;
/** 告警统计列表 */
alarmStats: AlarmStatVO[];
}
/**
*
*/
export interface LatestReadRecord {
/** 工位名称 */
stationName: string;
/** 条码信息 */
barcode: string;
/** 读取时间 */
recordTime: string;
/** 读取状态 (1-成功;0-失败) */
readStatus: string;
}
/**
* 2
* +
*/
export interface DeviceStatusVO {
/** 设备ID */
deviceId: number;
/** 设备编号 */
deviceCode: string;
/** 设备名称 */
deviceName: string;
/** 所属位置ID */
locationId: number;
/** 位置别名 */
locationAlias: string;
/** 在线状态 (1-在线;0-离线) */
onlineStatus: string;
/** 告警状态 (0-正常;1-告警) */
alarmStatus: string;
/** 最新读取记录 */
latestRecord?: LatestReadRecord;
}
/**
* 3
*
*/
export interface SuccessRateTrend {
/** 时间点(小时,如 "09:00" */
timePoint: string;
/** 成功率(百分比,如 98.5 */
successRate: number | null;
}
Loading…
Cancel
Save