/* * @Descripttion: * @version: * @Author: congsir * @Date: 2023-07-20 16:22:14 * @LastEditors: Please set LastEditors * @LastEditTime: 2023-08-01 10:38:46 */ import { ApiClientFactory } from '../core'; export class TenantManageService { constructor(private factory: ApiClientFactory) {} async fetchProjectByTenant(tenantId: string) { const result = await this.factory.surveillance.get('/events/todoConfirmConfig/projects', { tenantId, }); return result; } async fetchTenanAndProjectList() { const result = await this.factory.surveillance.get('/amis/query/deviceQuery'); return result; } async fetchDeviceList(projectIds: string[]) { if (!projectIds) { return; } const result = await this.factory.surveillance.post('/devices/aiDeviceQuery', { projectIds, }); return result; } async fetchManageConfigList(tenantId?: string) { let url = `/events/todoConfirmConfig/list`; if (tenantId) { url = `/events/todoConfirmConfig/projects?tenantId=${tenantId}`; } const result = await this.factory.surveillance.get(url); return result; } async saveManageConfig(params: any) { const url = `/events/todoConfirmConfig/save`; const result = await this.factory.surveillance.post(url, params); return result; } async deleteManageConfig(id: string) { const url = `/events/todoConfirmConfig/delete?id=${id}`; const result = await this.factory.surveillance.delete(url); return result; } // 获取ai预警事件 async fetchAiEventList(params: { objectType: string; objectId: string; deviceIds?: string[]; eventTypes?: string[]; fromTime: number; toTime: number; pageSize: number; pageNo: number; statusIds: number[]; todoConfirmId: string; }) { const url = `/events/todoConfirm/list`; const result = await this.factory.surveillance.post(url, params); return result; } // 审核 async confirmEvent(id: string) { const url = `/events/todoConfirm/batch/confirm?ids=${id}&confirm=true`; const result = await this.factory.surveillance.post(url); return result; } // 删除 async deleteEvent(id: string) { const url = `/events/todoConfirm/batch/delete?ids=${id}`; const result = await this.factory.surveillance.delete(url); return result; } }