报告查询一键下载

This commit is contained in:
hayu 2025-12-10 18:40:30 +08:00
parent 02ecad4289
commit f18a9b53c1
1 changed files with 7 additions and 3 deletions

View File

@ -1047,18 +1047,23 @@ export default {
return total;
},
/** 流式下载方法 - 使用原始的request方式 */
/** 流式下载方法 - 使用原始的request方式 */
async streamDownload(payload) {
try {
this.progressText = '正在连接服务器...';
// 使request
const response = await request({
url: '/material/bm_report/downloadBulkStream',
method: 'POST',
data: payload,
responseType: 'blob',
timeout: 0,
headers: {
encryptRequest: false,
checkIntegrity: false,
encryptResponse: false
},
onDownloadProgress: (progressEvent) => {
this.handleDownloadProgress(progressEvent);
}
@ -1074,11 +1079,9 @@ export default {
document.body.appendChild(a);
a.click();
//
window.URL.revokeObjectURL(url);
document.body.removeChild(a);
//
this.handleDownloadComplete();
} catch (error) {
@ -1093,6 +1096,7 @@ export default {
}
},
/** 处理下载进度 */
handleDownloadProgress(progressEvent) {
if (progressEvent.total) {