Blame view

src/pages/Invoice/components/InvoicingModal.tsx 1.12 KB
曾国涛 authored
1
2
import { RESPONSE_CODE } from '@/constants/enum';
import { postServiceInvoiceInvoicing } from '@/services';
曾国涛 authored
3
import { ModalForm } from '@ant-design/pro-components';
曾国涛 authored
4
5
import { Button, Form, message } from 'antd';
曾国涛 authored
6
export default ({ selectedRowKeys, reloadRecordTable }) => {
曾国涛 authored
7
8
9
10
11
12
13
14
  const [form] = Form.useForm<{ name: string; company: string }>();
  return (
    <ModalForm<{
      name: string;
      company: string;
    }>
      title="开票"
      trigger={
曾国涛 authored
15
        <Button type="primary" disabled={selectedRowKeys?.length === 0}>
曾国涛 authored
16
17
18
19
20
21
22
23
24
25
          开票
        </Button>
      }
      form={form}
      autoFocusFirstInput
      modalProps={{
        destroyOnClose: true,
        onCancel: () => console.log('run'),
      }}
      submitTimeout={2000}
曾国涛 authored
26
27
28
29
30
31
32
33
34
      onFinish={async () => {
        let res = await postServiceInvoiceInvoicing({
          data: {
            invoiceRecordIds: selectedRowKeys,
          },
        });
        if (res.result === RESPONSE_CODE.SUCCESS) {
          message.success(res.message);
        }
曾国涛 authored
35
        reloadRecordTable();
曾国涛 authored
36
37
38
        message.success('提交成功');
        return true;
      }}
曾国涛 authored
39
    ></ModalForm>
曾国涛 authored
40
41
  );
};