功能变化:

1.导出修改;
pull/84/head
猿小天 2023-01-12 22:04:15 +08:00
parent 3a02832e08
commit 4123236854
1 changed files with 3 additions and 2 deletions

View File

@ -216,7 +216,7 @@ const refreshTken = function () {
* @param method
* @param filename
*/
export const downloadFile = function ({ url, params, method, filename="文件导出" }) {
export const downloadFile = function ({ url, params, method, filename= '文件导出' }) {
request({
url: url,
method: method,
@ -224,7 +224,8 @@ export const downloadFile = function ({ url, params, method, filename="文件导
responseType: 'blob'
// headers: {Accept: 'application/vnd.openxmlformats-officedocument'}
}).then(res => {
const fileName = window.decodeURI(filename + '.xlsx' || res.headers['content-disposition'].split('=')[1]) || '文件导出.xlsx'
const xlsxName = window.decodeURI(res.headers['content-disposition'].split('=')[1])
const fileName = xlsxName || `${filename}.xlsx`
if (res) {
const blob = new Blob([res.data], { type: 'charset=utf-8' })
const elink = document.createElement('a')