Merge branch '20220411-zjl-前端先调用接口后Modal弹窗遮罩问题' into 'master-0422-合并'

4.22 前端先调用接口后Modal弹窗遮罩问题

See merge request eshop/fe_service_ebtp_frontend!26
This commit is contained in:
周建龙
2022-04-22 20:54:53 +08:00
2 changed files with 146 additions and 124 deletions

View File

@ -1,5 +1,5 @@
import React, { useRef, useState } from 'react'; 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 ProTable, { ProColumns, ActionType } from '@ant-design/pro-table';
import FileDown from '@/utils/Download'; import FileDown from '@/utils/Download';
@ -14,13 +14,18 @@ const Invoice: React.FC<any> = (props) => {
const [viewInvoiceFormVisible, setViewInvoiceFormVisible] = useState<any>(false); const [viewInvoiceFormVisible, setViewInvoiceFormVisible] = useState<any>(false);
//查看详情窗口record //查看详情窗口record
const [viewInvoiceValues, setViewInvoiceValues] = useState<any>({}); const [viewInvoiceValues, setViewInvoiceValues] = useState<any>({});
//loading
const [loading, setLoading] = useState<boolean>(false);
const viewDetail = (invoiceId: String) => { const viewDetail = (invoiceId: String) => {
setLoading(true);
getInSingleInvoiceRecord(invoiceId).then((res: any) => { getInSingleInvoiceRecord(invoiceId).then((res: any) => {
if (res?.success === true && res.data?.id !== null) { if (res?.success === true && res.data?.id !== null) {
setViewInvoiceFormVisible(true); setViewInvoiceFormVisible(true);
setViewInvoiceValues(res?.data); setViewInvoiceValues(res?.data);
} }
}).finally(() => {
setLoading(false);
}) })
} }
@ -165,68 +170,74 @@ const Invoice: React.FC<any> = (props) => {
return ( return (
<> <>
<Card title="我的发票列表" style={{ borderRadius: 6 }} bodyStyle={{ padding: '1px 24px 0px' }}> <Card title="我的发票列表" style={{ borderRadius: 6 }} bodyStyle={{ padding: '1px 24px 0px' }}>
<div className="zjl-entrust confirm" style={{ height: window.innerHeight - 124, overflowY: 'auto' }}> <Spin spinning={loading}>
<ProTable <div className="zjl-entrust confirm" style={{ height: window.innerHeight - 124, overflowY: 'auto' }}>
rowKey="invoiceId" <ProTable
size="small" rowKey="invoiceId"
actionRef={actionRef}//action触发后更新表格 size="small"
search={{ actionRef={actionRef}//action触发后更新表格
defaultCollapsed: true, search={{
optionRender: (searchConfig, { form }) => { defaultCollapsed: true,
let params = '' optionRender: (searchConfig, { form }) => {
for (const key in form?.getFieldsValue()) { let params = ''
let element = form?.getFieldsValue()[key]; for (const key in form?.getFieldsValue()) {
if (element != undefined) { let element = form?.getFieldsValue()[key];
params = params + '&' + key + '=' + element if (element != undefined) {
params = params + '&' + key + '=' + element
}
} }
} return [
return [ <Button
<Button key="searchText"
key="searchText" type="primary"
type="primary" onClick={() => {
onClick={() => { form?.submit();
form?.submit(); }}
}} >
> {searchConfig?.searchText}
{searchConfig?.searchText} </Button>,
</Button>, <Button
<Button key="resetText"
key="resetText" onClick={() => {
onClick={() => { form?.resetFields();
form?.resetFields(); actionRef.current?.reset?.();
actionRef.current?.reset?.(); }}
}} >
> {searchConfig?.resetText}
{searchConfig?.resetText} </Button>,
</Button>, <FileDown
<FileDown key="downLoad"
key="downLoad" type="xlsx"
type="xlsx" apiUrl={`/api/biz-service-ebtp-expenses/v1/bizbidinvoice/agencyAdminExportGetlist?n=${params}`}
apiUrl={`/api/biz-service-ebtp-expenses/v1/bizbidinvoice/agencyAdminExportGetlist?n=${params}`} btnName="导出"
btnName="导出" method="GET"
method="GET" form={form}
form={form} />,
/>, ];
]; },
}, }}
}} columns={columns}
columns={columns} options={false}
options={false} loading={false}
request={(params) => request={(params) => {
getAgencyAdminGetPagelist({ ...params, pageNo: params.current }).then((res: any) => { setLoading(true);
const result = { return getAgencyAdminGetPagelist({ ...params, pageNo: params.current }).then((res: any) => {
data: res.data?.records, const result = {
total: res.data?.total, data: res.data?.records,
success: res.success, total: res.data?.total,
pageSize: res.data?.size, success: res.success,
current: res.data?.current pageSize: res.data?.size,
} current: res.data?.current
return result; }
}) return result;
} }).finally(() => {
pagination={{ defaultPageSize: 10, showSizeChanger: false }} setLoading(false);
/> })
</div> }}
pagination={{ defaultPageSize: 10, showSizeChanger: false }}
/>
</div>
</Spin>
</Card> </Card>
{ {
viewInvoiceValues ? ( viewInvoiceValues ? (

View File

@ -1,5 +1,5 @@
import React, { useRef, useState } from 'react'; 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 ProTable, { ProColumns, ActionType } from '@ant-design/pro-table';
import FileDown from '@/utils/Download'; import FileDown from '@/utils/Download';
@ -14,13 +14,18 @@ const Invoice: React.FC<any> = (props) => {
const [viewInvoiceFormVisible, setViewInvoiceFormVisible] = useState<any>(false); const [viewInvoiceFormVisible, setViewInvoiceFormVisible] = useState<any>(false);
//查看详情窗口record //查看详情窗口record
const [viewInvoiceValues, setViewInvoiceValues] = useState<any>({}); const [viewInvoiceValues, setViewInvoiceValues] = useState<any>({});
//loading
const [loading, setLoading] = useState<boolean>(false);
const viewDetail = (invoiceId: String) => { const viewDetail = (invoiceId: String) => {
setLoading(true);
getInSingleInvoiceRecord(invoiceId).then((res: any) => { getInSingleInvoiceRecord(invoiceId).then((res: any) => {
if (res?.success === true && res.data?.id !== null) { if (res?.success === true && res.data?.id !== null) {
setViewInvoiceFormVisible(true); setViewInvoiceFormVisible(true);
setViewInvoiceValues(res?.data); setViewInvoiceValues(res?.data);
} }
}).finally(() => {
setLoading(false);
}) })
} }
@ -187,68 +192,74 @@ const Invoice: React.FC<any> = (props) => {
return ( return (
<> <>
<Card title="我的发票列表" style={{ borderRadius: 6 }} bodyStyle={{ padding: '1px 24px 0px' }}> <Card title="我的发票列表" style={{ borderRadius: 6 }} bodyStyle={{ padding: '1px 24px 0px' }}>
<div className="zjl-entrust confirm" style={{ height: window.innerHeight - 124, overflowY: 'auto' }}> <Spin spinning={loading}>
<ProTable <div className="zjl-entrust confirm" style={{ height: window.innerHeight - 124, overflowY: 'auto' }}>
rowKey="invoiceId" <ProTable
size="small" rowKey="invoiceId"
actionRef={actionRef}//action触发后更新表格 size="small"
search={{ actionRef={actionRef}//action触发后更新表格
defaultCollapsed: true, search={{
optionRender: (searchConfig, { form }) => { defaultCollapsed: true,
let params = '' optionRender: (searchConfig, { form }) => {
for (const key in form?.getFieldsValue()) { let params = ''
let element = form?.getFieldsValue()[key]; for (const key in form?.getFieldsValue()) {
if (element != undefined) { let element = form?.getFieldsValue()[key];
params = params + '&' + key + '=' + element if (element != undefined) {
params = params + '&' + key + '=' + element
}
} }
} return [
return [ <Button
<Button key="searchText"
key="searchText" type="primary"
type="primary" onClick={() => {
onClick={() => { form?.submit();
form?.submit(); }}
}} >
> {searchConfig?.searchText}
{searchConfig?.searchText} </Button>,
</Button>, <Button
<Button key="resetText"
key="resetText" onClick={() => {
onClick={() => { form?.resetFields();
form?.resetFields(); actionRef.current?.reset?.();
actionRef.current?.reset?.(); }}
}} >
> {searchConfig?.resetText}
{searchConfig?.resetText} </Button>,
</Button>, <FileDown
<FileDown key="downLoad"
key="downLoad" type="xlsx"
type="xlsx" apiUrl={`/api/biz-service-ebtp-expenses/v1/bizbidinvoice/agencyExportGetlist?n=${params}`}
apiUrl={`/api/biz-service-ebtp-expenses/v1/bizbidinvoice/agencyExportGetlist?n=${params}`} btnName="导出"
btnName="导出" method="GET"
method="GET" form={form}
form={form} />,
/>, ];
]; },
}, }}
}} columns={columns}
columns={columns} options={false}
options={false} loading={false}
request={(params) => request={(params) => {
getAgencyGetPagelist({ ...params, pageNo: params.current }).then((res: any) => { setLoading(true);
const result = { return getAgencyGetPagelist({ ...params, pageNo: params.current }).then((res: any) => {
data: res.data?.records, const result = {
total: res.data?.total, data: res.data?.records,
success: res.success, total: res.data?.total,
pageSize: res.data?.size, success: res.success,
current: res.data?.current pageSize: res.data?.size,
} current: res.data?.current
return result; }
}) return result;
} }).finally(() => {
pagination={{ defaultPageSize: 10, showSizeChanger: false }} setLoading(false);
/> })
</div> }}
pagination={{ defaultPageSize: 10, showSizeChanger: false }}
/>
</div>
</Spin>
</Card> </Card>
{ {
viewInvoiceValues ? ( viewInvoiceValues ? (