// 导出excel
$('#btnExp').click(function () {
layer.msg('导出成功');
var jsonData =layui.table.cache.testReload;
{#console.log(jsonData.length);#}
{#console.log(jsonData);#}
for(var k=0;k
delete jsonData[k]["sysdepartmentid"];
delete jsonData[k]["othername"];
delete jsonData[k]["sysadmin"];
delete jsonData[k]["systemid"];
delete jsonData[k]["statusid"];
delete jsonData[k]["lv"];
delete jsonData[k]["new"];
delete jsonData[k]["appdepartment"];
delete jsonData[k]["department3id"];
delete jsonData[k]["type"];
delete jsonData[k]["useage"];
delete jsonData[k]["appdepartmentid"];
delete jsonData[k]["rdteam"];
delete jsonData[k]["remarks"];
delete jsonData[k]["lvid"];
delete jsonData[k]["typeid"];
delete jsonData[k]["record"];
delete jsonData[k]["newid"];
delete jsonData[k]["appadmin"];
delete jsonData[k]["verno"];
delete jsonData[k]["sysdepartment"];
delete jsonData[k]["Id"];
delete jsonData[k]["LAY_TABLE_INDEX"];
delete jsonData[k]["sysaim"];
}
//列标题,逗号隔开,每一个逗号就是隔开一个单元格
let str =`运行状态,服务交付通道,产品名称,IT属主单位,业务属主单位,部署位置,IT负责人,调用的总颁系统,功能区,产品缩写\n`;
//增加\t为了不让表格显示科学计数法或者其他格式
for(let i =0 ;i
for(let item in jsonData[i]){
str+=`${jsonData[i][item] +'\t'},`;
}
str+='\n';
}
//encodeURIComponent解决中文乱码
let uri ='data:text/csv;charset=utf-8,\ufeff' +encodeURIComponent(str);
//通过创建a标签实现
var link =document.createElement("a");
link.href =uri;
//对下载的文件命名
link.download ="新增系统产品名录.xls";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
});