![]() 实现效果如上所示,代码如下,请自行参考: ecodeSDK.overwritePropsFnQueueMapSet('Table', { fn: (newProps) => { if (!enable) return; if (!ecCom.WeaTools.Base64) return; //组件加载完毕 if (!ecodeSDK.checkLPath('/spa/cube/index.html#/main/cube/search?customid=1')) return; if (newProps.ecId != "_Route@9uoqid_Com@knmejd_Spin@j82znn_Animate@mbigvi"); //alert(6666) ; console.log("数据输出:"); console.log(newProps.columns); console.log(newProps.dataSource); newProps.columns.map(function (item) { console.log(item); /* * 单元格合并处理 * @param text 当前单元格的值 * @param data 当前分页所有数据 * @param key 当前列的dataIndex * @param index 当前数据所在下标 * @returns {number} 待合并单元格数量 */ //合并单元格行 const 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 } //数据根据合并字段排序 function bubbleSortByField(arr, field) { const len = arr.length; for (let i = 0; i < len - 1; i++) { for (let j = 0; j < len - 1 - i; j++) { if (arr[j][field] > arr[j + 1][field]) { const temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } } return arr; } //合并字段判断 if (item.dataIndex == 'fl') { item.render = (value, record, index) => { const obj = { children: value !== null ? value : '', props: { rowSpan: 1 } } console.log(obj); obj.props.rowSpan = mergeCells(value, bubbleSortByField(newProps.dataSource, 'fl'), 'fl', index) return obj; } } return item; }); return newProps; } }); |
手机版|企业管理软件交流 ( 沪ICP备2022033774号-1 )
GMT+8, 2025-4-21 12:22 , Processed in 0.035713 second(s), 22 queries .
Powered by Discuz! X3.5
© 2001-2024 Discuz! Team.