import { ApiClientFactory } from '../core/api.client.factory'; import { ISimpleDevice } from '../model/devices.model'; import { SMAlarmType, SMAlarmTypePosition, SMRulesList } from '../model/shieldTunelingMachine.model'; export class ShieldTunelingMachineServices { constructor(private factory: ApiClientFactory) {} // 盾构机设备列表 async LoadShieldTunelingMachineDevices(projectId: string): Promise { const result = await this.factory.entity.get( `/api/web/projects/${projectId}/shieldmachine/devices` ); return result; } // 盾构机预警类型接口 async LoadSMAlarmType(projectId: string, deviceId: string): Promise { const result = await this.factory.entity.get( `/api/web/projects/${projectId}/shieldmachine/${deviceId}/alarmtype` ); return result; } // 获取预警类型位置列表 async LoadSMAlarmTypePositionList( projectId: string, deviceId: string, alarmCode: string ): Promise { const result = await this.factory.entity.get( `/api/web/projects/${projectId}/shieldmachine/${deviceId}/alarmTypePosition?alarmCode=${alarmCode}` ); return result; } // 启动和关闭规则接口 async EditSMRule(projectId: string, deviceId: string, ruleId: string, status: boolean): Promise { const result = await this.factory.entity.post( `/api/web/projects/${projectId}/shieldmachine/devices/${deviceId}/rule/enable/${ruleId}?status=${status}` ); return result; } // 查询盾构机规则列表接口 async loadSMRulesList(projectId: string, deviceId: string): Promise { const result = await this.factory.entity.get( `/api/web/projects/${projectId}/shieldmachine/devices/${deviceId}/rules` ); return result; } // 设备规则添加接口 async addSMRule(projectId: string, deviceId: string, params: SMRulesList): Promise { const result = await this.factory.entity.post( `/api/web/projects/${projectId}/shieldmachine/devices/${deviceId}/rule`, params ); return result; } // 设备规则删除接口 async deleteSMRule(projectId: string, deviceId: string, id: string): Promise { const result = await this.factory.entity.delete( `/api/web/projects/${projectId}/shieldmachine/devices/${deviceId}/rule/${id} ` ); return result; } // 查询盾构机页面详情 async loadSMDetail(projectId: string, deviceId: string): Promise { // 暂不定义接口类型,后端格式太冗余 const result = await this.factory.entity.get( `/api/web/projects/${projectId}/shieldmachine/devices/${deviceId}` ); return result; } }