From b1ef056e714527684c5503970ab638b8c2ccd5a3 Mon Sep 17 00:00:00 2001 From: pengm <674192343@qq.com> Date: Tue, 3 Feb 2026 11:52:10 +0800 Subject: [PATCH] 1.处理列表复制到,websocket断连导致复制到按钮点击不动问题 --- src/components/Common/CommonListEvent.js | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 83 insertions(+), 31 deletions(-) diff --git a/src/components/Common/CommonListEvent.js b/src/components/Common/CommonListEvent.js index 33b2699..8279640 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; } } @@ -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); @@ -1854,7 +1882,7 @@ export default (ChildComponent) => { } = this.props; let isRefresh = true; const formRoute = '/indexOee/commonOeeBill'; - + const copyTo = {}; if (commonUtils.isNotEmptyArr(slaveSelectedData)) { const copyToConfig = slaveConfig.gdsconfigformslave.filter(item => item.sControlName.includes(name)); let copyToData = slaveSelectedData; @@ -1921,7 +1949,6 @@ export default (ChildComponent) => { if (rtmsg.msg === 'continue') { const { formRoute } = this.state; if (commonUtils.isNotEmptyArr(copyToData)) { - const copyTo = {}; copyTo.name = name; copyTo.config = copyToConfig; copyTo.masterData = copyToData[0]; @@ -1952,23 +1979,48 @@ 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 (dataReturn.dataset.rows.length > 0) { - const { sId } = dataReturn.dataset.rows[0]; - if (commonUtils.isNotEmptyObject(sId)) { /* 查看 */ - sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null); - this.props.onSaveOeeState({ checkedId: sId }); + 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')); // 请选择数据 } - // 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); + const sendSocketMessage = this.props.handleSendSocketMessage; + if (dataReturn.dataset.rows.length > 0) { + const { sId } = dataReturn.dataset.rows[0]; + if (commonUtils.isNotEmptyObject(sId)) { /* 查看 */ + sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null); + this.props.onSaveOeeState({ checkedId: sId }); + } + // 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); -- libgit2 0.22.2