Commit c2de444be853b877b8b22b7ac85aa51867a01f0d

Authored by zhongnanhuang
1 parent 6adca975

feat: update 发票核销

.umirc.ts
... ... @@ -50,7 +50,7 @@ export default defineConfig({
50 50 path: '/invoiceManage',
51 51 component: './Invoice',
52 52 icon: 'BookOutlined',
53   - access: 'canReadAdmin',
  53 + access: 'canReadAdminAndFinance',
54 54 },
55 55 {
56 56 name: '打印',
... ...
src/access.ts
... ... @@ -6,5 +6,7 @@ export default (initialState: API.UserInfo) => {
6 6 return {
7 7 canReadAdmin: roleSmallVO?.code === 'admin',
8 8 canReadProcure: roleSmallVO?.code === 'procure',
  9 + canReadAdminAndFinance:
  10 + roleSmallVO?.code === 'admin' || roleSmallVO?.code === 'finance',
9 11 };
10 12 };
... ...
src/pages/Invoice/components/BankChooseModal.tsx
... ... @@ -231,7 +231,12 @@ export default ({ invoiceId, setVisible, onClose }) => {
231 231 });
232 232  
233 233 if (res.result === RESPONSE_CODE.SUCCESS) {
234   - message.success(res.message);
  234 + if (res.data?.length > 0) {
  235 + message.info(res.data);
  236 + } else {
  237 + message.success(res.message);
  238 + }
  239 +
235 240 onClose();
236 241 }
237 242  
... ...
src/pages/Invoice/components/BankImportModal.tsx
... ... @@ -99,6 +99,7 @@ export default ({ setVisible, onClose }) => {
99 99 a.click(); // 模拟点击操作来下载文件
100 100 URL.revokeObjectURL(downloadUrl); // 释放掉 blob 对象所占用的内存
101 101 document.body.removeChild(a);
  102 + onClose();
102 103 }
103 104 })
104 105 .catch((error) => {
... ...
src/pages/Invoice/components/InvoiceVerificationModal.tsx
... ... @@ -9,7 +9,12 @@ import {
9 9 import { enumValueToLabel, formatDateTime } from '@/utils';
10 10 import { formatDate } from '@/utils/time';
11 11 import { PlusOutlined } from '@ant-design/icons';
12   -import { ModalForm, ProCard, ProTable } from '@ant-design/pro-components';
  12 +import {
  13 + ActionType,
  14 + ModalForm,
  15 + ProCard,
  16 + ProTable,
  17 +} from '@ant-design/pro-components';
13 18 import {
14 19 Button,
15 20 Descriptions,
... ... @@ -19,7 +24,7 @@ import {
19 24 Form,
20 25 message,
21 26 } from 'antd';
22   -import { useEffect, useState } from 'react';
  27 +import { useEffect, useRef, useState } from 'react';
23 28 import { BANK_STATEMENT_COLUMNS, INVOICE_STATUS } from '../constant';
24 29 import '../index.less';
25 30 import BankChooseModal from './BankChooseModal';
... ... @@ -30,6 +35,7 @@ export default ({ invoiceId, setVisible, onClose }) => {
30 35 const [invoiceInfo, setInvoiceInfo] = useState({});
31 36 const [relationOrderIds, setRelationOrderIds] = useState([]);
32 37 const [relationBankStatements, setRelationBankStatements] = useState([]);
  38 + const actionRef = useRef<ActionType>();
33 39  
34 40 const loadInvoiceData = async () => {
35 41 let res = await postServiceInvoiceQueryInvoiceDetail({
... ... @@ -265,6 +271,7 @@ export default ({ invoiceId, setVisible, onClose }) =&gt; {
265 271 destroyOnClose: true,
266 272 onCancel: () => {
267 273 setVisible(false);
  274 + onClose();
268 275 },
269 276 }}
270 277 submitter={{
... ... @@ -303,6 +310,7 @@ export default ({ invoiceId, setVisible, onClose }) =&gt; {
303 310  
304 311 <ProTable
305 312 columns={bankStatementColumnsInit()}
  313 + actionRef={actionRef}
306 314 cardBordered
307 315 pagination={{
308 316 pageSize: 10,
... ... @@ -364,6 +372,7 @@ export default ({ invoiceId, setVisible, onClose }) =&gt; {
364 372 onClose={() => {
365 373 setBankChooseModalVisible(false);
366 374 loadInvoiceData();
  375 + actionRef.current?.reload();
367 376 }}
368 377 ></BankChooseModal>
369 378 ) : (
... ...
src/pages/Invoice/index.tsx
... ... @@ -22,6 +22,7 @@ import {
22 22 PageContainer,
23 23 ProTable,
24 24 } from '@ant-design/pro-components';
  25 +import { history } from '@umijs/max';
25 26 import { Avatar, Button, Dropdown, Tabs, Tag, message } from 'antd';
26 27 import { useRef, useState } from 'react';
27 28 import { INVOCING_STATUS, PAYEE_OPTIONS } from '../Order/constant';
... ... @@ -472,7 +473,10 @@ const InvoicePage = () =&gt; {
472 473 {bankImportModalVisible ? (
473 474 <BankImportModal
474 475 setVisible={setBankImportModalVisible}
475   - onClose={() => {}}
  476 + onClose={() => {
  477 + invoiceActionRef.current?.reload();
  478 + bankActionRef.current?.reload();
  479 + }}
476 480 ></BankImportModal>
477 481 ) : (
478 482 ''
... ... @@ -482,7 +486,10 @@ const InvoicePage = () =&gt; {
482 486 <InvoiceVerificationModal
483 487 setVisible={setInvoiceVerificationVisible}
484 488 invoiceId={invoiceId}
485   - onClose={() => {}}
  489 + onClose={() => {
  490 + invoiceActionRef.current?.reload();
  491 + bankActionRef.current?.reload();
  492 + }}
486 493 ></InvoiceVerificationModal>
487 494 ) : (
488 495 ''
... ...