100 lines
2.3 KiB
TypeScript
100 lines
2.3 KiB
TypeScript
|
|
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 },
|
||
|
|
);
|
||
|
|
}
|