/*
* get下载文件
* @param url:地址
* @param data:参数
*/
async getDownFile(url, data){
return axios({
method: 'get',
params: data,
dataType: 'json',
url: url,
responseType: 'blob',
headers: {
// eslint-disable-next-line
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
}
})
},
exportFile(){
let url = `${window.baseUrl}/es/abnormalAlarm/export`;
// ?pageNum=${this.listQuery.pageNum}&pageSize=${this.listQuery.pageSize}&deviceStation=${this.listQuery.deviceStation || ''}&videoGuids=${this.listQuery.videoGuids || ''}
let params = {
pageNum:this.listQuery.pageNum,
pageSize:this.listQuery.pageSize,
deviceStation:this.listQuery.deviceStation || '',
videoGuids:this.listQuery.videoGuids || '',
}
this.api.deviceDownFile(url,params)
.then((res) => {
console.log(res,'res')
let url = window.URL.createObjectURL(new Blob([res.data]));
let link = document.createElement("a");
link.style.display = "none";
link.href = url;
link.setAttribute("download", this.$route.meta.title + ".xlsx");
document.body.appendChild(link);
link.click();
})
.catch(() => {
this.$message.error("出现错误!");
});
},
get导出文件
最新推荐文章于 2024-03-14 11:32:03 发布