import { ApiClientFactory } from '../core/api.client.factory'; import { DeviceConfigListModel, DeviceTypeModel, DevicesOrganizationsModel, ChangeImgParams } from '../model/zlDevicesConfig.model'; export class ZlDevicesConfigService { constructor(private factory: ApiClientFactory) { } // 加载筑联配置列表,用于展示表格 async loadZlDevicesConfigList(projectId: string): Promise { const data = await this.factory.entity.get(`/api/web/projects/${projectId}/gateWayConfig`); return data; } // 加载筑联设备类型 async loadZlDevicesType(projectId: string, productCode: string, orgId: string): Promise { const data = await this.factory.entity.get( `/api/web/projects/${projectId}/gateWayConfig/products?productCode=${productCode}&orgId=${orgId}` ); return data; } // 加载设备品牌厂家 async loadZlDevicesOrganizations(projectId: string, productCode: string): Promise { const data = await this.factory.entity.get( `/api/web/projects/${projectId}/gateWayConfig/organizations/${productCode}` ); return data; } // 加载查看接口信息 接口信息不固定,直接返回用于页面展示,所以不写模型 async loadInterfaceInfo( projectId: string, productCode: string, organizationCode: string, version: string ): Promise { const data = await this.factory.entity.get( `/api/web/projects/${projectId}/gateWayConfig/interface/${productCode}/${organizationCode}/${version}` ); return { url: `/api/web/projects/${projectId}/gateWayConfig/interface/${productCode}/${organizationCode}/${version}`, json: data }; } // 加载某个scame async loadDeviceSchema( projectId: string, productCode: string, organizationCode: string, version: string ): Promise { const data = await this.factory.entity.get( `/api/web/projects/${projectId}/gateWayConfig/schema/${productCode}/${organizationCode}/${version}` ); return data; } // 保存配置信息 async saveSchemaValue( projectId: string, productCode: string, organizationCode: string, version: string, config: any ): Promise { const data = await this.factory.entity.post( `/api/web/projects/${projectId}/gateWayConfig/productConfig/${productCode}/${organizationCode}/${version}`, { config: config } ); return data; } // 修改配置信息 async editSchemaValue( projectId: string, productCode: string, organizationCode: string, version: string, config: any ): Promise { const data = await this.factory.entity.put( `/api/web/projects/${projectId}/gateWayConfig/productConfig/${productCode}/${organizationCode}/${version}`, { config: config } ); return data; } // 修改配置信息 async deleteSchemaValue( projectId: string, productCode: string, organizationCode: string, version: string ): Promise { const data = await this.factory.entity.delete( `/api/web/projects/${projectId}/gateWayConfig/productConfig/${productCode}/${organizationCode}/${version}` ); return data; } // 查看配置信息 async loadSchemaValue( projectId: string, productCode: string, organizationCode: string, version: string ): Promise { const data = await this.factory.entity.get( `/api/web/projects/${projectId}/gateWayConfig/productConfig/${productCode}/${organizationCode}/${version}` ); return data; } // 获取图片配置列表 async getDevicePicList(projectId: string): Promise { const data = await this.factory.entity.get( `/api/web/projects/${projectId}/devicePicInfo` ); return data; } // 修改设备类型图片 async changeDeiveTypeImg(projectId: string, deviceType: string, params?: ChangeImgParams): Promise { const data = await this.factory.entity.post( `/api/web/projects/${projectId}/devicePicInfo/deviceType/${deviceType}`, params ); return data; } // 修改单个设备图片 async changeDeiveItemImg(projectId: string, deviceType: string, deviceId: string, params?: ChangeImgParams): Promise { const data = await this.factory.entity.post( `/api/web/projects/${projectId}/devicePicInfo/deviceType/${deviceType}/${deviceId}`, params ); return data; } // 设备图片信息前台接口 async getDeviceHasPicList(projectId: string): Promise { const data = await this.factory.entity.get( `/api/web/projects/${projectId}/devicePicInfo/details` ); return data; } }