feat(aiot): 搭建 aiot 前端模块路由和 API 层

- 新增 router/routes/modules/aiot.ts:6 个页面路由
  告警列表、摄像头汇总、摄像头管理、ROI配置、实时视频、边缘节点
- 新增 api/aiot/alarm/:告警 API(分页、详情、处理、删除、统计、汇总)
- 新增 api/aiot/edge/:边缘设备 API(分页、详情、统计)
- 新增 api/aiot/device/:摄像头和 ROI API(调用 WVP 后端)
- 新增 api/aiot/video/:视频播放 API(playStart/playStop)
- 新增 api/aiot/request.ts:WVP 专用请求客户端(跳过芋道响应拦截器)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-06 16:40:26 +08:00
parent bc2f1e89c9
commit 159a82aaa9
6 changed files with 421 additions and 0 deletions

View File

@@ -0,0 +1,99 @@
import type { PageParam, PageResult } from '@vben/request';
import { wvpRequestClient } from '#/api/aiot/request';
export namespace AiotDeviceApi {
/** ROI 区域 */
export interface Roi {
id?: number;
channelId?: string;
channelName?: string;
name?: string;
type?: string;
points?: string;
enabled?: boolean;
createdAt?: string;
updatedAt?: string;
}
/** ROI 算法绑定 */
export interface RoiAlgoBind {
id?: number;
roiId?: number;
algorithmId?: number;
algorithmName?: string;
enabled?: boolean;
config?: Record<string, any>;
}
/** 算法 */
export interface Algorithm {
id?: number;
name?: string;
code?: string;
description?: string;
enabled?: boolean;
}
/** 摄像头通道 */
export interface Channel {
channelId?: string;
name?: string;
manufacturer?: string;
status?: string;
ptztypeText?: string;
longitudeWgs84?: number;
latitudeWgs84?: number;
}
}
// ==================== ROI 区域管理 API ====================
/** 获取 ROI 列表 */
export function getRoiPage(params: PageParam) {
return wvpRequestClient.get<PageResult<AiotDeviceApi.Roi>>(
'/aiot/device/roi/list',
{ params },
);
}
/** 保存 ROI */
export function saveRoi(data: AiotDeviceApi.Roi) {
return wvpRequestClient.post('/aiot/device/roi/save', data);
}
/** 删除 ROI */
export function deleteRoi(id: number) {
return wvpRequestClient.delete(`/aiot/device/roi/delete?id=${id}`);
}
// ==================== 算法绑定 API ====================
/** 绑定算法到 ROI */
export function bindAlgo(data: { roiId: number; algorithmId: number }) {
return wvpRequestClient.post('/aiot/device/roi/bindAlgo', data);
}
/** 解绑算法 */
export function unbindAlgo(bindId: number) {
return wvpRequestClient.delete(
`/aiot/device/roi/unbindAlgo?bindId=${bindId}`,
);
}
/** 获取算法列表 */
export function getAlgorithmList() {
return wvpRequestClient.get<AiotDeviceApi.Algorithm[]>(
'/aiot/device/algorithm/list',
);
}
// ==================== 摄像头通道 API ====================
/** 获取摄像头通道列表 */
export function getChannelPage(params: PageParam) {
return wvpRequestClient.get<PageResult<AiotDeviceApi.Channel>>(
'/aiot/device/channel/list',
{ params },
);
}