
//SKU合并列表数据
function objectSpanMethod({ row, column, rowIndex, columnIndex }:any){
let data = goodsList.value //拿到当前tatle 的数据
let cellValue = rowcolumn.property; //当前位置的值
let noSortArr = 'attr_string', 'goods_unit', 'goods_sum', 'sale_money', 'sum_shop_price', 'profit' //不需要合并的字段(不进行合并行的prop)
if (cellValue && !noSortArr.includes(column.property)) {
let prevRow = datarowIndex - 1; //获取到上一条数据
let nextRow = datarowIndex + 1; //下一条数据
if (prevRow && prevRowcolumn.property === cellValue) {
//当有上一条数据,并且和当前值相等时
return { rowspan: 0, colspan: 0 };
} else {
let countRowspan = 1;
while (nextRow && nextRowcolumn.property === cellValue) {
//当有下一条数据并且和当前值相等时,获取新的下一条
nextRow = data++countRowspan + rowIndex;
}
if (countRowspan > 1) {
return { rowspan: countRowspan, colspan: 1 };
}
}
}
}
