Commit 7899437ad4f1eef1fc389a29da52d449d444c69f
1 parent
41afef47
feat: 导入重量和体积功能开放
Showing
2 changed files
with
52 additions
and
0 deletions
src/pages/Order/components/ImportExpressBillModal.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | ||
2 | +import { postOrderImportImportWeightAndVolume } from '@/services'; | ||
3 | +import { ModalForm, ProFormUploadDragger } from '@ant-design/pro-components'; | ||
4 | +import { Button, Form, message } from 'antd'; | ||
5 | + | ||
6 | +export default () => { | ||
7 | + const [form] = Form.useForm(); | ||
8 | + const [messageApi, contextHolder] = message.useMessage(); | ||
9 | + return ( | ||
10 | + <> | ||
11 | + <ModalForm | ||
12 | + title="导入重量、体积" | ||
13 | + trigger={<Button type="primary">导入重量、体积</Button>} | ||
14 | + form={form} | ||
15 | + autoFocusFirstInput | ||
16 | + modalProps={{ | ||
17 | + destroyOnClose: true, | ||
18 | + }} | ||
19 | + submitTimeout={2000} | ||
20 | + onFinish={async (values) => { | ||
21 | + console.log(values); | ||
22 | + const formData = new FormData(); | ||
23 | + formData.append('file', values.express[0].originFileObj); | ||
24 | + messageApi.open({ | ||
25 | + type: 'loading', | ||
26 | + content: '正在导入...', | ||
27 | + duration: 0, | ||
28 | + }); | ||
29 | + const res = await postOrderImportImportWeightAndVolume({ | ||
30 | + data: formData, | ||
31 | + headers: { | ||
32 | + 'Content-Type': | ||
33 | + 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq', | ||
34 | + }, | ||
35 | + }); | ||
36 | + if (res.result === RESPONSE_CODE.SUCCESS) { | ||
37 | + return true; | ||
38 | + } else { | ||
39 | + message.error('导入失败'); | ||
40 | + } | ||
41 | + messageApi.destroy(); | ||
42 | + }} | ||
43 | + > | ||
44 | + <ProFormUploadDragger max={1} label="上传快递单" name="express" /> | ||
45 | + </ModalForm> | ||
46 | + {contextHolder} | ||
47 | + </> | ||
48 | + ); | ||
49 | +}; |
src/pages/Order/index.tsx
1 | import ButtonConfirm from '@/components/ButtomConfirm'; | 1 | import ButtonConfirm from '@/components/ButtomConfirm'; |
2 | import { RESPONSE_CODE } from '@/constants/enum'; | 2 | import { RESPONSE_CODE } from '@/constants/enum'; |
3 | +import ImportExpressBillModal from '@/pages/Order/components/ImportExpressBillModal'; | ||
3 | import InvoicingDrawerForm from '@/pages/Order/components/InvoicingDrawerForm'; | 4 | import InvoicingDrawerForm from '@/pages/Order/components/InvoicingDrawerForm'; |
4 | import ReissueModal from '@/pages/Order/components/ReissueModal'; | 5 | import ReissueModal from '@/pages/Order/components/ReissueModal'; |
5 | import { | 6 | import { |
@@ -3896,6 +3897,8 @@ const OrderPage = () => { | @@ -3896,6 +3897,8 @@ const OrderPage = () => { | ||
3896 | 3897 | ||
3897 | toolBtns.push(radioGroup); | 3898 | toolBtns.push(radioGroup); |
3898 | 3899 | ||
3900 | + toolBtns.push(<ImportExpressBillModal></ImportExpressBillModal>); | ||
3901 | + | ||
3899 | //导出按钮配置 | 3902 | //导出按钮配置 |
3900 | const exportItems: MenuProps['items'] = [ | 3903 | const exportItems: MenuProps['items'] = [ |
3901 | { | 3904 | { |