修复 table 导出来自 treeTable 数据的顺序错乱问题

pull/1368/head
贤心 2023-09-11 11:21:08 +08:00
parent f00403e2a9
commit 3123adfe13
1 changed files with 14 additions and 0 deletions

View File

@ -2834,6 +2834,20 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
if(device.ie) return hint.error('IE_NOT_SUPPORT_EXPORTS'); if(device.ie) return hint.error('IE_NOT_SUPPORT_EXPORTS');
// 处理 treeTable 数据
if (config.tree && config.tree.view) {
try {
data = $.extend(true, [], table.cache[id]);
data = (function fn(data) {
return data.reduce(function (acc, obj){
var children = obj.children || [];
delete obj.children;
return acc.concat(obj, fn(children));
}, []);
})(Array.from(data));
} catch (e) {}
}
alink.href = 'data:'+ textType +';charset=utf-8,\ufeff'+ encodeURIComponent(function(){ alink.href = 'data:'+ textType +';charset=utf-8,\ufeff'+ encodeURIComponent(function(){
var dataTitle = []; var dataTitle = [];
var dataMain = []; var dataMain = [];