Commit 4b8da0ebbe4dbd642e4114ee0e03553d31435a66
1 parent
150d513c
1.对于 slaveChild 表格,不使用 props.totalData(全部汇总),而是由 handleSumChildColumn 计算分组汇总
Showing
1 changed file
with
6 additions
and
4 deletions
src/components/Common/CommonTable/index.js
| @@ -6308,7 +6308,9 @@ class CommonTableRc extends React.Component { | @@ -6308,7 +6308,9 @@ class CommonTableRc extends React.Component { | ||
| 6308 | } | 6308 | } |
| 6309 | 6309 | ||
| 6310 | /* 合计行数据 *//* 数据(数据格式:数组对象) */ | 6310 | /* 合计行数据 *//* 数据(数据格式:数组对象) */ |
| 6311 | - if (props.totalData !== undefined && JSON.stringify(totalData) !== JSON.stringify(props.totalData) && !this.props.enabled) { // 要用this. this.props.enabled | 6311 | + // 对于 slaveChild 表格,不使用 props.totalData(全部汇总),而是由 handleSumChildColumn 计算分组汇总 |
| 6312 | + const isSlaveChild = this.props.name?.includes('slaveChild'); | ||
| 6313 | + if (props.totalData !== undefined && JSON.stringify(totalData) !== JSON.stringify(props.totalData) && !this.props.enabled && !isSlaveChild) { // 要用this. this.props.enabled | ||
| 6312 | if (props.totalData.length > 0) { | 6314 | if (props.totalData.length > 0) { |
| 6313 | stateValue.totalData = [...props.totalData]; | 6315 | stateValue.totalData = [...props.totalData]; |
| 6314 | if (commonUtils.isEmptyArr(stateValue.totalData)) { | 6316 | if (commonUtils.isEmptyArr(stateValue.totalData)) { |
| @@ -6352,7 +6354,9 @@ class CommonTableRc extends React.Component { | @@ -6352,7 +6354,9 @@ class CommonTableRc extends React.Component { | ||
| 6352 | if (searchText !== props.searchText) { | 6354 | if (searchText !== props.searchText) { |
| 6353 | stateValue.searchText = props.searchText; | 6355 | stateValue.searchText = props.searchText; |
| 6354 | } | 6356 | } |
| 6355 | - if (props.enabled) { | 6357 | + if (this.props.name?.includes('slaveChild')) { |
| 6358 | + this.handleSumChildColumn(props.config, props.data); | ||
| 6359 | + } else if (props.enabled) { | ||
| 6356 | const { config, name, rootType } = this.props; | 6360 | const { config, name, rootType } = this.props; |
| 6357 | if (commonUtils.isNotEmptyObject(config)) { | 6361 | if (commonUtils.isNotEmptyObject(config)) { |
| 6358 | const productionRoute = (commonUtils.isNotEmptyObject(props.app.currentPane) && commonUtils.isNotEmptyObject(props.app.currentPane.route) && props.app.currentPane.route.includes('productionSchedule')); | 6362 | const productionRoute = (commonUtils.isNotEmptyObject(props.app.currentPane) && commonUtils.isNotEmptyObject(props.app.currentPane.route) && props.app.currentPane.route.includes('productionSchedule')); |
| @@ -6364,8 +6368,6 @@ class CommonTableRc extends React.Component { | @@ -6364,8 +6368,6 @@ class CommonTableRc extends React.Component { | ||
| 6364 | addState.totalData = props.totalData; | 6368 | addState.totalData = props.totalData; |
| 6365 | this.setState({ ...addState }) | 6369 | this.setState({ ...addState }) |
| 6366 | } | 6370 | } |
| 6367 | - } else if (name === 'slaveChild') { | ||
| 6368 | - this.handleSumChildColumn(props.config, props.data); | ||
| 6369 | } else { | 6371 | } else { |
| 6370 | this.handleSelectColumn(props.config, props.data); | 6372 | this.handleSelectColumn(props.config, props.data); |
| 6371 | this.handleSumAllColumn(props.config, props.data); | 6373 | this.handleSumAllColumn(props.config, props.data); |