import { Connect } from "@cqsjjb/jjb-dva-runtime";
import { Divider } from "antd";
import { useEffect, useState } from "react";
import Table from "zy-react-library/components/Table";
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
import { NS_ENCLOSED_AREA_PERSONNEL_APPLY } from "~/enumerate/namespace";
import ViewPage from "../../Personnel/View";

function View(props) {
  const [accessRecordsList, setAccessRecordsList] = useState([]);

  const query = useGetUrlQuery();

  const getData = async () => {
    const { data } = await props["enclosedAreaPersonnelApplyRecordsAccessRecordsList"]({ id: query.id });
    setAccessRecordsList(data);
  };

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

  return (
    <ViewPage {...props}>
      <Divider orientation="left">进出记录</Divider>
      <Table
        style={{ marginTop: 16 }}
        options={false}
        disabledResizer={true}
        pagination={false}
        columns={[
          { title: "姓名", dataIndex: "todo1" },
          { title: "部门", dataIndex: "todo2" },
          { title: "手机号", dataIndex: "todo3" },
          { title: "出入状态", dataIndex: "todo4" },
          { title: "记录时间", dataIndex: "todo5" },
        ]}
        dataSource={accessRecordsList}
      />
    </ViewPage>
  );
}

export default Connect([NS_ENCLOSED_AREA_PERSONNEL_APPLY], true)(View);
