Basic.tsx 3.55 KB
Newer Older
涂茜's avatar
涂茜 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
import React from 'react';
import PandaConfigurationView from '../index';
import { service } from '@wisdom-utils/utils';

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

const GET_SKETCHPAD_LIST =
  'https://www.fastmock.site/mock/162c15dca15c4dba9ba51e0a0b76929b/api/PandaCore/GCK/SketchPad/List';
const GET_FILE_SKETCHPAD_CONTENT =
  'https://www.fastmock.site/mock/162c15dca15c4dba9ba51e0a0b76929b/api/PandaCore/GCK/SketchPad/SketchContent';
const GET_POINT_ADDRESS =
  'https://www.fastmock.site/mock/162c15dca15c4dba9ba51e0a0b76929b/api/PandaCore/GCK/PointAddress/GetPointAddress';
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_SKETCHPAD_LIST = '/api/PandaCore/GCK/SketchPad/List'; //获取画板列表接口
// const GET_FILE_SKETCHPAD_CONTENT = '/api/PandaCore/GCK/SketchPad/SketchContent'; //获取画板JSON
// const GET_POINT_ADDRESS = '/api/PandaCore/GCK/PointAddress/GetPointAddress'; //获取点表地址信息
// const GET_HISTORY_INFO = '/api/PandaCore/GCK/Device/SensorsDataForStation'; //获取历史信息
// const GET_DICTIONARY_LIST = '/api/PandaCore/OMS/DataManger/GetDataDictionaryList'; //获取数据字典信息

const configurationService = {
  getSketchPadList: {
    url: GET_SKETCHPAD_LIST, // 获取画板列表接口
    method: REQUEST_METHOD_GET,
    type: REQUEST_HTTP,
  },
  getSketchPadContent: {
    url: GET_FILE_SKETCHPAD_CONTENT, // 获取画板JSON
    method: REQUEST_METHOD_GET,
    type: REQUEST_HTTP,
  },
  getPointAddress: {
    url: GET_POINT_ADDRESS, // 获取点表地址信息
    method: REQUEST_METHOD_GET,
    type: REQUEST_HTTP,
  },
  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 cvService = service(configurationService);

const getPointAddress = cvService.getPointAddress;
const getSketchPadContent = cvService.getSketchPadContent;
const getSketchPadList = cvService.getSketchPadList;
const getHistoryInfo = cvService.getHistoryInfo;
const getDictionaryList = cvService.getDictionaryList;

const Demo = () => {
  return (
    <div style={{ width: '100%', height: '600px', background: '#242835' }}>
      <PandaConfigurationView
        name={'组态测试'}
        devices={['ZTCS00000001', 'ZTCS00000002', 'ZTCS00000003', 'ZTCS00000004']}
        pointAddressService={getPointAddress}
        sketchPadListService={getSketchPadList}
        sketchPadContentService={getSketchPadContent}
        sketchPadListParams={{
          _site: '',
          siteCode: '151_ReactWeb5',
          queryInfo: '',
          version: '全部',
          name: '组态测试',
        }}
        historyInfoService={getHistoryInfo}
        dictionaryService={getDictionaryList}
        dictionaryParams={{ nodeID: 149 }}
        globalConfig={globalConfig}
      />
    </div>
  );
};

export default Demo;

const globalConfig = {
  baseURI: 'http://192.168.12.71:8080',
  userInfo: {
    site: '',
  },
  token: 'a1372ef0ce7b4e4884d31cfd99fe92f6',
  mqtt_iotIP: '192.168.12.9:8083',
  mqtt_path: '/mqtt',
  mqtt_IsSSL: false,
  mqtt_mess: {
    MessageLevel: '1.0',
    TcpIP: '192.168.12.9',
    TcpPort: 8083,
    site_code: '151_ReactWeb5',
  },
};