< el- table : data= "tableData" : span- method= "objectSpanMethod" >
< el- table- column prop= "id" label= "序号" align= "center" > < / el- table- column>
< el- table- column prop= "productName" label= "项目名称" align= "center" > < / el- table- column>
< el- table- column prop= "des" label= "项目整体进展" align= "center" > < / el- table- column>
< el- table- column prop= "pd" label= "产品经理" align= "center" > < / el- table- column>
< el- table- column prop= "staff" label= "开发人员" align= "center" > < / el- table- column>
< el- table- column prop= "role" label= "开发人员类型 前端/后端/测试" align= "center" width= "120px" > < / el- table- column>
< el- table- column prop= "consumedTime" label= "开发人员当月累计工时" align= "center" > < / el- table- column>
< / el- table>
getSpanArr ( data) {
this . spanArr = [ ]
let index = 0
for ( var i = 0 ; i < data. length; i++ ) {
if ( i === 0 ) {
this . spanArr. push ( 1 )
index = 0
} else {
if ( data[ i] . id === data[ i - 1 ] . id) {
this . spanArr[ index] += 1
this . spanArr. push ( 0 )
} else {
this . spanArr. push ( 1 )
index = i
}
}
}
} ,
objectSpanMethod ( { row, column, rowIndex, columnIndex } ) {
if ( columnIndex === 0 || columnIndex === 1 || columnIndex === 2 || columnIndex === 3 ) {
let _row = this . spanArr[ rowIndex]
let _col = _row > 0 ? 1 : 0
return {
rowspan: _row,
colspan: _col
}
}