Basic.tsx 1.93 KB
Newer Older
1 2
import React, { useState } from 'react';
import { Button } from 'antd';
3
import PandaConfiguration from '../index';
李纪文's avatar
李纪文 committed
4
// import PandaConfigurationView from '../../es/index';
涂茜's avatar
涂茜 committed
5
const Demo = () => {
6 7 8 9
  const [name, setName] = useState('水厂工艺流程段');
  const [devices, setDevices] = useState(
    'EQZT00000008,EQZT00000007,CPDA00000001,JYBZ00000003,JYBZ00000005,JYBZ00000004,SC00000003',
  );
涂茜's avatar
涂茜 committed
10
  return (
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
    <>
      <div style={{ width: '100%', height: '600px', background: '#242835' }}>
        <PandaConfiguration
          name={name}
          devices={devices.split(',')}
          // name={'崇左丽江水厂原水泵房'}
          // devices={'EQZT00000007,CPBA00000001,CPAA00000001,EQZT00000008,CPDA00000001,CPAD00000001,LJSC00000002,EQZT00000005,EQZT00000004,EQZT00000002,EQZT00000003'.split(
          //   ',',
          // )}
          // name={'丽江水厂原水提升泵D单元'}
          // devices={'CPAA00000001, CPAD00000001, LJSC00000002'.split(',')}
          config={globalConfig}
          deviceName={['工艺流程1', '工艺流程2', '工艺流程3']}
          // isZoom={true}
          // flowShow={false}
        />
      </div>
      <Button
        onClick={() => {
          setName('崇左丽江水厂原水泵房');
          setDevices(
            'EQZT00000007,CPBA00000001,CPAA00000001,EQZT00000008,CPDA00000001,CPAD00000001,LJSC00000002,EQZT00000005,EQZT00000004,EQZT00000002,EQZT00000003',
          );
        }}
        style={{ margin: '10px' }}
      >
        改变组态名称
      </Button>
    </>
涂茜's avatar
涂茜 committed
40 41 42 43 44 45 46
  );
};

export default Demo;

const globalConfig = {
  token: 'a1372ef0ce7b4e4884d31cfd99fe92f6',
47
  mqtt_iotIP: 'emqttd10.panda-water.cn:443',
涂茜's avatar
涂茜 committed
48
  mqtt_path: '/mqtt',
49 50
  mqtt_IsSSL: true,
  mqtt_site_code: 'site_dc8302ni',
涂茜's avatar
涂茜 committed
51 52
  mqtt_mess: {
    MessageLevel: '1.0',
53 54 55 56 57 58 59
    TcpIP: 'emqttd10.panda-water.cn',
    TcpPort: 443,
    site_code: 'site_dc8302ni',
  },
  userInfo: {
    LocalSite: 'site_dc8302ni',
    site: '',
涂茜's avatar
涂茜 committed
60 61
  },
};