Commit c2de444be853b877b8b22b7ac85aa51867a01f0d

Authored by zhongnanhuang
1 parent 6adca975

feat: update 发票核销

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