前端js实现excel xls xlsx 文件导出 xlsx.js xlsx.full.min.js
// 导出 window.scoreExport = function () { var expertData = table.cache['my-table']; if (typeof (expertData) == 'undefined') { layer.msg("暂无数据!"); return; } var dataList = new Array(); for (let index in expertData) { dataList.push({ '姓名': expertData[index].realname, '身份证': expertData[index].idcard? "'" + expertData[index].idcard:'', '分数': expertData[index].point, '开始时间': expertData[index].start, '结束时间': expertData[index].end }) } var ws = XLSX.utils.json_to_sheet(dataList); var wb = XLSX.utils.book_new();/*新建book*/ XLSX.utils.book_append_sheet(wb, ws, "sheet1"); XLSX.writeFile(wb, "评分导出"+start+"-"+end+".xlsx");/*写文件(book,xlsx文件名称)*/ },
xlsx.full.js 文件下载:
链接: https://pan.baidu.com/s/1S6d2kqeJ1tLUUMbUTeJ_jQ?pwd=cgm7 提取码: cgm7