import React from 'react';
import { Col, Row } from 'antd';
import { Link } from 'umi';
import Styles from './style.less';

export default React.forwardRef((props, ref) => {
  const { data = {}, onClose } = props;

  return (
    <div ref={ref} className={Styles['info-window']}>
      <div style={{ textAlign: 'right', fontSize: '24px' }} onClick={onClose}>
        ×
      </div>
      <Row gutter={16}>
        <Col span={8}>农机名称</Col>
        <Col span={16}>
          <Link
            to={`/Machinery/OperationStatistics/detail?machineryId=${data.machineryId}`}
            target="_blank"
          >
            {data.machineryName || ''}
          </Link>
        </Col>
      </Row>
      <Row gutter={16}>
        <Col span={8}>设备编号</Col>
        <Col span={16}>{data.deviceNo || ''}</Col>
      </Row>
      <Row gutter={16}>
        <Col span={8}>设备类型</Col>
        <Col span={16}>{data.deviceType === 'shensong' ? '深松' : '飞防'}</Col>
      </Row>
      <Row gutter={16}>
        <Col span={8}>当前状态</Col>
        <Col span={16}>{data.onlineStatus === 1 ? '在线' : '下线'}</Col>
      </Row>
      <Row gutter={16}>
        <Col span={8}>位置信息</Col>
        <Col span={16}>{data.loc || ''}</Col>
      </Row>
    </div>
  );
});
