const exportExcel = () => {// 获取表格数据const table = document.querySelector('#out-table');const data = [];const headers = [];// 获取表头table.querySelectorAll('th').forEach(th => {headers.push(th.innerText.trim());});// 获取表格数据table.querySelectorAll('tbody tr').forEach(tr => {const rowData = [];tr.querySelectorAll('td').forEach(td => {rowData.push(td.innerText.trim());});data.push(rowData);});// 创建工作簿const ws = XLSX.utils.aoa_to_sheet([headers, ...data]);const wb = XLSX.utils.book_new();XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');var wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' });try {FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), '控流记录.xlsx');} catch (e) {if (typeof console !== 'undefined') console.log(e, wbout);}return wbout;
}