Commit f007db737e3c22f2eca28d15f91428e04856bef6
1 parent
dacbb1cc
feat: 开票功能开发
Showing
2 changed files
with
165 additions
and
0 deletions
src/pages/Order/components/InvoicingDrawerForm.tsx
0 → 100644
1 | +import { | ||
2 | + DrawerForm, | ||
3 | + ProForm, | ||
4 | + ProFormDateRangePicker, | ||
5 | + ProFormSelect, | ||
6 | + ProFormText, | ||
7 | +} from '@ant-design/pro-components'; | ||
8 | +import { Form, message } from 'antd'; | ||
9 | + | ||
10 | +const waitTime = (time: number = 100) => { | ||
11 | + return new Promise((resolve) => { | ||
12 | + setTimeout(() => { | ||
13 | + resolve(true); | ||
14 | + }, time); | ||
15 | + }); | ||
16 | +}; | ||
17 | + | ||
18 | +export default ({ subOrders, totalPayment, onClose }) => { | ||
19 | + const [form] = Form.useForm<{ name: string; company: string }>(); | ||
20 | + | ||
21 | + return ( | ||
22 | + <DrawerForm<{ | ||
23 | + name: string; | ||
24 | + company: string; | ||
25 | + }> | ||
26 | + title="新建表单" | ||
27 | + resize={{ | ||
28 | + onResize() { | ||
29 | + console.log('resize!'); | ||
30 | + }, | ||
31 | + maxWidth: window.innerWidth * 0.8, | ||
32 | + minWidth: 300, | ||
33 | + }} | ||
34 | + form={form} | ||
35 | + /*trigger={ | ||
36 | + <Button type="primary"> | ||
37 | + <PlusOutlined /> | ||
38 | + 新建表单 | ||
39 | + </Button> | ||
40 | + }*/ | ||
41 | + open={true} | ||
42 | + autoFocusFirstInput | ||
43 | + drawerProps={{ | ||
44 | + destroyOnClose: true, | ||
45 | + }} | ||
46 | + submitTimeout={2000} | ||
47 | + onFinish={async (values) => { | ||
48 | + await waitTime(2000); | ||
49 | + console.log(values); | ||
50 | + console.log(subOrders); | ||
51 | + console.log(totalPayment); | ||
52 | + message.success('提交成功'); | ||
53 | + onClose(); | ||
54 | + // 不返回不会关闭弹框 | ||
55 | + return true; | ||
56 | + }} | ||
57 | + > | ||
58 | + <ProForm.Group> | ||
59 | + <ProFormText | ||
60 | + name="name" | ||
61 | + width="md" | ||
62 | + label="签约客户名称" | ||
63 | + tooltip="最长为 24 位" | ||
64 | + placeholder="请输入名称" | ||
65 | + /> | ||
66 | + <ProFormText | ||
67 | + rules={[ | ||
68 | + { | ||
69 | + required: true, | ||
70 | + }, | ||
71 | + ]} | ||
72 | + width="md" | ||
73 | + name="company" | ||
74 | + label="我方公司名称" | ||
75 | + placeholder="请输入名称" | ||
76 | + /> | ||
77 | + </ProForm.Group> | ||
78 | + <ProForm.Group> | ||
79 | + <ProFormText | ||
80 | + width="md" | ||
81 | + name="contract" | ||
82 | + label="合同名称" | ||
83 | + placeholder="请输入名称" | ||
84 | + /> | ||
85 | + <ProFormDateRangePicker name="contractTime" label="合同生效时间" /> | ||
86 | + </ProForm.Group> | ||
87 | + <ProForm.Group> | ||
88 | + <ProFormSelect | ||
89 | + options={[ | ||
90 | + { | ||
91 | + value: 'chapter', | ||
92 | + label: '盖章后生效', | ||
93 | + }, | ||
94 | + ]} | ||
95 | + width="xs" | ||
96 | + name="useMode" | ||
97 | + label="合同约定生效方式" | ||
98 | + /> | ||
99 | + <ProFormSelect | ||
100 | + width="xs" | ||
101 | + options={[ | ||
102 | + { | ||
103 | + value: 'time', | ||
104 | + label: '履行完终止', | ||
105 | + }, | ||
106 | + ]} | ||
107 | + formItemProps={{ | ||
108 | + style: { | ||
109 | + margin: 0, | ||
110 | + }, | ||
111 | + }} | ||
112 | + name="unusedMode" | ||
113 | + label="合同约定失效效方式" | ||
114 | + /> | ||
115 | + </ProForm.Group> | ||
116 | + <ProFormText width="sm" name="id" label="主合同编号" /> | ||
117 | + <ProFormText | ||
118 | + name="project" | ||
119 | + disabled | ||
120 | + label="项目名称" | ||
121 | + initialValue="xxxx项目" | ||
122 | + /> | ||
123 | + <ProFormText | ||
124 | + width="xs" | ||
125 | + name="mangerName" | ||
126 | + disabled | ||
127 | + label="商务经理" | ||
128 | + initialValue="启途" | ||
129 | + /> | ||
130 | + </DrawerForm> | ||
131 | + ); | ||
132 | +}; |
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 InvoicingDrawerForm from '@/pages/Order/components/InvoicingDrawerForm'; | ||
3 | import ReissueModal from '@/pages/Order/components/ReissueModal'; | 4 | import ReissueModal from '@/pages/Order/components/ReissueModal'; |
4 | import { | 5 | import { |
5 | postKingdeeRepSalBillOutbound, | 6 | postKingdeeRepSalBillOutbound, |
@@ -122,6 +123,8 @@ const OrderPage = () => { | @@ -122,6 +123,8 @@ const OrderPage = () => { | ||
122 | const [allMainChecked, setAllMainChecked] = useState(false); | 123 | const [allMainChecked, setAllMainChecked] = useState(false); |
123 | const [imagesViewerModalVisible, setImagesViewerModalVisible] = | 124 | const [imagesViewerModalVisible, setImagesViewerModalVisible] = |
124 | useState<boolean>(false); | 125 | useState<boolean>(false); |
126 | + const [InvoicingDrawerFormVisible, setInvoicingDrawerFormVisible] = | ||
127 | + useState<boolean>(false); | ||
125 | const [data, setData] = useState([]); //列表数据 | 128 | const [data, setData] = useState([]); //列表数据 |
126 | const [notesEditVisible, setNotesEditVisible] = useState<boolean>(false); | 129 | const [notesEditVisible, setNotesEditVisible] = useState<boolean>(false); |
127 | const [financialMergeDrawerVisible, setFinancialMergeDrawerVisible] = | 130 | const [financialMergeDrawerVisible, setFinancialMergeDrawerVisible] = |
@@ -3969,6 +3972,19 @@ const OrderPage = () => { | @@ -3969,6 +3972,19 @@ const OrderPage = () => { | ||
3969 | ); | 3972 | ); |
3970 | } | 3973 | } |
3971 | 3974 | ||
3975 | + <Button | ||
3976 | + type="primary" | ||
3977 | + key="out" | ||
3978 | + onClick={() => { | ||
3979 | + setIsEdit(false); | ||
3980 | + setIsMainOrder(true); | ||
3981 | + setInvoicingDrawerFormVisible(true); | ||
3982 | + }} | ||
3983 | + disabled={selectedSubOrderKeys?.length === 0} | ||
3984 | + > | ||
3985 | + 申请开票 | ||
3986 | + </Button>; | ||
3987 | + | ||
3972 | if (rolePath?.includes('mergeInvoicing')) { | 3988 | if (rolePath?.includes('mergeInvoicing')) { |
3973 | toolBtns.push( | 3989 | toolBtns.push( |
3974 | <Button | 3990 | <Button |
@@ -4621,6 +4637,23 @@ const OrderPage = () => { | @@ -4621,6 +4637,23 @@ const OrderPage = () => { | ||
4621 | /> | 4637 | /> |
4622 | )} | 4638 | )} |
4623 | 4639 | ||
4640 | + {InvoicingDrawerFormVisible && ( | ||
4641 | + <InvoicingDrawerForm | ||
4642 | + subOrders={ | ||
4643 | + isMainOrder | ||
4644 | + ? [...subOrderSelectedMap.values()].flat() | ||
4645 | + : buildSubOrders() | ||
4646 | + } | ||
4647 | + totalPayment={getApplyInvoicingTotalPayment()} | ||
4648 | + onClose={() => { | ||
4649 | + setApplyForInvoicingVisible(false); | ||
4650 | + setIsMainOrder(false); | ||
4651 | + clearOptObject(); | ||
4652 | + refreshTable(); | ||
4653 | + }} | ||
4654 | + ></InvoicingDrawerForm> | ||
4655 | + )} | ||
4656 | + | ||
4624 | {contextHolder} | 4657 | {contextHolder} |
4625 | <FloatButton.BackTop visibilityHeight={0} /> | 4658 | <FloatButton.BackTop visibilityHeight={0} /> |
4626 | </div> | 4659 | </div> |