From 328be53b4461397cd96da79c7e40c892bdb94e2a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 15 六月 2025 21:00:39 +0800 Subject: [PATCH] 2025-06-15 --- src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index 1a7e8c1..f59a12f 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -524,9 +524,10 @@ } } - let excelName = btn.verify.excelName || '' - if (/@.*@/.test(excelName)) { - excelName = excelName.replace(/@bid@/ig, BID) + let excelName = `${btn.verify.excelName || btn.$menuName || ''}${moment().format('YYYYMMDDHHmmss')}` + if (btn.verify.excelName && /@.*@/.test(btn.verify.excelName)) { + excelName = btn.verify.excelName.replace(/@bid@/ig, BID) + excelName = excelName.replace(/@getdate@/ig, moment().format('YYYYMMDDHHmmss')) if (data[0]) { Object.keys(data[0]).forEach(key => { let reg = new RegExp('@' + key + '@', 'ig') @@ -619,7 +620,7 @@ table.push(_row) }) - this.table2excel(column, table, btn, excelName) + this.table2excel(column, table, excelName) this.execSuccess({ErrCode: ErrCode || 'S', message: msg || dict['exc_success'] || '瀵煎嚭鎴愬姛锛�'}) } else { @@ -779,7 +780,7 @@ const wb = XLSX.utils.book_new() XLSX.utils.book_append_sheet(wb, ws, btn.verify.sheet || 'Sheet1') - XLSX.writeFile(wb, `${excelName || btn.$menuName || ''}${moment().format('YYYYMMDDHHmmss')}.xlsx`) + XLSX.writeFile(wb, excelName + '.xlsx') this.execSuccess({ErrCode: ErrCode || 'S', message: msg || dict['exc_success'] || '瀵煎嚭鎴愬姛锛�'}) } @@ -789,7 +790,7 @@ } } - table2excel = (column, data, btn, excelName) => { + table2excel = (column, data, excelName) => { let thead = column.reduce((result, item) => { return result + `<th>${item.title}</th>` }, '') @@ -823,7 +824,7 @@ // let url = 'data:application/vnd.ms-excel;base64,' + window.btoa(unescape(encodeURIComponent(html))) let link = document.createElement('a') link.href = url - link.download = `${excelName || btn.$menuName || ''}${moment().format('YYYYMMDDHHmmss')}.xls` + link.download = excelName + '.xls' document.body.appendChild(link) link.click() document.body.removeChild(link) -- Gitblit v1.8.0