import React from 'react';
import { service } from '@wisdom-utils/utils';
import HistoryInfo from '../index';

const REQUEST_HTTP = 'http';
const REQUEST_METHOD_POST = 'post';
const REQUEST_METHOD_GET = 'get';

const GET_HISTORY_INFO =
  'https://www.fastmock.site/mock/162c15dca15c4dba9ba51e0a0b76929b/api/PandaCore/Monitor/Device/SensorsDataForStation'; //获取历史信息

const GET_DICTIONARY_LIST =
  'https://www.fastmock.site/mock/162c15dca15c4dba9ba51e0a0b76929b/api/PandaCore/OMS/Data/GetDataDictionaryList'; //获取数据字典信息

// const GET_HISTORY_INFO = '/api/PandaCore/GCK/Device/SensorsDataForStation'; //获取历史信息

// const GET_DICTIONARY_LIST = '/api/PandaCore/OMS/Data/GetDataDictionaryList'; //获取数据字典信息

const historyInfoService = {
  getHistoryInfo: {
    url: GET_HISTORY_INFO,
    method: REQUEST_METHOD_POST,
    type: REQUEST_HTTP,
  },
  getDictionaryList: {
    url: GET_DICTIONARY_LIST,
    method: REQUEST_METHOD_GET,
    type: REQUEST_HTTP,
  },
};

const hsService = service(historyInfoService);

const getHistoryInfo = hsService.getHistoryInfo;
const getDictionaryList = hsService.getDictionaryList;

const Demo = () => {
  return (
    <div style={{ height: '800px' }}>
      <HistoryInfo
        title={'指标曲线'}
        tableProps={{ bordered: true, pagination: { pageSize: 20 } }}
        historyInfoService={getHistoryInfo}
        historyInfoParams={initialParams}
        dictionaryService={getDictionaryList}
        dictionaryParams={{ nodeID: 149 }}
      />
    </div>
  );
};

export default Demo;

const initialParams = {
  stream: [
    {
      stationCode: 'EGBF00000006',
      sensors: '出水瞬时流量,今日供水量,今日用电量',
      pointVersions: '二供泵房',
      dateFrom: '2021-05-09 15:01:21',
      dateTo: '2021-05-09 16:01:21',
    },
    {
      stationCode: 'EGJZ00007117',
      sensors: '进水压力,出水压力,泵1状态',
      pointVersions: '二供机组',
      dateFrom: '2021-05-09 15:01:21',
      dateTo: '2021-05-09 16:01:21',
    },
  ],
  ignoreOutliers: false, // 过滤异常值
  isVertical: false, // 是否展示竖表
  zoom: '', // 数据抽稀
  unit: '', // 数据抽稀 min h
};