import { ApiClientFactory } from '../core/api.client.factory'; import { Device, DeviceStatusNoticeConfigModel } from '../model/devices.model'; export class DevicesService { constructor(private factory: ApiClientFactory) {} async loadAllDevices(projectId: string): Promise { const devices = await this.factory.entity.get(`/api/web/projects/${projectId}/entities/devices`); return devices; } async deleteDevices(projectId: string, deviceId: string, locationType: string): Promise { const devices = await this.factory.entity.delete( `/api/web/projects/${projectId}/entities/devices/${deviceId}?locationType=${locationType}` ); return devices; } /** * @method 保存设备状态通知配置 */ async saveDeviceStatusNoticeConfig(projectId: string, params: DeviceStatusNoticeConfigModel) { return await this.factory.surveillance.put(`/project/${projectId}/deviceStatus`, params); } /** * @method 查询设备状态通知配置 */ async fetchDeviceStatusNoticeConfig(projectId: string) { return await this.factory.surveillance.get(`/project/${projectId}/deviceStatus`); } /** * @批量管理相关接口 */ // 批量修改分组 async batchUpdateGroup(ids: string[], groupId: string) { return await this.factory.surveillance.put(`/device/batchUpdateGroup`, { ids, groupId, }); } async batchUpdateCategory(ids: string[], category: string) { return await this.factory.surveillance.put(`/device/batchUpdateCategory`, { ids, category, }); } async batchDeleteDevices(ids: string[]) { return await this.factory.surveillance.delete(`/device/batchDel`, { ids, }); } }