<el-table
:span-method="arraySpanMethod"
// ...
/>
arraySpanMethod({ row, column, rowIndex, columnIndex }) {
const { nodeNum, count, nodeName, nodeRemark } = row
if ([0, 1].includes(columnIndex)) { // 只合并第一列和第二列
switch (nodeNum) {
case 0:
return columnIndex === 0 ? [1, 2] : [0, 0]
case 1:
return columnIndex === 0 ? [count, 2] : [0, 0]
case 2:
return columnIndex === 0 ? [count, 1] : [1, 1]
case 3:
return columnIndex === 0 ? [count, 1] : [1, 1]
case 8:
return columnIndex === 0 ? [count, 1] : [1, 1]
case 12:
return columnIndex === 0 ? [count, 1] : [1, 1]
case 14:
return columnIndex === 0 ? [count, 1] : [1, 1]
case 22:
return columnIndex === 0 ? [count, 1] : [1, 1]
default:
return nodeName === nodeRemark
? columnIndex === 0 ? [1, 2] : [0, 0]
: [1, 1]
}
}
},