部门产品接口人信息
</el-table>
},
methods: {
getDepartList(){
/**/页面中列表中如果含有增加删除操作,需要重新渲染一下数组,
把数组需要清空一下
this.deptProdLiaList=[];
this.spanArr=[];
this.position = 0;**
requestDepartPerList().then(response => {
this.deptProdLiaList = response.deptProdLiaList;
this.deptProdLiaList.forEach((item,index) => {
if( index === 0){
this.spanArr.push(1);
this.position = 0;
}else{
if(this.deptProdLiaList[index].deptName === this.deptProdLiaList[index-1].deptName ){
this.spanArr[this.position] += 1;//连续有几行项目名名称相同[1,]
this.spanArr.push(0); // 名称相同后往数组里面加一项0
}else{
this.spanArr.push(1);
this.position = index;
}
}
})
})
},
objectSpanMethod({ row, column, rowIndex, columnIndex }){
// this.spanArr=[];
// this.position = 0;
if (columnIndex === 0) {
const _row = this.spanArr[rowIndex];
const _col = _row > 0 ? 1 : 0;//0表示不显示
return {
rowspan: _row,
colspan: _col
}
}
}
}
}