Basic.tsx 2.62 KB
Newer Older
涂茜's avatar
涂茜 committed
1 2 3 4 5 6 7 8 9
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 =
涂茜's avatar
涂茜 committed
10
  'https://www.fastmock.site/mock/162c15dca15c4dba9ba51e0a0b76929b/api/Publish/GCK/MonitorConfig/GetMonitorConf'; //获取设备配置
涂茜's avatar
涂茜 committed
11 12 13 14 15 16 17
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'; //获取设备实时数据

涂茜's avatar
涂茜 committed
18
// const GET_DEVICE_CONF = '/api/Publish/GCK/MonitorConfig/GetMonitorConf'; //获取设备配置
涂茜's avatar
涂茜 committed
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
// 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;