From 0b7ae20dd375eef3d6f99c9add4e143f85a60d8d Mon Sep 17 00:00:00 2001 From: jl-zhoujl2 Date: Mon, 11 Apr 2022 16:46:44 +0800 Subject: [PATCH] =?UTF-8?q?4.11=20=E9=A1=B9=E7=9B=AE=E7=BB=8F=E7=90=86?= =?UTF-8?q?=E5=92=8C=E4=BB=A3=E7=90=86=E7=AE=A1=E7=90=86=E5=91=98=E7=9A=84?= =?UTF-8?q?=E5=8F=91=E7=A5=A8=E6=9F=A5=E7=9C=8B=E5=8A=A0=E9=81=AE=E7=BD=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Invoice/AgencyAdmin/index.tsx | 135 +++++++++++++----------- src/pages/Invoice/Manager/index.tsx | 135 +++++++++++++----------- 2 files changed, 146 insertions(+), 124 deletions(-) diff --git a/src/pages/Invoice/AgencyAdmin/index.tsx b/src/pages/Invoice/AgencyAdmin/index.tsx index 05c67a9..948216c 100644 --- a/src/pages/Invoice/AgencyAdmin/index.tsx +++ b/src/pages/Invoice/AgencyAdmin/index.tsx @@ -1,5 +1,5 @@ import React, { useRef, useState } from 'react'; -import { Button, Card } from 'antd'; +import { Button, Card, Spin } from 'antd'; import ProTable, { ProColumns, ActionType } from '@ant-design/pro-table'; import FileDown from '@/utils/Download'; @@ -14,13 +14,18 @@ const Invoice: React.FC = (props) => { const [viewInvoiceFormVisible, setViewInvoiceFormVisible] = useState(false); //查看详情窗口record const [viewInvoiceValues, setViewInvoiceValues] = useState({}); + //loading + const [loading, setLoading] = useState(false); const viewDetail = (invoiceId: String) => { + setLoading(true); getInSingleInvoiceRecord(invoiceId).then((res: any) => { if (res?.success === true && res.data?.id !== null) { setViewInvoiceFormVisible(true); setViewInvoiceValues(res?.data); } + }).finally(() => { + setLoading(false); }) } @@ -165,68 +170,74 @@ const Invoice: React.FC = (props) => { return ( <> -
- { - let params = '' - for (const key in form?.getFieldsValue()) { - let element = form?.getFieldsValue()[key]; - if (element != undefined) { - params = params + '&' + key + '=' + element + +
+ { + let params = '' + for (const key in form?.getFieldsValue()) { + let element = form?.getFieldsValue()[key]; + if (element != undefined) { + params = params + '&' + key + '=' + element + } } - } - return [ - , - , - , - ]; - }, - }} - columns={columns} - options={false} - request={(params) => - getAgencyAdminGetPagelist({ ...params, pageNo: params.current }).then((res: any) => { - const result = { - data: res.data?.records, - total: res.data?.total, - success: res.success, - pageSize: res.data?.size, - current: res.data?.current - } - return result; - }) - } - pagination={{ defaultPageSize: 10, showSizeChanger: false }} - /> -
+ return [ + , + , + , + ]; + }, + }} + columns={columns} + options={false} + loading={false} + request={(params) => { + setLoading(true); + return getAgencyAdminGetPagelist({ ...params, pageNo: params.current }).then((res: any) => { + const result = { + data: res.data?.records, + total: res.data?.total, + success: res.success, + pageSize: res.data?.size, + current: res.data?.current + } + return result; + }).finally(() => { + setLoading(false); + }) + }} + pagination={{ defaultPageSize: 10, showSizeChanger: false }} + /> +
+
{ viewInvoiceValues ? ( diff --git a/src/pages/Invoice/Manager/index.tsx b/src/pages/Invoice/Manager/index.tsx index 0b8f7a9..c7a77c8 100644 --- a/src/pages/Invoice/Manager/index.tsx +++ b/src/pages/Invoice/Manager/index.tsx @@ -1,5 +1,5 @@ import React, { useRef, useState } from 'react'; -import { Button, Popconfirm, Card } from 'antd'; +import { Button, Popconfirm, Card, Spin } from 'antd'; import ProTable, { ProColumns, ActionType } from '@ant-design/pro-table'; import FileDown from '@/utils/Download'; @@ -14,13 +14,18 @@ const Invoice: React.FC = (props) => { const [viewInvoiceFormVisible, setViewInvoiceFormVisible] = useState(false); //查看详情窗口record const [viewInvoiceValues, setViewInvoiceValues] = useState({}); + //loading + const [loading, setLoading] = useState(false); const viewDetail = (invoiceId: String) => { + setLoading(true); getInSingleInvoiceRecord(invoiceId).then((res: any) => { if (res?.success === true && res.data?.id !== null) { setViewInvoiceFormVisible(true); setViewInvoiceValues(res?.data); } + }).finally(() => { + setLoading(false); }) } @@ -187,68 +192,74 @@ const Invoice: React.FC = (props) => { return ( <> -
- { - let params = '' - for (const key in form?.getFieldsValue()) { - let element = form?.getFieldsValue()[key]; - if (element != undefined) { - params = params + '&' + key + '=' + element + +
+ { + let params = '' + for (const key in form?.getFieldsValue()) { + let element = form?.getFieldsValue()[key]; + if (element != undefined) { + params = params + '&' + key + '=' + element + } } - } - return [ - , - , - , - ]; - }, - }} - columns={columns} - options={false} - request={(params) => - getAgencyGetPagelist({ ...params, pageNo: params.current }).then((res: any) => { - const result = { - data: res.data?.records, - total: res.data?.total, - success: res.success, - pageSize: res.data?.size, - current: res.data?.current - } - return result; - }) - } - pagination={{ defaultPageSize: 10, showSizeChanger: false }} - /> -
+ return [ + , + , + , + ]; + }, + }} + columns={columns} + options={false} + loading={false} + request={(params) => { + setLoading(true); + return getAgencyGetPagelist({ ...params, pageNo: params.current }).then((res: any) => { + const result = { + data: res.data?.records, + total: res.data?.total, + success: res.success, + pageSize: res.data?.size, + current: res.data?.current + } + return result; + }).finally(() => { + setLoading(false); + }) + }} + pagination={{ defaultPageSize: 10, showSizeChanger: false }} + /> +
+
{ viewInvoiceValues ? (