/* * @Descripttion: * @version: * @Author: congsir * @Date: 2023-03-07 16:45:26 * @LastEditors: Please set LastEditors * @LastEditTime: 2023-04-07 14:41:52 */ import { ApiClientFactory } from '../core'; import { CheckupDetail, NewCheckupRecord, Record, siteConfig, SiteList, ErrorLog } from '../model/checkup.model'; export class CheckupService { constructor(private factory: ApiClientFactory) {} /** * @function loadSiteList 获取项目现场体检列表 * @param projectId * @param userId * @returns */ async loadSiteList(projectId: string, userId: string): Promise { const result = await this.factory.surveillance.get('check360/site', { projectId, userId, }); return result; } /** * @function saveSiteList 保存项目现场体检列表 * @param config * @returns */ async saveSiteList(config: siteConfig) { const result = await this.factory.surveillance.post('check360/site', config); return result; } /** * @function loadUserCheckList 获取用户网络体检列表 * @param projectId * @param userId * @returns */ async loadUserCheckList(projectId: string, userId: string): Promise { const result = await this.factory.surveillance.get('check360/user', { projectId, userId, }); return result; } /** * @function saveUserList 保存用户网络体检列表 * @param config * @returns */ async saveUserCheckList(config: siteConfig) { const result = await this.factory.surveillance.post('check360/user', config); return result; } /** * @function loadAutoCheckupList 获取自动体检列表 */ async loadAutoCheckupList( projectId: string, pageNo: number, pageSize: number, tenantId: string, startTime?: number, endTime?: number ) { const result = await this.factory.surveillance.get('check360/auto/page', { projectId, pageNo, pageSize, startTime, endTime, tenantId, }); return result; } /** * @function loadLastRecord 获取最后一次体检记录 */ async loadLastRecord(scene: string, projectId: string, tenantId: string, userId: string, userName: string) { const result = await this.factory.surveillance.get('check360/auto/last', { scene, projectId, tenantId, userId, userName, }); return result; } /** * @function addCheckupRecord 新建体检记录 */ async addCheckupRecord( projectId: string, userId: string, userName: string, tenantId: string, scene: string ): Promise { const result = await this.factory.surveillance.post('check360/auto/new', { projectId, userId, userName, tenantId, scene, }); return result; } /** * @function deleteCheckupRecord 删除单次体检记录 */ async deleteCheckupRecord(projectId: string, checkId: string) { const result = await this.factory.surveillance.delete(`check360/auto?projectId=${projectId}&checkId=${checkId}`); return result; } /** * @function loadDetail 查询单个详情 */ async loadCheckupDetail(projectId: string, checkId: string): Promise { const result = await this.factory.surveillance.get('check360/auto/detail', { projectId, checkId, }); return result; } /** * @function saveCheckupRecord 修改保存单次体检记录 */ async saveCheckupRecord(record: Record) { const result = await this.factory.surveillance.put('check360/auto/web', record); return result; } /** * @function checkNvr nvr测试 */ async checkNvr(checkId: string): Promise { const result = await this.factory.surveillance.post('check360/auto/checkNvr', { checkId, }); return result; } /** * @function judegeNoviceGuide 判断是否显示新手引导 */ async judegeNoviceGuide(projectId: string, userId: string) { const result = await this.factory.surveillance.get('check360/auto/showUserGuide', { projectId, userId, }); return result; } /** * @function 收集错误信息 */ async errorLog(params: ErrorLog) { const result = await this.factory.surveillance.post('check360/log', params); return result; } /** * @function loadErrorLog 获取异常日志 */ async loadErrorLog(paramObj: object) { const result = await this.factory.surveillance.get('check360/log/page', paramObj) return result; } }