export function exportDataIncrementStatisticsData (query) {
return request({
url: baseUrl + '/report/exportDataIncrementStatisticsData',
method: 'post',
data: query,
responseType: 'blob'
})
}
export const fileExport = (res) => {
let fileName = res.headers['content-disposition']
if (fileName) {
fileName = decodeURI(fileName.split('filename=')[1])
}
const blob = new Blob([res.data], {
ContentType: 'application/octet-stream;charset=uft-8;'
})
const downloadUrl = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = downloadUrl
link.download = fileName || '下载文件.xls'
document.body.appendChild(link)
link.click()
link.remove()
window.URL.revokeObjectURL(downloadUrl)
}
export const downloadWithUrl = (url, fileName, isBlank, isDownload) => {
const a = document.createElement('a');
const fName = fileName || url.replace(/^.*\//, '');
a.setAttribute('href', url);
if (isDownload) a.setAttribute('download', fName);
if (isBlank) a.setAttribute('target', '_blank');
a.style.setProperty('display', 'none');
document.body.appendChild(a);
a.click();
a.remove();
};