import { Connect } from "@cqsjjb/jjb-dva-runtime";
import Page from "zy-react-library/components/Page";
import Search from "zy-react-library/components/Search";
import DictionarySelect from "zy-react-library/components/Select/Dictionary";
import Table from "zy-react-library/components/Table";
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
import useTable from "zy-react-library/hooks/useTable";
import { getLabelName } from "zy-react-library/utils";
import { NS_STOCK_PERSONNEL_AND_VEHICLES } from "~/enumerate/namespace";

const ENTRY_AND_EXIT_STATUS_ENUM = [
  { bianma: "1", name: "进" },
  { bianma: "0", name: "出" },
];

function VehicleRecords(props) {
  const [form] = Search.useForm();
  const query = useGetUrlQuery();
  const { tableProps, getData } = useTable(props["stockPersonnelAndVehiclesVehicleManagementVehicleRecordsList"], {
    form,
    params: { id: query.id },
  });

  return (
    <Page headerTitle="车辆进出记录">
      <Search
        options={[
          { name: "time", label: "进港时间", render: FORM_ITEM_RENDER_ENUM.DATE_RANGE },
          { name: "vehicleDepartureTime", label: "出港时间", render: FORM_ITEM_RENDER_ENUM.DATE_RANGE },
        ]}
        onFinish={getData}
        form={form}
      />
      <Table
        columns={[
          { title: "车辆所属人", dataIndex: "vehicleContactName" },
          { title: "车牌号", dataIndex: "vehiclePlateNumber" },
          {
            title: "车辆在港状态",
            dataIndex: "vehicleArrivalStatus",
          },
          { title: "入港闸口", dataIndex: "vehicleArrivalBarrier" },
          { title: "进港时间", dataIndex: "vehicleArrivalTime" },
          { title: "离港闸口", dataIndex: "vehicleDepartureBarrier" },
          { title: "离港时间", dataIndex: "vehicleDepartureTime" },
        ]}
        {...tableProps}
      />
    </Page>
  );
}

export default Connect([NS_STOCK_PERSONNEL_AND_VEHICLES], true)(VehicleRecords);
