From 763e425f78770b6ce96a0f7c4b42f0afb30c69a2 Mon Sep 17 00:00:00 2001 From: zhang1106 <849185023@qq.com> Date: Mon, 27 Apr 2026 17:10:19 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=AF=BC=E8=88=AA):=20=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=88=86=E6=9E=90=E4=B8=BA=E8=B5=84=E4=BA=A7?= =?UTF-8?q?=E7=9B=98=E7=82=B9=E5=B9=B6=E4=BC=98=E5=8C=96=E5=A4=87=E4=BB=BD?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将导航栏中的数据分析功能替换为资产盘点,并更新相关路由和描述 优化备份文件下载功能,使用blob方式下载并添加错误处理 --- .../components/dashboard/NavigationGrid.jsx | 12 ++++++------ frontend/src/pages/BackupManagement.jsx | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/dashboard/NavigationGrid.jsx b/frontend/src/components/dashboard/NavigationGrid.jsx index ee88021..2907cb2 100644 --- a/frontend/src/components/dashboard/NavigationGrid.jsx +++ b/frontend/src/components/dashboard/NavigationGrid.jsx @@ -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', diff --git a/frontend/src/pages/BackupManagement.jsx b/frontend/src/pages/BackupManagement.jsx index c9f3af5..95d6c36 100644 --- a/frontend/src/pages/BackupManagement.jsx +++ b/frontend/src/pages/BackupManagement.jsx @@ -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 => {