Blame view

src/pages/Invoice/InvoiceRecord/components/InvoicingModal.tsx 1.63 KB
曾国涛 authored
1
import { RESPONSE_CODE } from '@/constants/enum';
2
3
import { postServiceInvoiceInvoicing } from '@/services';
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}
26
      onFinish={async (values) => {
曾国涛 authored
27
28
        let res = await postServiceInvoiceInvoicing({
          data: {
29
            ...values,
曾国涛 authored
30
31
32
33
34
35
            invoiceRecordIds: selectedRowKeys,
          },
        });
        if (res.result === RESPONSE_CODE.SUCCESS) {
          message.success(res.message);
        }
曾国涛 authored
36
        reloadRecordTable();
曾国涛 authored
37
38
39
        message.success('提交成功');
        return true;
      }}
40
    >
41
      {/*<ProFormSelect
42
43
44
45
46
47
48
49
50
51
52
53
54
        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: '请选择开票账号!' }]}
55
      />*/}
56
    </ModalForm>
曾国涛 authored
57
58
  );
};