/*
 * @Author: donghao donghao@supervision.ltd
 * @Date: 2024-04-23 17:00:00
 * @LastEditors: donghao donghao@supervision.ltd
 * @LastEditTime: 2024-04-28 17:55:58
 * @FilePath: \general-ai-platform-web\src\pages\Business\DeviceGroup\components\baseInfo.tsx
 * @Description: 基本信息展示
 *
 */

import { ProDescriptions } from '@ant-design/pro-components';
import { FormattedMessage } from '@umijs/max';

type BaseInfoProps = {
  info: Record<string, any>;
};

const BaseInfo: React.FC<BaseInfoProps> = ({ info }) => {
  // 设备基本信息
  const DeviceDetailColumns = [
    {
      title: <FormattedMessage id="device_group.tree_node.name" defaultMessage="节点名称" />,
      dataIndex: 'name',
    },
    {
      title: <FormattedMessage id="device_group.tree_node.fatherName" defaultMessage="上级节点" />,
      dataIndex: 'fatherName',
    },
    {
      title: <FormattedMessage id="device_group.tree_node.address" defaultMessage="地址" />,
      dataIndex: 'address',
    },
    {
      title: <FormattedMessage id="device_group.tree_node.lonlat" defaultMessage="经纬度" />,
      dataIndex: 'lonlat',
      render: (_, record) => {
        return record?.lon + ',' + record?.lat;
      },
    },
    {
      title: <FormattedMessage id="device_group.tree_node.managerName" defaultMessage="负责人" />,
      dataIndex: 'managerName',
    },
    {
      title: (
        <FormattedMessage id="device_group.tree_node.managerPhone" defaultMessage="联系方式" />
      ),
      dataIndex: 'managerPhone',
    },
    {
      title: <FormattedMessage id="device_group.tree_node.remark" defaultMessage="简介" />,
      dataIndex: 'remark',
    },
  ];
  return (
    <div className="gn_table_descriptions bg_active_1">
      <ProDescriptions column={3} columns={DeviceDetailColumns} dataSource={info}></ProDescriptions>
    </div>
  );
};

export default BaseInfo;
