index.tsx
2.67 KB
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
29
30
31
32
33
34
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import React, { useCallback, useState } from "react";
import { Row, Col, Select } from "antd";
import _ from "lodash";
interface Props {
setParams:any;
innerParams:any;
cityList:any[];
compList:BearCostSetting.Comp[];
}
interface SearchData {
tradeCompId?:number;//往来单位id
sendAreaNo?:string;//寄件地区编号
arriveAreaNo?:string;//到达地区编号
}
function Filter({ compList, cityList, setParams, innerParams }:Props) {
const [searchData, setSearchData] = useState<SearchData>({});
return (
<Row style={{flex: 1}}>
<Col span={8} style={{marginRight: 10}}>
<Select
placeholder="请选择快递公司"
showSearch
optionFilterProp="children"
allowClear
style={{ minWidth: 260, maxWidth: 280 }}
onChange={(tradeCompId) => {
setSearchData({...searchData, tradeCompId});
setParams({...innerParams, ...searchData, tradeCompId}, true);
}}
>
{
compList.map(item => (
<Select.Option value={item.id} key={item.id}>
{item.name}
</Select.Option>
))
}
</Select>
</Col>
<Col span={6} style={{marginRight: 10}}>
<Select
placeholder="请选择寄件地区"
showSearch
optionFilterProp="children"
allowClear
style={{ width: 200 }}
onChange={(sendAreaNo) => {
setSearchData({...searchData, sendAreaNo});
setParams({...innerParams, ...searchData, sendAreaNo}, true);
}}
>
{
cityList.map(item => (
<Select.Option value={item.bh} key={item.bh}>
{item.fullName}
</Select.Option>
))
}
</Select>
</Col>
<Col span={6} style={{marginRight: 10}}>
<Select
placeholder="请选择到达地区"
showSearch
optionFilterProp="children"
allowClear
style={{ width: 200 }}
onChange={(arriveAreaNo) => {
setSearchData({...searchData, arriveAreaNo});
setParams({...innerParams, ...searchData, arriveAreaNo}, true);
}}
>
{
cityList.map(item => (
<Select.Option value={item.bh} key={item.bh}>
{item.fullName}
</Select.Option>
))
}
</Select>
</Col>
</Row>
);
}
export default Filter;