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_VEHICLE_APPLY } from "~/enumerate/namespace";
import ViewPage from "../../Vehicle/View";

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

  const query = useGetUrlQuery();

  const getData = async () => {
    const { data } = await props["enclosedAreaVehicleApplyRecordsAccessRecordsList"]({ 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" },
        ]}
        dataSource={accessRecordsList}
      />
    </ViewPage>
  );
}

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