From e57b6b6f4609b36743f8c6a68872bf47282ebe3c Mon Sep 17 00:00:00 2001 From: pengm <674192343@qq.com> Date: Thu, 5 Feb 2026 13:35:45 +0800 Subject: [PATCH] 1.app心跳包 定时去检查当前WebSocket连接状态,如果是打开状态,则先发送消息;如果websoket关闭了,则重新建立连接 --- src/components/Common/CommonListEvent.js | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------- src/components/Common/commonKeyUp.js | 3 +-- src/components/IndexCenter/IndexCenter.js | 2 +- src/models/app.js | 6 ++++-- src/routes/indexPage.js | 56 ++++++++++++++++++++++++++++---------------------------- 5 files changed, 100 insertions(+), 71 deletions(-) diff --git a/src/components/Common/CommonListEvent.js b/src/components/Common/CommonListEvent.js index 873ea78..deae3d8 100644 --- a/src/components/Common/CommonListEvent.js +++ b/src/components/Common/CommonListEvent.js @@ -1750,6 +1750,9 @@ export default (ChildComponent) => { const iConfigIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === sNotRepeatColumn); const sNotRepeatShowName = iConfigIndex > -1 ? slaveConfig.gdsconfigformslave[iConfigIndex].showName : ''; message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseSame') + sNotRepeatShowName); // 请选择相同 + this.props.onSaveState({ + loading: false, + }); return; } } @@ -1780,33 +1783,33 @@ export default (ChildComponent) => { this.props.app.webSocket.onmessageTmp = (msg) => { const rtmsg = JSON.parse(msg.data); if (rtmsg.action === 'execute') { - if (rtmsg.msg === 'continue') { - const { formRoute } = this.state; - if (commonUtils.isNotEmptyArr(copyToData)) { - copyTo.name = name; - copyTo.config = copyToConfig; - if (name !== 'BtnCopyTo.workOrderToWorkOrder' && !name.includes('BtnCopyTo.tmpInfo') && !name.includes('btncopyto.tmpinfobysql')) { - copyTo.masterData = copyToData[0]; - copyTo.slaveData = copyToData; - copyTo.copyOtherData = addcopyOther; - copyTo.srcFormRoute = this.props.formRoute; /* 未清来源路由 */ - } - copyTo.copyToDataSid = sId?.split(','); - dispatch({ - type: 'content/onRouter', - payload: { - url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}&sName=${formRoute}`, /* 接口地址 */ - copyTo, - refresh: getData.bind(this, slaveConfig, slaveFilterCondition, commonUtils.isEmpty(slavePagination) ? 0 : slavePagination.current, slavePagination.pageSize, slaveOrderBy, isRefresh, undefined, undefined, treeFilterCondition), - sSrcModelsId: this.props.sModelsId, - }, - }); - } else { - message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据 + if (rtmsg.msg !== 'continue') { + message.warning(rtmsg.handlers + commonFunc.showMessage(app.commonConst, 'InOperation'));/* 在操作,请稍后再操作! */ + } + const { formRoute } = this.state; + if (commonUtils.isNotEmptyArr(copyToData)) { + copyTo.name = name; + copyTo.config = copyToConfig; + if (name !== 'BtnCopyTo.workOrderToWorkOrder' && !name.includes('BtnCopyTo.tmpInfo') && !name.includes('btncopyto.tmpinfobysql')) { + copyTo.masterData = copyToData[0]; + copyTo.slaveData = copyToData; + copyTo.copyOtherData = addcopyOther; + copyTo.srcFormRoute = this.props.formRoute; /* 未清来源路由 */ } + copyTo.copyToDataSid = sId?.split(','); + dispatch({ + type: 'content/onRouter', + payload: { + url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}&sName=${formRoute}`, /* 接口地址 */ + copyTo, + refresh: getData.bind(this, slaveConfig, slaveFilterCondition, commonUtils.isEmpty(slavePagination) ? 0 : slavePagination.current, slavePagination.pageSize, slaveOrderBy, isRefresh, undefined, undefined, treeFilterCondition), + sSrcModelsId: this.props.sModelsId, + }, + }); } else { - message.warning(rtmsg.handlers + commonFunc.showMessage(app.commonConst, 'InOperation'));/* 在操作,请稍后再操作! */ + message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据 } + } }; let sId = sIdArray.toString(); @@ -1815,21 +1818,46 @@ export default (ChildComponent) => { const values = { sSlaveId: sId }; const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data; if (dataReturn.code === 1) { - const sendSocketMessage = this.props.handleSendSocketMessage; - if (sIdArray?.length > 10) { - sId = sIdArray?.[0]; - } - if (dataReturn.dataset.rows.length > 0) { - confirm({ - title: commonFunc.showMessage(app.commonConst, 'beUsedToNew'), /* 单据已存在,是否填写新单据 */ - onOk() { - sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null); - }, - onCancel() { - }, - }); + if (commonUtils.isNotEmptyArr(copyToData) && copyToData.length > 0) { /* 复制到数据大于200 就不走websoket */ + if (commonUtils.isNotEmptyArr(copyToData)) { + copyTo.name = name; + copyTo.config = copyToConfig; + copyTo.srcFormRoute = this.props.formRoute; /* 未清来源路由 */ + if (name !== 'BtnCopyTo.workOrderToWorkOrder' && !name.includes('BtnCopyTo.tmpInfo') && !name.includes('ByQuo') + && !name?.toLowerCase()?.includes('tmpinfobysql') + && !name.includes('ByOrder') && !name.includes('ByWork')) { + copyTo.masterData = copyToData[0]; + copyTo.slaveData = copyToData; + copyTo.copyOtherData = addcopyOther; + } + dispatch({ + type: 'content/onRouter', + payload: { + url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}&sName=${formRoute}`, /* 接口地址 */ + copyTo, + refresh: getData.bind(this, slaveConfig, slaveFilterCondition, commonUtils.isEmpty(slavePagination) ? 0 : slavePagination.current, slavePagination.pageSize, slaveOrderBy, isRefresh, undefined, undefined, treeFilterCondition), + }, + }); + } else { + message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据 + } } else { - sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null); + const sendSocketMessage = this.props.handleSendSocketMessage; + if (sIdArray?.length > 10) { + sId = sIdArray?.[0]; + } + if (dataReturn.dataset.rows.length > 0) { + confirm({ + title: commonFunc.showMessage(app.commonConst, 'beUsedToNew'), /* 单据已存在,是否填写新单据 */ + onOk() { + sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null); + }, + onCancel() { + }, + }); + } else { + sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null); + } } } else { this.props.getServiceError(dataReturn); diff --git a/src/components/Common/commonKeyUp.js b/src/components/Common/commonKeyUp.js index 96b5160..5db7b3a 100644 --- a/src/components/Common/commonKeyUp.js +++ b/src/components/Common/commonKeyUp.js @@ -41,7 +41,6 @@ export function getKeyUpEvent(name, sFieldName, tableConfig, masterData, tableDa const sAssignField = tableConfig.gdsconfigformslave[iConfigIndex].sOnChangeAssignField; const sButtonParam = tableConfig.gdsconfigformslave[iConfigIndex].sButtonParam; /* 设置多级联动 */ - console.log('sAssignField:', sAssignField); // 根据赋值字段类型分发处理逻辑 /* keyUp联动其他表 */ @@ -500,7 +499,7 @@ function formatTableData(originObj) { if (originObj == null || typeof originObj !== 'object') { return {}; } - + const newObj = {}; // 遍历原始对象的键值对 Object.entries(originObj).forEach(([key, value]) => { diff --git a/src/components/IndexCenter/IndexCenter.js b/src/components/IndexCenter/IndexCenter.js index 2cbc598..e7eb47b 100644 --- a/src/components/IndexCenter/IndexCenter.js +++ b/src/components/IndexCenter/IndexCenter.js @@ -784,7 +784,7 @@ class IndexCenter extends Component { .replace('{token}', token) .replace('{ipAddress}', addressStr) .replace('{ipPadAddress}', ipPadAddress) : ''; - console.log('iframeUrl', iframeUrl); + const ExtraWrap = (