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 }; },