Commit 04a302b632d4120dbe1e913bf3c89d9a050c31e6

Authored by zhangzzzz
1 parent 324f5098

优化sum功能;

src/components/Common/CommonTable/index.js
... ... @@ -4216,11 +4216,9 @@ class CommonTableRc extends React.Component {
4216 4216 }
4217 4217 }
4218 4218  
4219   - handleGetSumStyle = (sName, index) => {
4220   - const { data = [] } = this.props;
  4219 + handleGetSumStyle = (sName, record) => {
4221 4220 const { sumGroup = {} } = this.state;
4222 4221 const sumList = sumGroup[sName] || [];
4223   - const record = data[index];
4224 4222 return sumList.includes(record?.[this.rowKey]) ? " tableSumColor" : "";
4225 4223 }
4226 4224  
... ... @@ -5421,7 +5419,7 @@ class CommonTableRc extends React.Component {
5421 5419 }
5422 5420 if (record.bSum && commonConfig.hasSum) { /* 从表无数据 */
5423 5421 res = (<Input {...inputProps} />);
5424   - const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo);
  5422 + const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo, record);
5425 5423 return cell;
5426 5424 } else if (props.tableBelone === 'list' || ((commonUtils.isNotEmptyObject(props.slaveInfo) && props.slaveInfo.tableBelone === 'list'))) {
5427 5425 /* CommonList列表加下划线 */
... ... @@ -5585,7 +5583,7 @@ class CommonTableRc extends React.Component {
5585 5583 {bShow}{imgBox}{this.handleGetFastSearchBtn({ record, sName, isSlaveInfo })}
5586 5584 </div>);
5587 5585 }
5588   - const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo);
  5586 + const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo, record);
5589 5587 return cell;
5590 5588 } else if (commonUtils.isNotEmptyObject(showConfigObj) && !showConfigObj.bReadonly && (props.enabled || showConfigObj.iTag === 3)
5591 5589 && commonUtils.isEmptyObject(record.sDivRowNew) && (commonUtils.isNotEmptyArr(props.selectedRowKeys)
... ... @@ -5597,7 +5595,7 @@ class CommonTableRc extends React.Component {
5597 5595 res = (<ShowTypeNew {...this.getShowTypeProps(props, text, record, sName)} />);
5598 5596 // 人检-质检代码特殊处理
5599 5597 res = this.handleGetRjRes(res, index, sName);
5600   - const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo);
  5598 + const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo, record);
5601 5599 return cell;
5602 5600 } else if (props.bSParamTable && sName === 'sParamValue' && commonUtils.isNotEmptyObject(record.sDropDownData)) {
5603 5601 const showTypeProps = this.getShowTypeProps(props, text, record, sName);
... ... @@ -5610,7 +5608,7 @@ class CommonTableRc extends React.Component {
5610 5608 }
5611 5609 }
5612 5610 res = (<ShowTypeNew {...showTypeProps} />);
5613   - const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo);
  5611 + const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo, record);
5614 5612 return cell;
5615 5613 } else {
5616 5614 const showConfig = this.getShowConfig(props, sName);
... ... @@ -5880,7 +5878,7 @@ class CommonTableRc extends React.Component {
5880 5878 // 人检-质检代码特殊处理
5881 5879 res = this.handleGetRjRes(res, index, sName);
5882 5880  
5883   - const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo);
  5881 + const cell = this.mergeTableCell(res, idx, sName, isSlaveInfo, record);
5884 5882 return cell;
5885 5883 }
5886 5884 };
... ... @@ -6428,7 +6426,7 @@ class CommonTableRc extends React.Component {
6428 6426 }
6429 6427  
6430 6428 /** 合并单元格 */
6431   - mergeTableCell = (text, index, sName, isSlaveInfo) => {
  6429 + mergeTableCell = (text, index, sName, isSlaveInfo, record) => {
6432 6430 const obj = {
6433 6431 children: text,
6434 6432 props: {},
... ... @@ -6468,7 +6466,7 @@ class CommonTableRc extends React.Component {
6468 6466 });
6469 6467 });
6470 6468 }
6471   - obj.props.className = `${obj.props.className || ''}${this.handleGetSumStyle(sName, index)}`;
  6469 + obj.props.className = `${obj.props.className || ''}${this.handleGetSumStyle(sName, record)}`;
6472 6470 return obj;
6473 6471 }
6474 6472  
... ...