导出文件名称
parent
e2333edf17
commit
e11aa7ce24
|
@ -202,6 +202,7 @@ export default {
|
|||
}
|
||||
|
||||
const exportData = async () => {
|
||||
|
||||
axios({
|
||||
method: "post",
|
||||
url: '/template',
|
||||
|
@ -211,19 +212,13 @@ export default {
|
|||
},
|
||||
responseType: 'blob',
|
||||
}).then((response) => {
|
||||
const url = window.URL.createObjectURL(new Blob([response]));
|
||||
|
||||
let fileName = response.headers['content-disposition'].split('filename=')[1];
|
||||
const url = window.URL.createObjectURL(new Blob([response.data]));
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.setAttribute('download', props.formData.name +'_points.csv');
|
||||
link.setAttribute('download', `${decodeURI(fileName.split('"')[1])}`);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
// const link = document.createElement('a');
|
||||
// link.href = url;
|
||||
// link.setAttribute('download', '_points.csv');
|
||||
// link.click();
|
||||
// document.body.removechild(link);
|
||||
// window.URL.revokeobjectURL(url);
|
||||
}).catch(error => console.log(error));
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ axios.interceptors.request.use(
|
|||
|
||||
axios.interceptors.response.use(
|
||||
(res) => {
|
||||
|
||||
for (const key in res.headers) {
|
||||
if (Object.hasOwnProperty.call(res.headers, "token")) {
|
||||
const token = res.headers["token"];
|
||||
|
@ -34,6 +35,10 @@ axios.interceptors.response.use(
|
|||
}
|
||||
}
|
||||
}
|
||||
if(res.config.headers['action'] == 53211) { // 导出文件
|
||||
return res;
|
||||
}
|
||||
console.log(res);
|
||||
const ret = res.data;
|
||||
// token过期
|
||||
if (ret.code === 3004) {
|
||||
|
|
Loading…
Reference in New Issue