import React from 'react';
import { Tabs, Card, ConfigProvider } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import AreaTable from './components/AreaTable';
import StorageTable from './components/StorageTable';
import SeriesTable from './components/SeriesTable';
import PartTable from './components/PartTable';
import StoragePartTable from './components/StoragePartTable';
import zhCN from "antd/lib/locale-provider/zh_CN";
import st from "@/pages/pms/partPlan/PlanShipping/style.less";
import Filter from './components/Filter';
import {createStore} from "@/hooks/moz";
import store from "./useStore";
import OutFlowModal from './components/OutFlowModal';
import CustBuyModal from './components/CustBuyModal';

export const { Provider, useStore } = createStore(store);

function Index() {
  const { setKey } = useStore();
  return (
    <PageHeaderWrapper title="计划池">
      <ConfigProvider locale={zhCN}>
        <Card className={st.page}>
          <Filter />
          <Tabs defaultActiveKey="1" onChange={(key: string) => setKey(key)}>
            <Tabs.TabPane tab="按区域库" key="1">
              <AreaTable type={1} />
            </Tabs.TabPane>
            <Tabs.TabPane tab="按库房" key="2">
              <StorageTable type={2} />
            </Tabs.TabPane>
            <Tabs.TabPane tab="按车系" key="3">
              <SeriesTable type={3} />
            </Tabs.TabPane>
            <Tabs.TabPane tab="按配件" key="5">
              <PartTable type={5} />
            </Tabs.TabPane>
            <Tabs.TabPane tab="按库房配件" key="6">
              <StoragePartTable type={6} />
            </Tabs.TabPane>
          </Tabs>
          <OutFlowModal />
          <CustBuyModal />
        </Card>
      </ConfigProvider>
    </PageHeaderWrapper>
  );
}
// @ts-ignore
export default () => <Provider><Index /></Provider>;
