功能变化:

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 method
* @param filename * @param filename
*/ */
export const downloadFile = function ({ url, params, method, filename="文件导出" }) { export const downloadFile = function ({ url, params, method, filename= '文件导出' }) {
request({ request({
url: url, url: url,
method: method, method: method,
@ -224,7 +224,8 @@ export const downloadFile = function ({ url, params, method, filename="文件导
responseType: 'blob' responseType: 'blob'
// headers: {Accept: 'application/vnd.openxmlformats-officedocument'} // headers: {Accept: 'application/vnd.openxmlformats-officedocument'}
}).then(res => { }).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) { if (res) {
const blob = new Blob([res.data], { type: 'charset=utf-8' }) const blob = new Blob([res.data], { type: 'charset=utf-8' })
const elink = document.createElement('a') const elink = document.createElement('a')