InvoiceProjectSelect.tsx
940 Bytes
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
import { postServiceConstListInvoiceDetailNames } from '@/services';
import { enumToSelect } from '@/utils';
import { ProFormSelect } from '@ant-design/pro-components';
export const InvoiceProjectSelect = () => {
const fetchOptions = async (keywords) => {
const res = await postServiceConstListInvoiceDetailNames({
data: {
nameLike: keywords,
},
});
const data = res.data;
console.log('invoiceProject' + JSON.stringify(data));
return enumToSelect(data);
};
return (
<ProFormSelect
key="project"
width={500}
showSearch
name="project"
placeholder="请选择开票项目"
fieldProps={{
filterOption() {
return true;
},
}}
debounceTime={1000}
request={async (value, {}) => {
const keywords = value.keywords;
const data = await fetchOptions(keywords);
return data;
}}
/>
);
};