InvoicingModal.tsx
1.63 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
import { RESPONSE_CODE } from '@/constants/enum';
import { postServiceInvoiceInvoicing } from '@/services';
import { ModalForm } from '@ant-design/pro-components';
import { Button, Form, message } from 'antd';
export default ({ selectedRowKeys, reloadRecordTable }) => {
const [form] = Form.useForm<{ name: string; company: string }>();
return (
<ModalForm<{
name: string;
company: string;
}>
title="开票"
trigger={
<Button type="primary" disabled={selectedRowKeys?.length === 0}>
开票
</Button>
}
form={form}
autoFocusFirstInput
modalProps={{
destroyOnClose: true,
onCancel: () => console.log('run'),
}}
submitTimeout={2000}
onFinish={async (values) => {
let res = await postServiceInvoiceInvoicing({
data: {
...values,
invoiceRecordIds: selectedRowKeys,
},
});
if (res.result === RESPONSE_CODE.SUCCESS) {
message.success(res.message);
}
reloadRecordTable();
message.success('提交成功');
return true;
}}
>
{/*<ProFormSelect
name="invoicingAccount"
label="开票账号"
request={async () => {
const res = await postServiceInvoiceGetInvoicingAccount();
return res.data.map((item) => {
return {
label: item.accountText,
value: item.account,
};
});
}}
placeholder="请选择开票账号"
rules={[{ required: true, message: '请选择开票账号!' }]}
/>*/}
</ModalForm>
);
};