/* * @Descripttion: * @version: * @Author: congsir * @Date: 2023-02-17 11:00:25 * @LastEditors: * @LastEditTime: 2023-06-20 14:01:25 */ import { ApiClientFactory } from '../../core/api.client.factory'; import { OrgTreeReq, ItemList, DevicesList, OrgTreeFilterReq, orgDevicesReq, FavoritesListRes, FavoritesSetReq, FavoritesMoveReq, FavoritesDeviceReq, } from '../../model/company/projectSurveillance.model'; import { PageCarouselService } from '../PageCarousel.service'; export class ProjectSurveillance { constructor(private factory: ApiClientFactory) {} async getOrgFavoriteDevices( userId: string, params?: { category: any; } ) { const result = await this.factory.surveillance.get(`/org/tenant/favorite`, params, { headers: { userId, }, }); return result; } async getTreeDataFavorite(orgId: string, includedIscDevice: boolean = false): Promise { const result = await this.factory.surveillance.get( `/org/navigateTree/favorite?orgId=${orgId}&includedIscDevice=${includedIscDevice}&includedDevice=true` ); return result; } /** * 获取收藏夹列表 * @param tenantId * @returns */ async getFavoritesList(tenantId: string): Promise { const result = await this.factory.surveillance.get(`/devices/favorite/folder/list`, { tenantId }); return result; } /** * 保存收藏夹 * @param param * @returns */ async saveFavoritesSet(param: FavoritesSetReq): Promise { const result = await this.factory.surveillance.post(`/devices/favorite/folder/addOrUpdate`, param); return result; } /** * 移动收藏夹 * @param param * @returns */ async favoritesMove(targetId: string, sourceId: string): Promise { const result = await this.factory.surveillance.post( `/devices/favorite/folder/move?targetId=${targetId}&sourceId=${sourceId}` ); return result; } /** * 删除收藏夹 * @param favoriteFolderId * @returns */ async deleteFavorites(favoriteFolderId: string): Promise { const result = await this.factory.surveillance.delete( `/devices/favorite/folder/delete?favoriteFolderId=${favoriteFolderId}` ); return result; } /** * 添加设备到收藏夹 * @param param * @returns */ async addfavoritesDevice(param: FavoritesDeviceReq): Promise { const result = await this.factory.surveillance.post(`/devices/favorite/folder/favoriteDevice`, param); return result; } /** * 取消收藏设备 * @param param * @returns */ async cancelfavoritesDevice(param: FavoritesDeviceReq): Promise { const result = await this.factory.surveillance.post(`/devices/favorite/folder/cancelFavoriteDevice`, param); return result; } /** * 获取组织树 * @param orgtreeReq * @returns */ async loadOrganizeTree(orgtreeReq?: OrgTreeReq): Promise { const result = await this.factory.entity.get(`/api/org/navigateTree`, orgtreeReq); return result; } /** * 企业级,获取组织树设备列表 * @param orgtreeReq * @returns */ async loadNavigateTreeFilter(orgtreeReq?: OrgTreeFilterReq): Promise { const result = await this.factory.entity.post(`/api/org/mcc20navigateTree`, orgtreeReq); return result; } async loadDevicesList( orgId: string, projectStatus?: string, params?: { category?: any; online?: boolean; } ): Promise { const result = await this.factory.entity.get(`/api/v2/org/${orgId}/devices`, { projectStatus, ...params, }); return result; } /** * 筛选org下的设备列表 * @param orgId * @param param * @returns */ async loadOrgFilterDeviceList(orgId: string, param: orgDevicesReq): Promise { const result = await this.factory.entity.post(`/api/v2/org/${orgId}/devices/mcc20`, param); return result; } async RefreshTheScreenshots(deviceIds: string[]) { return await this.factory.surveillance.post(`/image/capture/batch`, { deviceIds, }); } /** * 页面轮播 / 视频轮播 */ Carousel = new PageCarouselService(this.factory, 'tenant'); /** * 获取企业级模拟视频源url * @param tenantId * @param orgId */ loadSimulateUrlTenant(tenantId: string, orgId: string) { return this.factory.surveillance.get('/mp4/devices/liveUrl/org', { tenantId, orgId, }); } /** * 获取不同时间段的企业级模拟视频源url * @param tenantId * @param orgId * @returns */ loadSimulateUrlTenantByTime(tenantId: string, orgId: string) { return this.factory.surveillance.get('/mp4/devices/liveUrl/orgV2', { tenantId, orgId, }); } }