File tree Expand file tree Collapse file tree
packages/vtable/src/layout Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3347,14 +3347,17 @@ export class PivotHeaderLayoutMap implements LayoutMapAPI {
33473347 if ( this . rowHierarchyType === 'grid' ) {
33483348 // defaultCol = (this.rowHeaderTitle ? afterSpanLevel + 1 : afterSpanLevel) + this.leftRowSeriesNumberColumnCount;
33493349 // 传入rowHeaderPaths是合并单元格如行总计的path数据的情况,上面defaultCol总是返回0 所以需要修改如下:
3350- const col = rowHeaderPaths . reduce ( ( acc , path ) => {
3351- const index = this . rowDimensionKeys . indexOf ( path . dimensionKey ) ;
3352- if ( index >= 0 ) {
3353- acc += 1 ;
3354- }
3355- return acc ;
3356- } , - 1 ) ;
3357- defaultCol = ( this . rowHeaderTitle ? col + 1 : col ) + this . leftRowSeriesNumberColumnCount ;
3350+ //检查rowHeaderPaths 和this.rowDimensionKeys数组中的维度key是否匹配
3351+ const isMatch = rowHeaderPaths . every ( ( path : IDimensionInfo , index : number ) => {
3352+ return this . rowDimensionKeys [ index ] === path . dimensionKey ;
3353+ } ) ;
3354+ if ( isMatch ) {
3355+ const col = rowHeaderPaths . length - 1 ;
3356+ defaultCol = ( this . rowHeaderTitle ? col + 1 : col ) + this . leftRowSeriesNumberColumnCount ;
3357+ } else {
3358+ defaultCol =
3359+ ( this . rowHeaderTitle ? afterSpanLevel + 1 : afterSpanLevel ) + this . leftRowSeriesNumberColumnCount ;
3360+ }
33583361 } else {
33593362 defaultCol = 0 ;
33603363 } //树形展示的情况下 肯定是在第0列
You can’t perform that action at this time.
0 commit comments