import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { Descriptions } from "antd";
import { useEffect, useState } from "react";
import PreviewImg from "zy-react-library/components/PreviewImg";
import { isEmptyToWhether } from "zy-react-library/utils";
import { NS_BI_MARK_INFO } from "~/enumerate/namespace";

const FirePointLocation = (props) => {
  const [info, setInfo] = useState({});

  const getData = async () => {
    const { data } = await props.firePointInfo({ id: props.id });

    setInfo(data);
  };

  useEffect(() => {
    getData();
  }, []);

  return (
    <div>
      <Descriptions
        bordered
        column={1}
        items={[
          { label: "消防区域", children: info.fireRegionName },
          { label: "负责部门", children: info.departmentName },
          { label: "点位负责人", children: info.userName },
          { label: "消防点位", children: info.firePointName },
          { label: "消防点位编码", children: info.firePointCode },
          { label: "经度", children: info.longitude },
          { label: "维度", children: info.latitude },
          { label: "是否关联NFC", children: isEmptyToWhether(info.nfcFlag) },
          { label: "点检照片", children: (<PreviewImg files={info.urlList} />) },
        ]}
      />
    </div>
  );
};

export default Connect([NS_BI_MARK_INFO], true)(FirePointLocation);
