diff --git a/src/components/Common/CommonBase.js b/src/components/Common/CommonBase.js index 087a1e6..efe8798 100644 --- a/src/components/Common/CommonBase.js +++ b/src/components/Common/CommonBase.js @@ -4,7 +4,7 @@ * Created by mar105 on 2019-02-15. */ -import React, { Component } from 'react'; +import React, { Component, useEffect } from 'react'; import { message } from '@/utils/common/message'; import moment from 'moment'; import lodash from 'lodash'; @@ -592,6 +592,9 @@ export default (ChildComponent) => { /** 获取sql下拉数据 */ getServiceError = async (returnData) => { + if (this.state.loading) { + this.handleSaveState({ loading: false }); + } if (location.pathname.indexOf('/indexOee/') > -1) { this.props.dispatch({ type: 'app/throwErrorOee', payload: returnData }); } else { @@ -3458,8 +3461,28 @@ export default (ChildComponent) => { onExecInstructSet={this.handleExecInstructSet} // 调用指令集 showCacheData={this.showCacheData} /> +
+ +
); } }; }; + +const CommonChangePageEvent = (props) => { + + const { currentPageNo, currentId, masterData = {}, loading } = props; + const { sId } = masterData; + + // 上一页下一页loading加载完成后,取消loading + useEffect(() => { + if (loading && currentPageNo && currentId && sId) { + if (currentId === sId) { + props.onSaveState({ loading: false }); + } + } + }, [currentPageNo, sId]); + + return null; +} diff --git a/src/components/Common/CommonBillDeliverEvent.js b/src/components/Common/CommonBillDeliverEvent.js index 3ccafe1..ff7d5f0 100644 --- a/src/components/Common/CommonBillDeliverEvent.js +++ b/src/components/Common/CommonBillDeliverEvent.js @@ -2108,7 +2108,7 @@ export default (ChildComponent) => { if (!commonUtils.isNum(currentPosition)) { // 如果是列表直接点增加,就跳到第一条去 currentPosition = 1; } - + this.props.onSaveState({ loading: true }); const value = { sClientType: '1', sFilterOrderBy, bFilter, sListFormmasterId, currentPosition, handleType, iCountSum: pages.total, }; diff --git a/src/components/Common/CommonBillEvent.js b/src/components/Common/CommonBillEvent.js index fbf88af..61cfb3d 100644 --- a/src/components/Common/CommonBillEvent.js +++ b/src/components/Common/CommonBillEvent.js @@ -2903,6 +2903,7 @@ export default (ChildComponent) => { return ; } } + this.props.onSaveState({ loading: true }); const value = { sClientType: '1', sFilterOrderBy, bFilter, sListFormmasterId, currentPosition, handleType, iCountSum: pages?.total, sUpId: masterData?.sId, sParentModelId :sSrcModelsId, @@ -2937,6 +2938,7 @@ export default (ChildComponent) => { searchUpDownData: {}, slaveSelectedRowKeys: [], sBillIdsArray, + loading: true, }, () => this.handleGetData(masterConfig, slaveConfig, checkConfig)); return true; }; diff --git a/src/components/Common/CommonCheckBillEvent.js b/src/components/Common/CommonCheckBillEvent.js index d1ca1ed..6a9ad88 100644 --- a/src/components/Common/CommonCheckBillEvent.js +++ b/src/components/Common/CommonCheckBillEvent.js @@ -2367,6 +2367,7 @@ export default (ChildComponent) => { const value = { sClientType: '1', sFilterOrderBy, bFilter, sListFormmasterId, currentPosition, handleType, iCountSum: pages.total, }; + this.props.onSaveState({ loading: true }); const url = `${commonConfig.server_host}business/getBusinessDataByIndex?sModelsId=${sModelsId}`; /* 接收返回值 */ const { data } = await commonServices.postValueService(token, value, url); diff --git a/src/components/Common/CommonElementEvent.js b/src/components/Common/CommonElementEvent.js index 49f9b36..a302530 100644 --- a/src/components/Common/CommonElementEvent.js +++ b/src/components/Common/CommonElementEvent.js @@ -3081,6 +3081,7 @@ export default (ChildComponent) => { sClientType: '1', sFilterOrderBy, bFilter, sListFormmasterId, currentPosition, handleType, iCountSum: pages?.total, sUpId: masterData?.sId, sParentModelId :sSrcModelsId, }; + this.props.onSaveState({ loading: true }); const url = `${commonConfig.server_host}business/getBusinessDataByIndex?sModelsId=${sModelsId}`; /* 接收返回值 */ const { data } = await commonServices.postValueService(token, value, url); @@ -3115,6 +3116,7 @@ export default (ChildComponent) => { searchUpDownData: {}, slaveSelectedRowKeys: [], sBillIdsArray, + loading: true, }, () => this.handleGetTableData()); return true; }; diff --git a/src/components/Common/CommonGroupBillEvent.js b/src/components/Common/CommonGroupBillEvent.js index dc151c7..27291ff 100644 --- a/src/components/Common/CommonGroupBillEvent.js +++ b/src/components/Common/CommonGroupBillEvent.js @@ -1742,6 +1742,7 @@ export default (ChildComponent) => { const value = { sClientType: '1', sFilterOrderBy, bFilter, sListFormmasterId, currentPosition, handleType, iCountSum: pages.total, }; + this.props.onSaveState({ loading: true }); const url = `${commonConfig.server_host}business/getBusinessDataByIndex?sModelsId=${sModelsId}`; /* 接收返回值 */ const { data } = await commonServices.postValueService(token, value, url); diff --git a/src/components/Common/CommonNewBillEvent.js b/src/components/Common/CommonNewBillEvent.js index dbc5a3c..5264c9c 100644 --- a/src/components/Common/CommonNewBillEvent.js +++ b/src/components/Common/CommonNewBillEvent.js @@ -2265,6 +2265,7 @@ export default ChildComponent => { sUpId: masterData?.sId, sParentModelId: sSrcModelsId, }; + this.props.onSaveState({ loading: true }); const url = `${commonConfig.server_host}business/getBusinessDataByIndex?sModelsId=${sModelsId}`; /* 接收返回值 */ const { data } = await commonServices.postValueService(token, value, url); @@ -2296,6 +2297,7 @@ export default ChildComponent => { searchUpDownData: {}, slaveSelectedRowKeys: [], sBillIdsArray, + loading: true }, () => { this.handleGetData(masterConfig, slaveConfig, slave0Config, slave1Config, slave2Config, slave3Config, slave4Config); diff --git a/src/components/Common/CommonNewTabBillEvent.js b/src/components/Common/CommonNewTabBillEvent.js index fd37fe7..739c99d 100644 --- a/src/components/Common/CommonNewTabBillEvent.js +++ b/src/components/Common/CommonNewTabBillEvent.js @@ -2261,7 +2261,7 @@ export default (ChildComponent) => { if (!commonUtils.isNum(currentPosition)) { // 如果是列表直接点增加,就跳到第一条去 currentPosition = 1; } - + this.props.onSaveState({ loading: true }); const value = { sClientType: '1', sFilterOrderBy, bFilter, sListFormmasterId, currentPosition, handleType, iCountSum: pages.total, }; diff --git a/src/components/Common/CommonSubBillEvent.js b/src/components/Common/CommonSubBillEvent.js index 7e93d12..c685c38 100644 --- a/src/components/Common/CommonSubBillEvent.js +++ b/src/components/Common/CommonSubBillEvent.js @@ -2882,6 +2882,7 @@ export default (ChildComponent) => { sClientType: '1', sFilterOrderBy, bFilter, sListFormmasterId, currentPosition, handleType, iCountSum: pages.total, sUpId: masterData?.sId, sParentModelId :sSrcModelsId, }; + this.props.onSaveState({ loading: true }); const url = `${commonConfig.server_host}business/getBusinessDataByIndex?sModelsId=${sModelsId}`; /* 接收返回值 */ const { data } = await commonServices.postValueService(token, value, url); @@ -2912,6 +2913,7 @@ export default (ChildComponent) => { searchUpDownData: {}, slaveSelectedRowKeys: [], sBillIdsArray, + loading: true, }, () => { this.handleGetData(masterConfig, slaveConfig, checkConfig);