feat(导航): 替换数据分析为资产盘点并优化备份下载
将导航栏中的数据分析功能替换为资产盘点,并更新相关路由和描述 优化备份文件下载功能,使用blob方式下载并添加错误处理
This commit is contained in:
@@ -4,12 +4,12 @@ import {
|
|||||||
CloudServerOutlined,
|
CloudServerOutlined,
|
||||||
DatabaseOutlined,
|
DatabaseOutlined,
|
||||||
WarningOutlined,
|
WarningOutlined,
|
||||||
BarChartOutlined,
|
|
||||||
AppstoreOutlined,
|
AppstoreOutlined,
|
||||||
SettingOutlined,
|
SettingOutlined,
|
||||||
ApartmentOutlined,
|
ApartmentOutlined,
|
||||||
LinkOutlined,
|
LinkOutlined,
|
||||||
ArrowRightOutlined,
|
ArrowRightOutlined,
|
||||||
|
AuditOutlined,
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { designTokens } from '../../config/theme';
|
import { designTokens } from '../../config/theme';
|
||||||
|
|
||||||
@@ -39,12 +39,12 @@ const NAV_BUTTONS_DATA = [
|
|||||||
description: '工单和故障处理',
|
description: '工单和故障处理',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'analytics',
|
key: 'inventory',
|
||||||
icon: BarChartOutlined,
|
icon: AuditOutlined,
|
||||||
text: '数据分析',
|
text: '资产盘点',
|
||||||
path: '/',
|
path: '/inventory',
|
||||||
color: '#13c2c2',
|
color: '#13c2c2',
|
||||||
description: '数据统计和分析',
|
description: '资产库存和盘点管理',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'consumables',
|
key: 'consumables',
|
||||||
|
|||||||
@@ -190,8 +190,22 @@ const BackupManagement = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDownload = filename => {
|
const handleDownload = async filename => {
|
||||||
window.open(`/api/backup/download/${filename}`, '_blank');
|
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 => {
|
const handleValidate = async filename => {
|
||||||
|
|||||||
Reference in New Issue
Block a user