FinancialEditDrawer.tsx
1.54 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
// import { PlusOutlined } from '@ant-design/icons';
import { RESPONSE_CODE } from '@/constants/enum';
import { postServiceOrderNoNeedInvoicingEdit } from '@/services';
import { DrawerForm, ProFormDatePicker } from '@ant-design/pro-components';
import { Form, message } from 'antd';
export default ({ subOrders, setVisible, onClose }) => {
const subOrderIds = subOrders?.map((subOrder) => {
return subOrder?.id;
});
const [form] = Form.useForm<{ collectMoneyTime: string; subIds: [] }>();
return (
<DrawerForm<{
collectMoneyTime: string;
subIds: [];
}>
open
title="收款时间"
resize={{
onResize() {
console.log('resize!');
},
maxWidth: window.innerWidth * 0.8,
minWidth: 400,
}}
initialValues={subOrders[0]}
form={form}
autoFocusFirstInput
drawerProps={{
destroyOnClose: true,
}}
submitTimeout={2000}
onFinish={async () => {
let res = await postServiceOrderNoNeedInvoicingEdit({
data: {
subIds: subOrderIds,
collectMoneyTime: form.getFieldValue('collectMoneyTime'),
},
});
if (res.result === RESPONSE_CODE.SUCCESS) {
message.success(res.message);
onClose();
}
}}
onOpenChange={(val) => {
return !val && setVisible(val);
}}
>
<ProFormDatePicker
key="collectMoneyTime"
width="lg"
name="collectMoneyTime"
label="收款时间"
/>
</DrawerForm>
);
};