import { ApiClientFactory } from '../core/api.client.factory'; import { DeviceInfo, DriverInfoMode, DemolitionInfoMode, DeviceSelectListData } from '../model/devicesManage.model'; export class DevicesManageService { constructor(private factory: ApiClientFactory) {} // 新增设备信息 async loadAddDeviceInfo(projectId: string, data: DeviceInfo): Promise { const result = await this.factory.entity.post(`/api/web/projects/${projectId}/largeDeviceInfos`, data); return result; } // 设备信息列表 async loadDevicesInfoList(projectId: string): Promise { const url = `/api/web/projects/${projectId}/largeDeviceInfos`; const devicesInfoList = await this.factory.entity.get(url); return devicesInfoList; } // 编辑设备信息列表 async loadEditDeviceInfo(projectId: string, id: string, data: DeviceInfo): Promise { const result = await this.factory.entity.post(`/api/web/projects/${projectId}/largeDeviceInfos/${id}`, data); return result; } // 删除信息列表 async loadDeleteDeviceInfo(projectId: string, id: string): Promise { const url = `/api/web/projects/${projectId}/largeDeviceInfos/${id}`; const result = await this.factory.entity.delete(url); return result; } //新增特种设备司机进出场信息 async loadAddDriverInfo(projectId: string, data: DriverInfoMode): Promise { const result = await this.factory.entity.post( `/api/web/projects/${projectId}/specialEquipmentDriverEntryExitInfos`, data ); return result; } // 特种设备司机进出场信息列表 async loadDriverInfoList(projectId: string): Promise { const url = `/api/web/projects/${projectId}/specialEquipmentDriverEntryExitInfos`; const result = await this.factory.entity.get(url); return result; } // 编辑特种设备司机进出场信息 async loadEditDriverInfo(projectId: string, id: string, data: DriverInfoMode): Promise { const result = await this.factory.entity.post( `/api/web/projects/${projectId}/specialEquipmentDriverEntryExitInfos/${id}`, data ); return result; } // 特种设备司机进出场信息-进场、退场 async loadDriverStateInfo(projectId: string, id: string, data: { inOrOut: number; date: number }): Promise { const result = await this.factory.entity.post( `/api/web/projects/${projectId}/specialEquipmentDriverEntryExitInfos/inOrOut/${id}`, data ); return result; } // 新增拆除设备信息 async loadAddDemolitionInfo(projectId: string, data: DemolitionInfoMode): Promise { const result = await this.factory.entity.post(`/api/web/projects/${projectId}/dismantlingInfos`, data); return result; } // 拆除信息列表 async loadDemolitionInfoList(projectId: string): Promise { const url = `/api/web/projects/${projectId}/dismantlingInfos`; const result = await this.factory.entity.get(url); return result; } // 修改拆除信息 async loadEditDemolitionInfo(projectId: string, id: string, data: DemolitionInfoMode): Promise { const result = await this.factory.entity.post(`/api/web/projects/${projectId}/dismantlingInfos/${id}`, data); return result; } // 删除拆除信息 async loadDeleteDemolitionInfo(projectId: string, id: string): Promise { const url = `/api/web/projects/${projectId}/dismantlingInfos/${id}`; const result = await this.factory.entity.delete(url); return result; } // 设备入场管理 async loadDevicesInfo(projectId: string): Promise { const url = `/api/web/projects/${projectId}/largeDeviceInfos/entry`; const result = await this.factory.entity.get(url); return result; } // 特种设备司机进退场 async loadDriversInfo(projectId: string): Promise { const url = `/api/web/projects/${projectId}/specialEquipmentDriverEntryExitInfos/entryExit`; const result = await this.factory.entity.get(url); return result; } // 特种设备司机进退场二级弹窗 async loadDriversDeatilInfo(projectId: string, inOrOut: number, type: string): Promise { const url = `/api/web/projects/${projectId}/specialEquipmentDriverEntryExitInfoLogs?inOrOut=${inOrOut}&type=${type}`; const result = await this.factory.entity.get(url); return result; } // 设备拆除记录信息 async loadDemolitionInfo(projectId: string): Promise { const url = `/api/web/projects/${projectId}/dismantlingInfos/log`; const result = await this.factory.entity.get(url); return result; } // 设备信息管理录入-添加设备信息-绑定 async searchDevicSelectList(projectId: string, data: DeviceSelectListData): Promise { const result = await this.factory.entity.post( `/api/web/projects/${projectId}/entities/getneddbindDeviceInfo`, data ); return result; } // 设备信息管理录入-添加设备信息-表格 -查询设备字典表数据 async searchDevicPropsData(projectId: string, deviceType: string): Promise { const result = await this.factory.entity.get( `/api/web/projects/largeDevDictionaries/query?deviceType=${deviceType}` ); return result; } // 自定义设备类型查询 async getMineDeviceList(projectId: string): Promise { const result = await this.factory.entity.get( `/api/web/projects/${projectId}/largeCustomDeviceType/query` ); return result; } //查询设备属性字典表数据 async getDeviceTable(projectId: string, deviceType: string): Promise { const result = await this.factory.entity.get( `/api/web/projects/${projectId}/largeDevDictionaries/getLargeDevDictionaries?deviceType=${deviceType}` ); return result; } //设备属性字典添加 async addDeviceProps(projectId: string, data: any): Promise { const result = await this.factory.entity.post(`/api/web/projects/${projectId}/largeDevDictionaries/add`, data); return result; } //删除设备属性字典数据 async deleteDeviceProps(projectId: string, id: string): Promise { const result = await this.factory.entity.get( `/api/web/projects/${projectId}/largeDevDictionaries/deleteById?id=${id}` ); return result; } //根据设备类型名称查询自定义设备类型 async searchDevice(projectId: string, typeName: string): Promise { const result = await this.factory.entity.get( `/api/web/projects/${projectId}/largeCustomDeviceType/findBytypeName?typeName=${typeName}` ); return result; } //批量修改设备属性字典数据 async checkDevices(projectId: string, data: any): Promise { const result = await this.factory.entity.post( `/api/web/projects/${projectId}/largeDevDictionaries/updateBatch`, data ); return result; } //根据设备属性名称查询设备属性字典数据 async searchDeviceProps(projectId: string, text: string, type: string): Promise { const result = await this.factory.entity.get( `/api/web/projects/${projectId}/largeDevDictionaries/getLargeDevDictionariesByText?text=${text}&deviceType=${type}` ); return result; } // 设备信息列表 async getDevicesInfoList(projectId: string): Promise { const url = `/api/web/projects/${projectId}/largeDeviceInfos`; const devicesInfoList = await this.factory.entity.get(url); return devicesInfoList; } //设备属性字典编辑 async editDeviceProps(projectId: string, data: any): Promise { const result = await this.factory.entity.post( `/api/web/projects/${projectId}/largeDevDictionaries/update`, data ); return result; } //设备属性值字典查询 async getPropsSelect(projectId: string, dictType: string): Promise { const url = `/api/web/projects/${projectId}/customDictData/query?dictType=${dictType}`; const res = await this.factory.entity.get(url); return res; } }