getSpanArr(data) {
this.count = []
if (data === null) return
for (let i = 0; i < data.length; i++) {
if (i === 0) {
this.count.push(1)
this.pos = 0
} else {
if (data[i].unite_hash === data[i - 1].unite_hash) {
this.count[this.pos] += 1
this.count.push(0)
} else {
this.count.push(1)
this.pos = i
}
}
}
},
objectSpanMethod({
row, column, rowIndex, columnIndex }) {
if ([11].includes(columnIndex)) {
const _row = this.count[rowIndex]
const _col = _row > 0 ? 1 : 0
return {
rowspan: _row,
colspan: _col
}
}
},
getSpanArr(tableData)
<el-table
:data="tableData"
:span-method="arraySpanMethod"
border
style="width: 100%">
</el-table>