rowSpan() {
this.spanArr = [];
this.position = 0;
this.dForm3.d32List.forEach((item, index) => {
if (index === 0) {
this.spanArr.push(1);
this.position = 0;
} else {
if (this.dForm3.d32List[index].resultType === this.dForm3.d32List[index - 1].resultType) {
this.spanArr[this.position] += 1;
this.spanArr.push(0);
} else {
this.spanArr.push(1);
this.position = index;
}
}
});
},
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if (this.handleFlag && this.isValid03) {
if (columnIndex === 1) {// columnIndex:表示是第几 列
const _row = this.spanArr[rowIndex];
const _col = _row > 0 ? 1 : 0;
return {
rowspan: _row,
colspan: _col,
};
}
if (columnIndex === 0 && rowIndex < 7) {
const _row = this.spanArr[rowIndex];
const _col = _row > 0 ? 1 : 0;
return {
rowspan: _row,
colspan: _col,
};
}
} else {
if (columnIndex === 0) {// columnIndex:表示是第几 列
if (columnIndex === 0 || columnIndex === 1) {// columnIndex:表示是第几 列
const _row = this.spanArr[rowIndex];
const _col = _row > 0 ? 1 : 0;
return {
rowspan: _row,
colspan: _col,
};
}
}
}
},
vue2+elementUI el-table合并行
最新推荐文章于 2024-08-13 09:40:14 发布