537ed103
zhaofeng
投资主体添加筛选
|
1
|
import React, { useCallback, useEffect, useState } from "react";
|
606d8279
zhaofeng
投资主体111
|
2
3
4
5
|
import { Button, Row, Select, Input, Col } from "antd";
import { useStore } from "../index";
import { debounce } from "lodash";
import { CapitalAccountTypeEnum, ConfigType } from "@/pages/finance/entitys";
|
606d8279
zhaofeng
投资主体111
|
6
7
8
9
10
|
const { Option } = Select;
const Search = Input.Search;
export default function AccountList() {
|
537ed103
zhaofeng
投资主体添加筛选
|
11
|
const { triggerModal, brands, financeList, setInvestList, companys, dealers } = useStore();
|
537ed103
zhaofeng
投资主体添加筛选
|
12
13
|
// 存储删选条件
const [filterParams, setFilterParams] = useState({});
|
606d8279
zhaofeng
投资主体111
|
14
|
|
537ed103
zhaofeng
投资主体添加筛选
|
15
|
useEffect(() => {
|
537ed103
zhaofeng
投资主体添加筛选
|
16
17
18
19
20
21
22
23
24
25
26
27
28
|
let originList = financeList;
let res = [];
if (filterParams.brandId) {
//删选品牌
originList = originList.filter((item) => item.brandId === filterParams.brandId);
}
if (filterParams.mefCompId) {
//删选主机厂
originList = originList.filter((item) => item.mefCompId === filterParams.mefCompId);
}
if (filterParams.includeId) {
//删选包含商家 includeId
originList = originList.filter((item) => item.includeDealers?.find((y) => y.id === filterParams.includeId));
|
537ed103
zhaofeng
投资主体添加筛选
|
29
30
31
32
33
34
35
36
37
38
39
40
|
}
if (filterParams.creditDealerId) {
//删选授信商家 creditDealerId
originList = originList.filter((item) => item.creditDealerId === filterParams.creditDealerId);
}
if (filterParams.name) {
// 筛选投资主体 name
originList = originList.filter((item) => item.name?.indexOf(filterParams.name) >= 0);
}
res = originList;
setInvestList([...res]);
}, [filterParams]);
|
606d8279
zhaofeng
投资主体111
|
41
42
43
44
45
46
47
48
49
50
|
return (
<div
style={{
display: "flex",
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
marginBottom: 20,
}}
>
|
537ed103
zhaofeng
投资主体添加筛选
|
51
52
|
<div>
<Row justify="space-between" style={{ flexWrap: "nowrap" }}>
|
606d8279
zhaofeng
投资主体111
|
53
|
<Select
|
606d8279
zhaofeng
投资主体111
|
54
|
allowClear
|
537ed103
zhaofeng
投资主体添加筛选
|
55
|
placeholder="请选择品牌"
|
606d8279
zhaofeng
投资主体111
|
56
|
style={{ width: 200 }}
|
537ed103
zhaofeng
投资主体添加筛选
|
57
58
59
60
61
|
showSearch
optionFilterProp="children"
onChange={(brandId) => {
setFilterParams({ ...filterParams, brandId });
}}
|
606d8279
zhaofeng
投资主体111
|
62
63
64
65
66
67
68
|
>
{brands.map((brand) => (
<Option key={brand.id} value={brand.id}>
{brand.name}
</Option>
))}
</Select>
|
606d8279
zhaofeng
投资主体111
|
69
|
<Select
|
537ed103
zhaofeng
投资主体添加筛选
|
70
71
72
|
allowClear
placeholder="请选择主机厂"
style={{ width: 200, marginLeft: 50 }}
|
606d8279
zhaofeng
投资主体111
|
73
74
|
showSearch
optionFilterProp="children"
|
537ed103
zhaofeng
投资主体添加筛选
|
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
onChange={(mefCompId) => {
setFilterParams({ ...filterParams, mefCompId });
}}
>
{companys.map((comp) => (
<Option key={comp.id} value={comp.id}>
{comp.name}
</Option>
))}
</Select>
<Input
placeholder="请输入投资主体"
style={{ width: 200, marginLeft: 50 }}
onChange={(e) => {
setFilterParams({ ...filterParams, name: e.target.value });
}}
/>
</Row>
<Row style={{ flexWrap: "nowrap", marginTop: 10 }}>
<Select
|
606d8279
zhaofeng
投资主体111
|
95
|
allowClear
|
537ed103
zhaofeng
投资主体添加筛选
|
96
|
placeholder="请选择包含商家"
|
606d8279
zhaofeng
投资主体111
|
97
|
style={{ width: 200 }}
|
537ed103
zhaofeng
投资主体添加筛选
|
98
99
100
101
102
|
showSearch
optionFilterProp="children"
onChange={(includeId) => {
setFilterParams({ ...filterParams, includeId });
}}
|
606d8279
zhaofeng
投资主体111
|
103
|
>
|
537ed103
zhaofeng
投资主体添加筛选
|
104
105
106
|
{dealers.map((dealer) => (
<Option key={dealer.id} value={dealer.id}>
{dealer.name}
|
606d8279
zhaofeng
投资主体111
|
107
108
109
|
</Option>
))}
</Select>
|
537ed103
zhaofeng
投资主体添加筛选
|
110
|
<Select
|
606d8279
zhaofeng
投资主体111
|
111
|
allowClear
|
537ed103
zhaofeng
投资主体添加筛选
|
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
placeholder="请选择授信商家"
style={{ width: 200,marginLeft:50 }}
showSearch
optionFilterProp="children"
onChange={(creditDealerId) => {
setFilterParams({ ...filterParams, creditDealerId });
}}
>
{dealers.map((dealer) => (
<Option key={dealer.id} value={dealer.id}>
{dealer.name}
</Option>
))}
</Select>
</Row>
</div>
|
606d8279
zhaofeng
投资主体111
|
129
130
131
132
133
134
|
<Button type="primary" onClick={() => triggerModal({}, true)}>
新增
</Button>
</div>
);
}
|