Commit 9ff0477b1d98134727db821520b3e2fa2dde01b2
1 parent
dfbe00fb
feat: update 财务编辑、报表排除大订单金额条件
Showing
5 changed files
with
82 additions
and
11 deletions
src/pages/Order/components/FinancialEditDrawer.tsx
1 | // import { PlusOutlined } from '@ant-design/icons'; | 1 | // import { PlusOutlined } from '@ant-design/icons'; |
2 | import { RESPONSE_CODE } from '@/constants/enum'; | 2 | import { RESPONSE_CODE } from '@/constants/enum'; |
3 | import { postServiceOrderNoNeedInvoicingEdit } from '@/services'; | 3 | import { postServiceOrderNoNeedInvoicingEdit } from '@/services'; |
4 | -import { DrawerForm, ProFormDatePicker } from '@ant-design/pro-components'; | 4 | +import { enumToSelect } from '@/utils'; |
5 | +import { | ||
6 | + DrawerForm, | ||
7 | + ProFormDatePicker, | ||
8 | + ProFormSelect, | ||
9 | + ProFormText, | ||
10 | +} from '@ant-design/pro-components'; | ||
5 | import { Form, message } from 'antd'; | 11 | import { Form, message } from 'antd'; |
12 | +import { useEffect, useState } from 'react'; | ||
13 | +import { INVOCING_STATUS_OPTIONS_OLD } from '../constant'; | ||
6 | 14 | ||
7 | -export default ({ subOrders, setVisible, onClose }) => { | 15 | +export default ({ mainOrder, subOrders, setVisible, onClose }) => { |
16 | + const [invoicingStatus, setInvoicingStatus] = useState(''); | ||
17 | + useEffect(() => { | ||
18 | + setInvoicingStatus(subOrders[0]?.invoicingStatus); | ||
19 | + }, []); | ||
8 | const subOrderIds = subOrders?.map((subOrder) => { | 20 | const subOrderIds = subOrders?.map((subOrder) => { |
9 | return subOrder?.id; | 21 | return subOrder?.id; |
10 | }); | 22 | }); |
23 | + const mainOrderId = mainOrder.id; | ||
11 | const [form] = Form.useForm<{ | 24 | const [form] = Form.useForm<{ |
12 | collectMoneyTime: string; | 25 | collectMoneyTime: string; |
13 | subIds: []; | 26 | subIds: []; |
@@ -35,14 +48,12 @@ export default ({ subOrders, setVisible, onClose }) => { | @@ -35,14 +48,12 @@ export default ({ subOrders, setVisible, onClose }) => { | ||
35 | destroyOnClose: true, | 48 | destroyOnClose: true, |
36 | }} | 49 | }} |
37 | submitTimeout={2000} | 50 | submitTimeout={2000} |
38 | - onFinish={async () => { | 51 | + onFinish={async (values) => { |
39 | let res = await postServiceOrderNoNeedInvoicingEdit({ | 52 | let res = await postServiceOrderNoNeedInvoicingEdit({ |
40 | data: { | 53 | data: { |
54 | + ...values, | ||
55 | + mainOrderId: mainOrderId, | ||
41 | subIds: subOrderIds, | 56 | subIds: subOrderIds, |
42 | - collectMoneyTime: form.getFieldValue('collectMoneyTime'), | ||
43 | - financialReceiptIssuanceTime: form.getFieldValue( | ||
44 | - 'financialReceiptIssuanceTime', | ||
45 | - ), | ||
46 | }, | 57 | }, |
47 | }); | 58 | }); |
48 | if (res.result === RESPONSE_CODE.SUCCESS) { | 59 | if (res.result === RESPONSE_CODE.SUCCESS) { |
@@ -54,19 +65,69 @@ export default ({ subOrders, setVisible, onClose }) => { | @@ -54,19 +65,69 @@ export default ({ subOrders, setVisible, onClose }) => { | ||
54 | return !val && setVisible(val); | 65 | return !val && setVisible(val); |
55 | }} | 66 | }} |
56 | > | 67 | > |
68 | + <ProFormSelect | ||
69 | + placeholder="选择是否需要开票" | ||
70 | + name="invoicingStatus" | ||
71 | + width="lg" | ||
72 | + label="是否需要开票" | ||
73 | + options={enumToSelect(INVOCING_STATUS_OPTIONS_OLD)} | ||
74 | + onChange={setInvoicingStatus} | ||
75 | + initialValue={subOrders[0]?.invoicingStatus} | ||
76 | + // disabled={mainInfoDisbled} | ||
77 | + rules={[{ required: true, message: '是否需要开票必填' }]} | ||
78 | + /> | ||
79 | + {invoicingStatus !== 'UN_INVOICE' ? ( | ||
80 | + <> | ||
81 | + <ProFormText | ||
82 | + key="invoiceIdentificationNumber" | ||
83 | + width="lg" | ||
84 | + name="invoiceIdentificationNumber" | ||
85 | + label="开票信息" | ||
86 | + placeholder="请输入开票信息" | ||
87 | + rules={[{ required: true, message: '开票信息必填' }]} | ||
88 | + /> | ||
89 | + <ProFormText | ||
90 | + key="bank" | ||
91 | + width="lg" | ||
92 | + name="bank" | ||
93 | + label="开户银行" | ||
94 | + placeholder="请输入开户银行" | ||
95 | + /> | ||
96 | + <ProFormText | ||
97 | + key="bankAccountNumber" | ||
98 | + width="lg" | ||
99 | + name="bankAccountNumber" | ||
100 | + label="开户银行账号" | ||
101 | + placeholder="请输入开户银行账号" | ||
102 | + /> | ||
103 | + </> | ||
104 | + ) : ( | ||
105 | + '' | ||
106 | + )} | ||
107 | + | ||
57 | <ProFormDatePicker | 108 | <ProFormDatePicker |
58 | key="financialReceiptIssuanceTime" | 109 | key="financialReceiptIssuanceTime" |
59 | width="lg" | 110 | width="lg" |
60 | name="financialReceiptIssuanceTime" | 111 | name="financialReceiptIssuanceTime" |
61 | - rules={[{ required: true, message: '收据时间必填' }]} | ||
62 | label="开收据时间" | 112 | label="开收据时间" |
113 | + rules={[ | ||
114 | + { | ||
115 | + required: invoicingStatus === 'UN_INVOICE', | ||
116 | + message: '开收据时间必填', | ||
117 | + }, | ||
118 | + ]} | ||
63 | /> | 119 | /> |
64 | <ProFormDatePicker | 120 | <ProFormDatePicker |
65 | key="collectMoneyTime" | 121 | key="collectMoneyTime" |
66 | width="lg" | 122 | width="lg" |
67 | name="collectMoneyTime" | 123 | name="collectMoneyTime" |
68 | label="收款时间" | 124 | label="收款时间" |
69 | - rules={[{ required: true, message: '收款时间必填' }]} | 125 | + rules={[ |
126 | + { | ||
127 | + required: invoicingStatus === 'UN_INVOICE', | ||
128 | + message: '收款时间必填', | ||
129 | + }, | ||
130 | + ]} | ||
70 | /> | 131 | /> |
71 | </DrawerForm> | 132 | </DrawerForm> |
72 | ); | 133 | ); |
src/pages/Order/components/OrderDrawer.tsx
@@ -254,6 +254,9 @@ export default ({ onClose, data, subOrders, orderOptType }) => { | @@ -254,6 +254,9 @@ export default ({ onClose, data, subOrders, orderOptType }) => { | ||
254 | }); | 254 | }); |
255 | 255 | ||
256 | values.list = list; | 256 | values.list = list; |
257 | + values.institution = values.institution?.trim(); | ||
258 | + values.institutionContactName = values.institutionContactName?.trim(); | ||
259 | + | ||
257 | if (optType('add') || optType('copy')) { | 260 | if (optType('add') || optType('copy')) { |
258 | res = await postServiceOrderAddOrder({ data: values }); | 261 | res = await postServiceOrderAddOrder({ data: values }); |
259 | } else { | 262 | } else { |
src/pages/Order/constant.ts
@@ -338,7 +338,7 @@ export const MAIN_ORDER_COLUMNS = [ | @@ -338,7 +338,7 @@ export const MAIN_ORDER_COLUMNS = [ | ||
338 | }, | 338 | }, |
339 | }, | 339 | }, |
340 | { | 340 | { |
341 | - title: '单位联系人', | 341 | + title: '课题组', |
342 | dataIndex: 'institutionContactName', | 342 | dataIndex: 'institutionContactName', |
343 | valueType: 'select', | 343 | valueType: 'select', |
344 | hideInTable: true, | 344 | hideInTable: true, |
src/pages/Order/index.tsx
@@ -667,10 +667,11 @@ const OrderPage = () => { | @@ -667,10 +667,11 @@ const OrderPage = () => { | ||
667 | onClick={() => { | 667 | onClick={() => { |
668 | setFinancialEditVisible(true); | 668 | setFinancialEditVisible(true); |
669 | setSelectedRows([optRecord]); | 669 | setSelectedRows([optRecord]); |
670 | + setOrderRow(record); | ||
670 | setIsMainOrder(false); | 671 | setIsMainOrder(false); |
671 | }} | 672 | }} |
672 | > | 673 | > |
673 | - 收款时间 | 674 | + 编辑时间 |
674 | </Button> | 675 | </Button> |
675 | ) : ( | 676 | ) : ( |
676 | '' | 677 | '' |
@@ -2382,6 +2383,7 @@ const OrderPage = () => { | @@ -2382,6 +2383,7 @@ const OrderPage = () => { | ||
2382 | 2383 | ||
2383 | {financialEditVisible && ( | 2384 | {financialEditVisible && ( |
2384 | <FinancialEditDrawer | 2385 | <FinancialEditDrawer |
2386 | + mainOrder={orderRow} | ||
2385 | subOrders={selectedRows} | 2387 | subOrders={selectedRows} |
2386 | setVisible={() => { | 2388 | setVisible={() => { |
2387 | setFinancialEditVisible(false); | 2389 | setFinancialEditVisible(false); |
@@ -2391,6 +2393,7 @@ const OrderPage = () => { | @@ -2391,6 +2393,7 @@ const OrderPage = () => { | ||
2391 | setFinancialEditVisible(false); | 2393 | setFinancialEditVisible(false); |
2392 | refreshTable(); | 2394 | refreshTable(); |
2393 | setIsMainOrder(false); | 2395 | setIsMainOrder(false); |
2396 | + setOrderRow({}); | ||
2394 | }} | 2397 | }} |
2395 | /> | 2398 | /> |
2396 | )} | 2399 | )} |
src/pages/OrderReport/index.tsx
@@ -5,6 +5,7 @@ import { EllipsisOutlined } from '@ant-design/icons'; | @@ -5,6 +5,7 @@ import { EllipsisOutlined } from '@ant-design/icons'; | ||
5 | import { | 5 | import { |
6 | PageContainer, | 6 | PageContainer, |
7 | ProCard, | 7 | ProCard, |
8 | + ProFormDigit, | ||
8 | ProFormSelect, | 9 | ProFormSelect, |
9 | QueryFilter, | 10 | QueryFilter, |
10 | } from '@ant-design/pro-components'; | 11 | } from '@ant-design/pro-components'; |
@@ -53,6 +54,7 @@ const OrderReportPage = () => { | @@ -53,6 +54,7 @@ const OrderReportPage = () => { | ||
53 | statisticsMethod: '', | 54 | statisticsMethod: '', |
54 | salesCode: form.getFieldValue('salesCode'), | 55 | salesCode: form.getFieldValue('salesCode'), |
55 | productBelongBusiness: form.getFieldValue('productBelongBusiness'), | 56 | productBelongBusiness: form.getFieldValue('productBelongBusiness'), |
57 | + maxAccount: form.getFieldValue('maxAccount'), | ||
56 | // beginTime:"", | 58 | // beginTime:"", |
57 | // endTime:"" | 59 | // endTime:"" |
58 | }; | 60 | }; |
@@ -163,6 +165,8 @@ const OrderReportPage = () => { | @@ -163,6 +165,8 @@ const OrderReportPage = () => { | ||
163 | label="所属事业部" | 165 | label="所属事业部" |
164 | options={enumToSelect(PRODUCT_BELONG_DEPARTMENT_OPTIONS)} | 166 | options={enumToSelect(PRODUCT_BELONG_DEPARTMENT_OPTIONS)} |
165 | /> | 167 | /> |
168 | + <ProFormDigit label="排除大订单金额" name="maxAccount" min={0} /> | ||
169 | + | ||
166 | {/* <ProFormDateRangePicker | 170 | {/* <ProFormDateRangePicker |
167 | key="dateRange" | 171 | key="dateRange" |
168 | name="dateRange" | 172 | name="dateRange" |