Commit b1ef056e714527684c5503970ab638b8c2ccd5a3

Authored by Min
1 parent 27046c9a

1.处理列表复制到,websocket断连导致复制到按钮点击不动问题

src/components/Common/CommonListEvent.js
@@ -1750,6 +1750,9 @@ export default (ChildComponent) => { @@ -1750,6 +1750,9 @@ export default (ChildComponent) => {
1750 const iConfigIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === sNotRepeatColumn); 1750 const iConfigIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === sNotRepeatColumn);
1751 const sNotRepeatShowName = iConfigIndex > -1 ? slaveConfig.gdsconfigformslave[iConfigIndex].showName : ''; 1751 const sNotRepeatShowName = iConfigIndex > -1 ? slaveConfig.gdsconfigformslave[iConfigIndex].showName : '';
1752 message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseSame') + sNotRepeatShowName); // 请选择相同 1752 message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseSame') + sNotRepeatShowName); // 请选择相同
  1753 + this.props.onSaveState({
  1754 + loading: false,
  1755 + });
1753 return; 1756 return;
1754 } 1757 }
1755 } 1758 }
@@ -1815,21 +1818,46 @@ export default (ChildComponent) => { @@ -1815,21 +1818,46 @@ export default (ChildComponent) => {
1815 const values = { sSlaveId: sId }; 1818 const values = { sSlaveId: sId };
1816 const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data; 1819 const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data;
1817 if (dataReturn.code === 1) { 1820 if (dataReturn.code === 1) {
1818 - const sendSocketMessage = this.props.handleSendSocketMessage;  
1819 - if (sIdArray?.length > 10) {  
1820 - sId = sIdArray?.[0];  
1821 - }  
1822 - if (dataReturn.dataset.rows.length > 0) {  
1823 - confirm({  
1824 - title: commonFunc.showMessage(app.commonConst, 'beUsedToNew'), /* 单据已存在,是否填写新单据 */  
1825 - onOk() {  
1826 - sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);  
1827 - },  
1828 - onCancel() {  
1829 - },  
1830 - }); 1821 + if (commonUtils.isNotEmptyArr(copyToData) && copyToData.length > 0) { /* 复制到数据大于200 就不走websoket */
  1822 + if (commonUtils.isNotEmptyArr(copyToData)) {
  1823 + copyTo.name = name;
  1824 + copyTo.config = copyToConfig;
  1825 + copyTo.srcFormRoute = this.props.formRoute; /* 未清来源路由 */
  1826 + if (name !== 'BtnCopyTo.workOrderToWorkOrder' && !name.includes('BtnCopyTo.tmpInfo') && !name.includes('ByQuo')
  1827 + && !name?.toLowerCase()?.includes('tmpinfobysql')
  1828 + && !name.includes('ByOrder') && !name.includes('ByWork')) {
  1829 + copyTo.masterData = copyToData[0];
  1830 + copyTo.slaveData = copyToData;
  1831 + copyTo.copyOtherData = addcopyOther;
  1832 + }
  1833 + dispatch({
  1834 + type: 'content/onRouter',
  1835 + payload: {
  1836 + url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}&sName=${formRoute}`, /* 接口地址 */
  1837 + copyTo,
  1838 + refresh: getData.bind(this, slaveConfig, slaveFilterCondition, commonUtils.isEmpty(slavePagination) ? 0 : slavePagination.current, slavePagination.pageSize, slaveOrderBy, isRefresh, undefined, undefined, treeFilterCondition),
  1839 + },
  1840 + });
  1841 + } else {
  1842 + message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据
  1843 + }
1831 } else { 1844 } else {
1832 - sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null); 1845 + const sendSocketMessage = this.props.handleSendSocketMessage;
  1846 + if (sIdArray?.length > 10) {
  1847 + sId = sIdArray?.[0];
  1848 + }
  1849 + if (dataReturn.dataset.rows.length > 0) {
  1850 + confirm({
  1851 + title: commonFunc.showMessage(app.commonConst, 'beUsedToNew'), /* 单据已存在,是否填写新单据 */
  1852 + onOk() {
  1853 + sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
  1854 + },
  1855 + onCancel() {
  1856 + },
  1857 + });
  1858 + } else {
  1859 + sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
  1860 + }
1833 } 1861 }
1834 } else { 1862 } else {
1835 this.props.getServiceError(dataReturn); 1863 this.props.getServiceError(dataReturn);
@@ -1854,7 +1882,7 @@ export default (ChildComponent) => { @@ -1854,7 +1882,7 @@ export default (ChildComponent) => {
1854 } = this.props; 1882 } = this.props;
1855 let isRefresh = true; 1883 let isRefresh = true;
1856 const formRoute = '/indexOee/commonOeeBill'; 1884 const formRoute = '/indexOee/commonOeeBill';
1857 - 1885 + const copyTo = {};
1858 if (commonUtils.isNotEmptyArr(slaveSelectedData)) { 1886 if (commonUtils.isNotEmptyArr(slaveSelectedData)) {
1859 const copyToConfig = slaveConfig.gdsconfigformslave.filter(item => item.sControlName.includes(name)); 1887 const copyToConfig = slaveConfig.gdsconfigformslave.filter(item => item.sControlName.includes(name));
1860 let copyToData = slaveSelectedData; 1888 let copyToData = slaveSelectedData;
@@ -1921,7 +1949,6 @@ export default (ChildComponent) => { @@ -1921,7 +1949,6 @@ export default (ChildComponent) => {
1921 if (rtmsg.msg === 'continue') { 1949 if (rtmsg.msg === 'continue') {
1922 const { formRoute } = this.state; 1950 const { formRoute } = this.state;
1923 if (commonUtils.isNotEmptyArr(copyToData)) { 1951 if (commonUtils.isNotEmptyArr(copyToData)) {
1924 - const copyTo = {};  
1925 copyTo.name = name; 1952 copyTo.name = name;
1926 copyTo.config = copyToConfig; 1953 copyTo.config = copyToConfig;
1927 copyTo.masterData = copyToData[0]; 1954 copyTo.masterData = copyToData[0];
@@ -1952,23 +1979,48 @@ export default (ChildComponent) => { @@ -1952,23 +1979,48 @@ export default (ChildComponent) => {
1952 const values = { sSlaveId: sId }; 1979 const values = { sSlaveId: sId };
1953 const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data; 1980 const dataReturn = (await commonServices.postValueService(token, values, dataUrl)).data;
1954 if (dataReturn.code === 1) { 1981 if (dataReturn.code === 1) {
1955 - const sendSocketMessage = this.props.handleSendSocketMessage;  
1956 - if (dataReturn.dataset.rows.length > 0) {  
1957 - const { sId } = dataReturn.dataset.rows[0];  
1958 - if (commonUtils.isNotEmptyObject(sId)) { /* 查看 */  
1959 - sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);  
1960 - this.props.onSaveOeeState({ checkedId: sId }); 1982 + if (commonUtils.isNotEmptyArr(copyToData) && copyToData.length > 0) { /* 复制到数据大于200 就不走websoket */
  1983 + if (commonUtils.isNotEmptyArr(copyToData)) {
  1984 + copyTo.name = name;
  1985 + copyTo.config = copyToConfig;
  1986 + copyTo.srcFormRoute = this.props.formRoute; /* 未清来源路由 */
  1987 + if (name !== 'BtnCopyTo.workOrderToWorkOrder' && !name.includes('BtnCopyTo.tmpInfo') && !name.includes('ByQuo')
  1988 + && !name?.toLowerCase()?.includes('tmpinfobysql')
  1989 + && !name.includes('ByOrder') && !name.includes('ByWork')) {
  1990 + copyTo.masterData = copyToData[0];
  1991 + copyTo.slaveData = copyToData;
  1992 + copyTo.copyOtherData = addcopyOther;
  1993 + }
  1994 + dispatch({
  1995 + type: 'content/onRouter',
  1996 + payload: {
  1997 + url: `${commonConfig.server_host}gdsmodule/getGdsmoduleById/${sActiveId}?sModelsId=${sActiveId}&sName=${formRoute}`, /* 接口地址 */
  1998 + copyTo,
  1999 + refresh: getData.bind(this, slaveConfig, slaveFilterCondition, commonUtils.isEmpty(slavePagination) ? 0 : slavePagination.current, slavePagination.pageSize, slaveOrderBy, isRefresh, undefined, undefined, treeFilterCondition),
  2000 + },
  2001 + });
  2002 + } else {
  2003 + message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseData')); // 请选择数据
1961 } 2004 }
1962 - // confirm({  
1963 - // title: commonFunc.showMessage(app.commonConst, 'beUsedToNew'), /* 单据已存在,是否填写新单据 */  
1964 - // onOk() {  
1965 - // sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);  
1966 - // },  
1967 - // onCancel() {  
1968 - // },  
1969 - // });  
1970 } else { 2005 } else {
1971 - sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null); 2006 + const sendSocketMessage = this.props.handleSendSocketMessage;
  2007 + if (dataReturn.dataset.rows.length > 0) {
  2008 + const { sId } = dataReturn.dataset.rows[0];
  2009 + if (commonUtils.isNotEmptyObject(sId)) { /* 查看 */
  2010 + sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
  2011 + this.props.onSaveOeeState({ checkedId: sId });
  2012 + }
  2013 + // confirm({
  2014 + // title: commonFunc.showMessage(app.commonConst, 'beUsedToNew'), /* 单据已存在,是否填写新单据 */
  2015 + // onOk() {
  2016 + // sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
  2017 + // },
  2018 + // onCancel() {
  2019 + // },
  2020 + // });
  2021 + } else {
  2022 + sendSocketMessage('copy', 'execute', sId, userinfo.sId, null, null);
  2023 + }
1972 } 2024 }
1973 } else { 2025 } else {
1974 this.props.getServiceError(dataReturn); 2026 this.props.getServiceError(dataReturn);