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

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

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

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

  return (
    <div>
      <Divider titlePlacement="start">基本信息</Divider>
      <Descriptions
        bordered
        column={1}
        items={[
          { label: "救援队名称", children: info.teamName },
          { label: "类型", children: info.teamTypeName },
          { label: "负责人单位或部门", children: info.chargeOrgDept },
          { label: "队长", children: info.captainName },
          { label: "队长电话", children: info.captainPhone },
          { label: "指挥人员", children: info.commandCrew },
          { label: "建立日期", children: info.establishDate },
          { label: "所属区域或范围", children: info.regionScopeName },
          { label: "职责和任务范围", children: info.dutyScope },
        ]}
      />
      <Divider titlePlacement="start">队员信息</Divider>
      <Table
        columns={[
          { title: "队员", dataIndex: "personName" },
          { title: "队员电话", dataIndex: "personPhone" },
        ]}
        dataSource={info.rescueMembers || []}
        pagination={false}
        options={false}
        disabledResizer
      />
    </div>
  );
};

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