Commit 9ff0477b1d98134727db821520b3e2fa2dde01b2

Authored by zhongnanhuang
1 parent dfbe00fb

feat: update 财务编辑、报表排除大订单金额条件

src/pages/Order/components/FinancialEditDrawer.tsx
1 1 // import { PlusOutlined } from '@ant-design/icons';
2 2 import { RESPONSE_CODE } from '@/constants/enum';
3 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 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 20 const subOrderIds = subOrders?.map((subOrder) => {
9 21 return subOrder?.id;
10 22 });
  23 + const mainOrderId = mainOrder.id;
11 24 const [form] = Form.useForm<{
12 25 collectMoneyTime: string;
13 26 subIds: [];
... ... @@ -35,14 +48,12 @@ export default ({ subOrders, setVisible, onClose }) =&gt; {
35 48 destroyOnClose: true,
36 49 }}
37 50 submitTimeout={2000}
38   - onFinish={async () => {
  51 + onFinish={async (values) => {
39 52 let res = await postServiceOrderNoNeedInvoicingEdit({
40 53 data: {
  54 + ...values,
  55 + mainOrderId: mainOrderId,
41 56 subIds: subOrderIds,
42   - collectMoneyTime: form.getFieldValue('collectMoneyTime'),
43   - financialReceiptIssuanceTime: form.getFieldValue(
44   - 'financialReceiptIssuanceTime',
45   - ),
46 57 },
47 58 });
48 59 if (res.result === RESPONSE_CODE.SUCCESS) {
... ... @@ -54,19 +65,69 @@ export default ({ subOrders, setVisible, onClose }) =&gt; {
54 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 108 <ProFormDatePicker
58 109 key="financialReceiptIssuanceTime"
59 110 width="lg"
60 111 name="financialReceiptIssuanceTime"
61   - rules={[{ required: true, message: '收据时间必填' }]}
62 112 label="开收据时间"
  113 + rules={[
  114 + {
  115 + required: invoicingStatus === 'UN_INVOICE',
  116 + message: '开收据时间必填',
  117 + },
  118 + ]}
63 119 />
64 120 <ProFormDatePicker
65 121 key="collectMoneyTime"
66 122 width="lg"
67 123 name="collectMoneyTime"
68 124 label="收款时间"
69   - rules={[{ required: true, message: '收款时间必填' }]}
  125 + rules={[
  126 + {
  127 + required: invoicingStatus === 'UN_INVOICE',
  128 + message: '收款时间必填',
  129 + },
  130 + ]}
70 131 />
71 132 </DrawerForm>
72 133 );
... ...
src/pages/Order/components/OrderDrawer.tsx
... ... @@ -254,6 +254,9 @@ export default ({ onClose, data, subOrders, orderOptType }) =&gt; {
254 254 });
255 255  
256 256 values.list = list;
  257 + values.institution = values.institution?.trim();
  258 + values.institutionContactName = values.institutionContactName?.trim();
  259 +
257 260 if (optType('add') || optType('copy')) {
258 261 res = await postServiceOrderAddOrder({ data: values });
259 262 } else {
... ...
src/pages/Order/constant.ts
... ... @@ -338,7 +338,7 @@ export const MAIN_ORDER_COLUMNS = [
338 338 },
339 339 },
340 340 {
341   - title: '单位联系人',
  341 + title: '课题组',
342 342 dataIndex: 'institutionContactName',
343 343 valueType: 'select',
344 344 hideInTable: true,
... ...
src/pages/Order/index.tsx
... ... @@ -667,10 +667,11 @@ const OrderPage = () =&gt; {
667 667 onClick={() => {
668 668 setFinancialEditVisible(true);
669 669 setSelectedRows([optRecord]);
  670 + setOrderRow(record);
670 671 setIsMainOrder(false);
671 672 }}
672 673 >
673   - 收款时间
  674 + 编辑时间
674 675 </Button>
675 676 ) : (
676 677 ''
... ... @@ -2382,6 +2383,7 @@ const OrderPage = () =&gt; {
2382 2383  
2383 2384 {financialEditVisible && (
2384 2385 <FinancialEditDrawer
  2386 + mainOrder={orderRow}
2385 2387 subOrders={selectedRows}
2386 2388 setVisible={() => {
2387 2389 setFinancialEditVisible(false);
... ... @@ -2391,6 +2393,7 @@ const OrderPage = () =&gt; {
2391 2393 setFinancialEditVisible(false);
2392 2394 refreshTable();
2393 2395 setIsMainOrder(false);
  2396 + setOrderRow({});
2394 2397 }}
2395 2398 />
2396 2399 )}
... ...
src/pages/OrderReport/index.tsx
... ... @@ -5,6 +5,7 @@ import { EllipsisOutlined } from &#39;@ant-design/icons&#39;;
5 5 import {
6 6 PageContainer,
7 7 ProCard,
  8 + ProFormDigit,
8 9 ProFormSelect,
9 10 QueryFilter,
10 11 } from '@ant-design/pro-components';
... ... @@ -53,6 +54,7 @@ const OrderReportPage = () =&gt; {
53 54 statisticsMethod: '',
54 55 salesCode: form.getFieldValue('salesCode'),
55 56 productBelongBusiness: form.getFieldValue('productBelongBusiness'),
  57 + maxAccount: form.getFieldValue('maxAccount'),
56 58 // beginTime:"",
57 59 // endTime:""
58 60 };
... ... @@ -163,6 +165,8 @@ const OrderReportPage = () =&gt; {
163 165 label="所属事业部"
164 166 options={enumToSelect(PRODUCT_BELONG_DEPARTMENT_OPTIONS)}
165 167 />
  168 + <ProFormDigit label="排除大订单金额" name="maxAccount" min={0} />
  169 +
166 170 {/* <ProFormDateRangePicker
167 171 key="dateRange"
168 172 name="dateRange"
... ...