Blame view

src/pages/finance/CompanyRelationCreate/index.tsx 2.12 KB
862b2d73   zhaofeng   往来单位关系设置
1
  import React, { useEffect, useState } from "react";
9cb5a96a   zhaofeng   关系设置保存
2
  import { Card, Steps, Table, Tabs } from "antd";
fd16749f   zhaofeng   往来单位关系设置
3
4
5
  import { PageHeaderWrapper } from "@ant-design/pro-layout";
  import { createStore } from "@/hooks/moz";
  import store from "./useStore";
fd16749f   zhaofeng   往来单位关系设置
6
7
  import SelectCorrespondenceUnits from "./components/SelectCorrespondenceUnits";
  import RelationshipSettings from "./components/RelationshipSettings";
9cb5a96a   zhaofeng   关系设置保存
8
  import { CompanyRelationListVO } from "@/pages/finance/CompanyRelationAuth/api";
fd16749f   zhaofeng   往来单位关系设置
9
10
11
12
13
14
  
  const { Column } = Table;
  const { TabPane } = Tabs;
  
  export const { Provider, useStore } = createStore(store);
  
862b2d73   zhaofeng   往来单位关系设置
15
16
  function CompanyRelationCreate(props) {
    const pathParams = props.location.state || {};
fd16749f   zhaofeng   往来单位关系设置
17
18
19
20
    const { Step } = Steps;
    const [current, setCurrent] = useState<number>(0);
    const {
      selected,
862b2d73   zhaofeng   往来单位关系设置
21
      // loading,
fd16749f   zhaofeng   往来单位关系设置
22
23
      selectedRelation,
      setSelectedRelation,
fd16749f   zhaofeng   往来单位关系设置
24
25
      submitLoading,
      setSubmitLoading,
862b2d73   zhaofeng   往来单位关系设置
26
27
28
      // setLoading,
      companyParams,
      setCompanyParams,
fd16749f   zhaofeng   往来单位关系设置
29
30
    } = useStore();
  
862b2d73   zhaofeng   往来单位关系设置
31
32
33
34
    useEffect(() => {
      setCompanyParams({ ...pathParams });
    }, []);
  
fd16749f   zhaofeng   往来单位关系设置
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
    const rowSelection = {
      onChange: (selectedRowKeys: React.Key[], selectedRows: CompanyRelationListVO[]) => {
        setSelectedRelation([...selectedRows]);
      },
      getCheckboxProps: (record: CompanyRelationListVO) => ({
        name: String(record.compId),
      }),
    };
  
    return (
      <PageHeaderWrapper title="往来单位关系设置">
        <Card>
          <Steps type="navigation" current={current} className="site-navigation-steps">
            <Step title="选择往来单位" />
            <Step title="关系设置" />
          </Steps>
          <Tabs
            style={{ marginTop: 40 }}
            activeKey={String(current)}
            tabBarStyle={{ display: "hidden" }}
            renderTabBar={() => <div />}
          >
            <TabPane key="0">
              <SelectCorrespondenceUnits onNext={() => setCurrent(current + 1)} />
            </TabPane>
            <TabPane key="1">
              <RelationshipSettings onPrevious={() => setCurrent(0)} />
            </TabPane>
          </Tabs>
        </Card>
      </PageHeaderWrapper>
    );
  }
  
862b2d73   zhaofeng   往来单位关系设置
69
  export default (props) => (
fd16749f   zhaofeng   往来单位关系设置
70
    <Provider>
862b2d73   zhaofeng   往来单位关系设置
71
      <CompanyRelationCreate {...props} />
fd16749f   zhaofeng   往来单位关系设置
72
73
    </Provider>
  );