From 8bf59ab1b9e97a0a7d2fa122746b287c185852ae Mon Sep 17 00:00:00 2001
From: ZN <zhang_12370@163.com>
Date: 星期五, 20 三月 2026 11:49:36 +0800
Subject: [PATCH] fix(排班管理): 修复导出文件下载时响应类型处理问题
---
src/api/personnelManagement/class.js | 3 ++-
src/views/personnelManagement/classsSheduling/index.vue | 12 ++++++++----
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/api/personnelManagement/class.js b/src/api/personnelManagement/class.js
index f5ae299..b254c4a 100644
--- a/src/api/personnelManagement/class.js
+++ b/src/api/personnelManagement/class.js
@@ -71,6 +71,7 @@
url: "/personalShift/export",
method: "get",
params: query,
+ responseType: "blob",
});
}
@@ -114,4 +115,4 @@
method: 'get',
params: query,
})
-}
\ No newline at end of file
+}
diff --git a/src/views/personnelManagement/classsSheduling/index.vue b/src/views/personnelManagement/classsSheduling/index.vue
index 6891a57..5c0169b 100644
--- a/src/views/personnelManagement/classsSheduling/index.vue
+++ b/src/views/personnelManagement/classsSheduling/index.vue
@@ -674,10 +674,12 @@
})
.then(res => {
proxy.$modal.msgSuccess("涓嬭浇鎴愬姛");
- downLoading.value = false;
- const blob = new Blob([res], {
- type: "application/force-download",
- });
+ const blob =
+ res instanceof Blob
+ ? res
+ : new Blob([res], {
+ type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
+ });
let fileName = "";
if (query.month) {
fileName = year + "-" + query.month + " 鐝淇℃伅";
@@ -687,6 +689,8 @@
proxy.$download.saveAs(blob, fileName + ".xlsx");
})
.catch(err => {
+ })
+ .finally(() => {
downLoading.value = false;
});
};
--
Gitblit v1.9.3