fix: 固定列在主表渲染引起的渲染多次问题

This commit is contained in:
izbz wh 2021-01-14 09:48:51 +08:00
parent 95637d9eac
commit 390a8a4e5f
6 changed files with 2930 additions and 3588 deletions

File diff suppressed because one or more lines are too long

2
dist/demo.css.map vendored

File diff suppressed because one or more lines are too long

5228
dist/demo.js vendored

File diff suppressed because one or more lines are too long

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -199,67 +199,73 @@ class TableCell extends Component{
let tdProps; let tdProps;
let colSpan; let colSpan;
let rowSpan,title; let rowSpan,title;
if (render && !showSum) {
text = render(text, record, index,{
dataIndex, render, fieldType, linkConfig, fontColor, bgColor,...other
});
if (this.isInvalidRenderCellText(text)) {
tdProps = text.props || {};
rowSpan = (tdProps.rowSpan>lazyEndIndex && lazyEndIndex>5)?lazyEndIndex-index:tdProps.rowSpan;
colSpan = tdProps.colSpan;
text = text.children;
}
}
let colMenu = this.renderColumnMenu(column.cellMenu, text, record, index); let colMenu = this.renderColumnMenu(column.cellMenu, text, record, index);
// 根据 fieldType 来渲染数据 // 如果是固定列在主表格上就渲染null
if(!render){ if(column.fixed && !fixed){
switch(column.fieldType){ text = null
case 'link':{ }else {
text = this.renderLinkType(text, record, index, column.linkConfig); if (render && !showSum) {
break; text = render(text, record, index,{
dataIndex, render, fieldType, linkConfig, fontColor, bgColor,...other
});
if (this.isInvalidRenderCellText(text)) {
tdProps = text.props || {};
rowSpan = (tdProps.rowSpan>lazyEndIndex && lazyEndIndex>5)?lazyEndIndex-index:tdProps.rowSpan;
colSpan = tdProps.colSpan;
text = text.children;
} }
case 'bool':{ }
text = this.renderBoolType(text, column.boolConfig);
break;
} // 根据 fieldType 来渲染数据
case 'currency':{ if(!render){
let config = { switch(column.fieldType){
precision: 2, // 精度值,需要大于0 case 'link':{
thousand: true, // 是否显示千分符号 text = this.renderLinkType(text, record, index, column.linkConfig);
makeUp: true, // 末位是否补零 break;
preSymbol: '', // 前置符号
nextSymbol: '', // 后置符号
} }
text = this.renderNumber(text, {...config,...column.currencyConfig}, column.width); case 'bool':{
break; text = this.renderBoolType(text, column.boolConfig);
} break;
case 'number':{ }
let config = { case 'currency':{
precision: 0, // 精度值,需要大于0 let config = {
thousand: true, // 是否显示千分符号 precision: 2, // 精度值,需要大于0
makeUp: false, // 末位是否补零 thousand: true, // 是否显示千分符号
preSymbol: '', // 前置符号 makeUp: true, // 末位是否补零
nextSymbol: '', // 后置符号 preSymbol: '', // 前置符号
nextSymbol: '', // 后置符号
}
text = this.renderNumber(text, {...config,...column.currencyConfig}, column.width);
break;
}
case 'number':{
let config = {
precision: 0, // 精度值,需要大于0
thousand: true, // 是否显示千分符号
makeUp: false, // 末位是否补零
preSymbol: '', // 前置符号
nextSymbol: '', // 后置符号
}
text = this.renderNumber(text, {...config,...column.numberConfig}, column.width);
break;
}
case 'date':{
text = this.renderDate(text, column.dateConfig);
break;
}
case 'select':{
text = this.renderSelect(text, column.selectConfig);
break;
}
default : {
break;
} }
text = this.renderNumber(text, {...config,...column.numberConfig}, column.width);
break;
}
case 'date':{
text = this.renderDate(text, column.dateConfig);
break;
}
case 'select':{
text = this.renderSelect(text, column.selectConfig);
break;
}
default : {
break;
} }
} }
} }
if (this.isInvalidRenderCellText(text)) { if (this.isInvalidRenderCellText(text)) {
text = null; text = null;
} }