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
@@ -4,12 +4,12 @@ import {
CloudServerOutlined,
DatabaseOutlined,
WarningOutlined,
BarChartOutlined,
AppstoreOutlined,
SettingOutlined,
ApartmentOutlined,
LinkOutlined,
ArrowRightOutlined,
AuditOutlined,
} from '@ant-design/icons';
import { designTokens } from '../../config/theme';
@@ -39,12 +39,12 @@ const NAV_BUTTONS_DATA = [
description: '工单和故障处理',
},
{
key: 'analytics',
icon: BarChartOutlined,
text: '数据分析',
path: '/',
key: 'inventory',
icon: AuditOutlined,
text: '资产盘点',
path: '/inventory',
color: '#13c2c2',
description: '数据统计和分析',
description: '资产库存和盘点管理',
},
{
key: 'consumables',
+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 => {