• 动态合并单元格列


    :span-method="(...arg)=>strategySpanMethodDown(...arg,workingHoursProject)" // html
    // 合并单元格函数 strategySpanMethodDown: function({ row, column, rowIndex, columnIndex }, data) { if (columnIndex === 0 || columnIndex === 10) { var spanArr = this.getSpanArr(data, column.property) const _row = spanArr[rowIndex] const _col = _row > 0 ? 1 : 0 return { rowspan: _row, colspan: _col } } }, // 处理合并行的数据 getSpanArr: function(data, spanKey) { var spanArr = [] var pos = '' for (var i = 0; i < data.length; i++) { if (i === 0) { spanArr.push(1) pos = 0 } else { // 判断当前元素与上一个元素是否相同 if (data[i].name === data[i - 1].name) { spanArr[pos] += 1 spanArr.push(0) } else { spanArr.push(1) pos = i } } } return spanArr }
  • 相关阅读:
    R
    P
    O
    M
    二分算法的一些思考
    I
    H
    G
    5-46 新浪微博热门话题 (30分)——unfinished HASH
    BZOJ 1179: [Apio2009]Atm
  • 原文地址:https://www.cnblogs.com/maxiag/p/15594475.html
Copyright © 2020-2023  润新知