如表所示,合并相同的行
el-table 的span-method方法,在<el-table>中定义为:span-method="arraySpanMethod"
interface SpanMethodProps {
row: any
column: TableColumnCtx<any>
rowIndex: number
columnIndex: number
}
const arraySpanMethod = ({
row,
column,
rowIndex,
columnIndex,
}: SpanMethodProps) => {
// 合并行 订单编号相同合并、合并第1,2,3,4列,所以合判断columnIndex是否等于0,1,2,3,4
if (columnIndex === 0 || columnIndex === 1 || columnIndex === 2 || columnIndex === 3 || columnIndex === 4) {
if (rowIndex === 0 || row.produceId != tableData.value[rowIndex - 1].produceId) {
let rowspan = 0;
tableData.value.forEach((element: any) => {
//遍历,若