共计 655 个字符,预计需要花费 2 分钟才能阅读完成。
columns: [{ title: 'xxx', dataIndex: 'xxx', align: 'center', customRender: renderContent}
],
// 合并行
mergeRow () {var colTemp = {}
this.dataSource.map((item, index) => {var key = `${item.riskName}:${item.riskDes}:${item.riskPlrLevel}`
if (colTemp[key]) {
col1.forEach(col => {if (col.val === key) {col.len++}
})
} else {colTemp[key] = 1
col1.push({
idx: index,
val: `${item.riskName}:${item.riskDes}:${item.riskPlrLevel}`,
len: 1
})
}
})
},
// 合并行
var col1 = []
const renderContent = (value, row, index) => {
const obj = {
children: value,
attrs: {}}
var key = `${row.riskName}:${row.riskDes}:${row.riskPlrLevel}`
col1.forEach(col => {if (col.val === key) {if (col.idx === index) {obj.attrs.rowSpan = col.len} else {obj.attrs.rowSpan = 0}
}
})
return obj
}
正文完