• element ui table 合并行或列


                    iqcarraySpanMethod({ row, column, rowIndex, columnIndex }) {
                        let rowspan = 1, colspan = 1;
                        if (column.property == "InspectBatchNo" || column.property == "ProductNo") {
                            var preRow = rowIndex > 0 ? $this.IQCDataList[rowIndex - 1] : {};    //找到需要设置合并的起始行的前一行
                            if (column.property == "InspectBatchNo") {
                                if (preRow["InspectBatchNo"] != row["InspectBatchNo"]) {          //判断前一行字段与当前是否一致,不一致则为新的合并
                                    for (let i = rowIndex + 1; i < $this.IQCDataList.length; i++) {
                                        if (row["InspectBatchNo"] == $this.IQCDataList[i]["InspectBatchNo"]) {
                                            rowspan++;
                                        } else {
                                            break;
                                        }
                                    }
                      //或者这样

    //rowspan = $this.IQCDataList.filter((it) => { return it["InspectBatchNo"] == row["InspectBatchNo"]; }).length;

                                }

    else {
                                    rowspan = 0;
                                }
                            } else if (column.property == "ProductNo") {
                                if (preRow["InspectBatchNo"] != row["InspectBatchNo"] || preRow["ProductNo"] != row["ProductNo"]) {
                                    for (let i = rowIndex + 1; i < $this.IQCDataList.length; i++) {
                                        if (row["ProductNo"] == $this.IQCDataList[i]["ProductNo"]) {
                                            rowspan++;
                                        } else {
                                            break;
                                        }
                                    }
                                }
                                else {
                                    rowspan = 0;
                                }
                            }
                        }
                        return {
                            rowspan: rowspan,
                            colspan: colspan
                        };
                    },
  • 相关阅读:
    [BJWC2010]外星联络
    [NOI2015]品酒大会
    工艺 /【模板】最小表示法
    [NOI2016]优秀的拆分
    [HEOI2016/TJOI2016]字符串
    [SDOI2016]生成魔咒
    【模板】后缀自动机 (SAM)【SA解法】
    [湖南集训]图森
    [USACO17DEC]Standing Out from the Herd P
    Annihilate
  • 原文地址:https://www.cnblogs.com/dare/p/15697041.html
Copyright © 2020-2023  润新知