diff --git a/src/components/Common/CommonTable/index.js b/src/components/Common/CommonTable/index.js index 4efa621..cec0c31 100644 --- a/src/components/Common/CommonTable/index.js +++ b/src/components/Common/CommonTable/index.js @@ -4216,11 +4216,9 @@ class CommonTableRc extends React.Component { } } - handleGetSumStyle = (sName, index) => { - const { data = [] } = this.props; + handleGetSumStyle = (sName, record) => { const { sumGroup = {} } = this.state; const sumList = sumGroup[sName] || []; - const record = data[index]; return sumList.includes(record?.[this.rowKey]) ? " tableSumColor" : ""; } @@ -5421,7 +5419,7 @@ class CommonTableRc extends React.Component { } if (record.bSum && commonConfig.hasSum) { /* 从表无数据 */ res = (); - const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo); + const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo, record); return cell; } else if (props.tableBelone === 'list' || ((commonUtils.isNotEmptyObject(props.slaveInfo) && props.slaveInfo.tableBelone === 'list'))) { /* CommonList列表加下划线 */ @@ -5585,7 +5583,7 @@ class CommonTableRc extends React.Component { {bShow}{imgBox}{this.handleGetFastSearchBtn({ record, sName, isSlaveInfo })} ); } - const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo); + const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo, record); return cell; } else if (commonUtils.isNotEmptyObject(showConfigObj) && !showConfigObj.bReadonly && (props.enabled || showConfigObj.iTag === 3) && commonUtils.isEmptyObject(record.sDivRowNew) && (commonUtils.isNotEmptyArr(props.selectedRowKeys) @@ -5597,7 +5595,7 @@ class CommonTableRc extends React.Component { res = (); // 人检-质检代码特殊处理 res = this.handleGetRjRes(res, index, sName); - const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo); + const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo, record); return cell; } else if (props.bSParamTable && sName === 'sParamValue' && commonUtils.isNotEmptyObject(record.sDropDownData)) { const showTypeProps = this.getShowTypeProps(props, text, record, sName); @@ -5610,7 +5608,7 @@ class CommonTableRc extends React.Component { } } res = (); - const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo); + const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo, record); return cell; } else { const showConfig = this.getShowConfig(props, sName); @@ -5880,7 +5878,7 @@ class CommonTableRc extends React.Component { // 人检-质检代码特殊处理 res = this.handleGetRjRes(res, index, sName); - const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo); + const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo, record); return cell; } }; @@ -6428,7 +6426,7 @@ class CommonTableRc extends React.Component { } /** 合并单元格 */ - mergeTableCell = (text, index, sName, isSlaveInfo) => { + mergeTableCell = (text, index, sName, isSlaveInfo, record) => { const obj = { children: text, props: {}, @@ -6468,7 +6466,7 @@ class CommonTableRc extends React.Component { }); }); } - obj.props.className = `${obj.props.className || ''}${this.handleGetSumStyle(sName, index)}`; + obj.props.className = `${obj.props.className || ''}${this.handleGetSumStyle(sName, record)}`; return obj; }