{ title: "核算项", dataIndex: "hesxName", key: "hesxName", align: "center", customRender: (text, record, index) => { const obj = { children: text !== null ? text : "", attrs: {}, }; obj.attrs.rowSpan = this.mergeCells( text, this.cacheData.snapshot, "hesxName", index ); return obj; },
mergeCells(text, data, key, index) { // 上一行该列数据是否一样 if (index !== 0 && text === data[index - 1][key]) { return 0; } let rowSpan = 1; // 判断下一行是否相等 for (let i = index + 1; i < data.length; i++) { if (text !== data[i][key]) { break; } rowSpan++; } return rowSpan; },