fix: 固定列在主表渲染引起的渲染多次问题
This commit is contained in:
parent
95637d9eac
commit
390a8a4e5f
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
112
src/TableCell.js
112
src/TableCell.js
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue