index.js 1.85 KB
Newer Older
涂茜's avatar
涂茜 committed
1 2 3
import React, { useContext } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
4 5
import { Input, Radio, ConfigProvider } from 'antd';
import BasicTable from '@wisdom-components/basictable';
涂茜's avatar
涂茜 committed
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
import './index.less';

const RealTimeInfo = (props) => {
  const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
  const prefixCls = getPrefixCls('realtime-info');

  const { placeholder, targetValue, guid, updateTime, onSearch, onRadioChange } = props;

  return (
    <div className={classNames(prefixCls)}>
      <div className={classNames(`${prefixCls}-search-wrap`)}>
        <div className={classNames(`${prefixCls}-search`)}>
          <div className={classNames(`${prefixCls}-label`)}>搜索:</div>
          <Input placeholder={placeholder} onChange={onSearch} onPressEnter={onSearch} />
        </div>
        <div className={classNames(`${prefixCls}-target`)}>
          <div className={classNames(`${prefixCls}-label`)}>指标:</div>
          <Radio.Group onChange={onRadioChange} defaultValue={targetValue}>
            <Radio.Button value="emphasis">重点指标</Radio.Button>
            <Radio.Button value="all">全部</Radio.Button>
          </Radio.Group>
        </div>
      </div>
      <div className={classNames(`${prefixCls}-code-wrap`)}>
        <div>采集编码:{guid}</div>
        <div>更新时间:{updateTime}</div>
      </div>
33
      <BasicTable {...props} />
涂茜's avatar
涂茜 committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
    </div>
  );
};

RealTimeInfo.defaultProps = {
  placeholder: '输入指标名称等',
  guid: '--',
  targetValue: 'emphasis',
  updateTime: '--',
  onSearch: () => {},
  onRadioChange: () => {},
};

RealTimeInfo.propTypes = {
  placeholder: PropTypes.string,
  guid: PropTypes.string,
  targetValue: PropTypes.string,
  updateTime: PropTypes.string,
  onSearch: PropTypes.func,
  onRadioChange: PropTypes.func,
};

export default RealTimeInfo;