feat(导航): 替换数据分析为资产盘点并优化备份下载

将导航栏中的数据分析功能替换为资产盘点,并更新相关路由和描述
优化备份文件下载功能,使用blob方式下载并添加错误处理
This commit is contained in:
zhang1106
2026-04-27 17:10:19 +08:00
parent e1367267f8
commit 763e425f78
2 changed files with 22 additions and 8 deletions
+16 -2
View File
@@ -190,8 +190,22 @@ const BackupManagement = () => {
}
};
const handleDownload = filename => {
window.open(`/api/backup/download/${filename}`, '_blank');
const handleDownload = async filename => {
try {
const blob = await backupAPI.download(filename);
// 创建临时链接并触发下载
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = filename;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
message.success('备份文件下载已开始');
} catch (error) {
message.error('下载失败: ' + (error.message || '未知错误'));
}
};
const handleValidate = async filename => {