import React, { useEffect, useState } from 'react'; import { service } from '@wisdom-utils/utils'; import RealTimeInfo from '../index'; const REQUEST_HTTP = 'http'; const REQUEST_METHOD_GET = 'get'; const REQUEST_METHOD_POST = 'post'; const GET_DEVICE_CONF = 'https://www.fastmock.site/mock/162c15dca15c4dba9ba51e0a0b76929b/api/Publish/GCK/MonitorConfig/GetMonitorConf'; //获取设备配置 const GET_POINT_ADDRESS_ENTRY = 'https://www.fastmock.site/mock/162c15dca15c4dba9ba51e0a0b76929b/api/Publish/GCK/PointAddress/GetPointAddressEntry'; //获取点表信息 const GET_SENSOR_TYPE = 'https://www.fastmock.site/mock/162c15dca15c4dba9ba51e0a0b76929b/api/Publish/GCK/Sensor/GetSensorType'; //获取传感器类型 const GET_DEVICE_REAL_INFO = 'https://www.fastmock.site/mock/162c15dca15c4dba9ba51e0a0b76929b/api/Publish/GCK/Device/DeviceRealInfo'; //获取设备实时数据 // const GET_DEVICE_CONF = '/api/Publish/GCK/MonitorConfig/GetMonitorConf'; //获取设备配置 // const GET_POINT_ADDRESS_ENTRY = '/api/Publish/GCK/PointAddress/GetPointAddressEntry'; //获取点表信息 // const GET_SENSOR_TYPE = '/api/Publish/GCK/Sensor/GetSensorType'; //获取传感器类型 // const GET_DEVICE_REAL_INFO = '/api/Publish/GCK/Device/DeviceRealInfo'; //获取设备实时数据 const realTimeInfoService = { getDeviceConf: { url: GET_DEVICE_CONF, method: REQUEST_METHOD_GET, type: REQUEST_HTTP, }, getPointAddressEntry: { url: GET_POINT_ADDRESS_ENTRY, method: REQUEST_METHOD_GET, type: REQUEST_HTTP, }, getSensorType: { url: GET_SENSOR_TYPE, method: REQUEST_METHOD_GET, type: REQUEST_HTTP, }, getDeviceRealInfo: { url: GET_DEVICE_REAL_INFO, method: REQUEST_METHOD_POST, type: REQUEST_HTTP, }, }; const rtService = service(realTimeInfoService); const getDeviceConf = rtService.getDeviceConf; const getPointAddressEntry = rtService.getPointAddressEntry; const getSensorType = rtService.getSensorType; const getDeviceRealInfo = rtService.getDeviceRealInfo; const Demo = () => { return ( <div style={{ width: '200px', height: '60px', background: 'black' }}> <RealTimeInfo deviceConfService={getDeviceConf} pointAddressEntryService={getPointAddressEntry} sensorTypeService={getSensorType} deviceRealInfoService={getDeviceRealInfo} deviceRealInfoParams={{ userID: '1', pageIndex: 1, pageSize: 20, isFocus: false, accountFieldParams: [{ AName: '二供泵房' }, { AName: '二供机组' }], equipmentCode: 'EGBF00000001', }} user={'1'} /> </div> ); }; export default Demo;