曾国涛
authored
|
1
|
import Invoice from '@/pages/Invoice/waitProcessRecord/components/Invoice';
|
曾国涛
authored
|
2
|
import { postServiceInvoiceGetInvoiceRecord } from '@/services';
|
曾国涛
authored
|
3
|
import { ModalForm } from '@ant-design/pro-components';
|
曾国涛
authored
|
4
5
|
import { Form } from 'antd';
import { useEffect, useState } from 'react';
|
曾国涛
authored
|
6
|
|
曾国涛
authored
|
7
8
|
export default ({ recordId, getRecord, button }) => {
const [data, setData] = useState<any>({});
|
曾国涛
authored
|
9
10
11
12
13
14
15
16
|
const getData = async () => {
let ret = await postServiceInvoiceGetInvoiceRecord({
query: {
id: recordId,
},
});
setData(ret.data);
};
|
曾国涛
authored
|
17
|
useEffect(() => {
|
曾国涛
authored
|
18
19
20
|
if (recordId) {
getData();
}
|
曾国涛
authored
|
21
|
}, []);
|
曾国涛
authored
|
22
|
const [form] = Form.useForm();
|
曾国涛
authored
|
23
24
25
|
return (
<ModalForm
title="预览发票"
|
曾国涛
authored
|
26
27
|
trigger={button ? button : <a type="primary">预览</a>}
onOpenChange={(open) => {
|
曾国涛
authored
|
28
29
30
31
32
33
|
if (open) {
if (getRecord) {
setData(getRecord());
} else {
getData();
}
|
曾国涛
authored
|
34
35
|
}
}}
|
曾国涛
authored
|
36
37
38
|
width={1200}
form={form}
autoFocusFirstInput
|
曾国涛
authored
|
39
|
submitter={false}
|
曾国涛
authored
|
40
41
42
43
44
|
modalProps={{
destroyOnClose: true,
}}
>
<hr />
|
曾国涛
authored
|
45
|
<Invoice data={data} />
|
曾国涛
authored
|
46
47
48
|
</ModalForm>
);
};
|