Blame view

src/pages/finance/SpecialAccount/FinancingCompany/components/Filter.tsx 1.94 KB
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  import React, { useCallback } from "react";
  import { Button, Col, Row, Select } from "antd";
  import { useStore } from "../index";
  
  const { Option } = Select;
  
  export default function AccountList() {
    const { setVisible, dealerList, setDealerId, dealerId, dealerLoading, brandList, brandLoading, brandId, setBrandId } = useStore();
  
    const searchDealer = useCallback((dealerId) => {
      setDealerId(dealerId);
    }, []);
  
    const searchBrand = useCallback((brandId) => {
      setBrandId(brandId);
    }, []);
  
    return (
      <div
        style={{
          display: "flex",
          flexDirection: "row",
          justifyContent: "space-between",
          alignItems: "center",
          marginBottom: 20,
        }}
      >
        <Row style={{ display: "flex", flex: 1, alignItems: 'center' }}>
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
          <Col span={6}>
            <Select
              placeholder="请选择商家"
              showSearch
              loading={dealerLoading}
              optionFilterProp="children"
              onChange={searchDealer}
              value={dealerId && dealerId > 0 ? dealerId : undefined}
              style={{ width: 260 }}
            >
              {dealerList.map((dealer) => (
                <Option value={dealer.id} key={dealer.id}>
                  {dealer.name}
                </Option>
              ))}
            </Select>
          </Col>
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
          <Col span={6}>
            <Select
              placeholder="请选择品牌"
              showSearch
              loading={brandLoading}
              optionFilterProp="children"
              onChange={searchBrand}
              value={brandId && brandId > 0 ? brandId : undefined}
              style={{ width: 160 }}
            >
              {brandList.map((brand) => (
                <Option value={brand.id} key={brand.id}>
                  {brand.name}
                </Option>
              ))}
            </Select>
          </Col>
        </Row>
        <Button type="primary" hidden={!dealerId} onClick={() => setVisible(true)}>
          新增
        </Button>
      </div>
    );
  }