feat: 分析当前仓库

Co-authored-by: traeagent <traeagent@users.noreply.github.com>
This commit is contained in:
gituib
2026-04-30 15:55:46 +00:00
co-authored by traeagent
parent 5eb1fa4a5f
commit cb6471b8d8
+28 -3
View File
@@ -466,9 +466,34 @@ function RackManagement() {
setDrawerVisible(true);
};
const handleDownloadTemplate = useCallback(() => {
window.open('/api/racks/import-template', '_blank');
message.success('模板下载成功');
const handleDownloadTemplate = useCallback(async () => {
try {
message.loading('正在下载模板...', 0);
const response = await api.get('/racks/import-template', {
responseType: 'blob',
});
// 创建下载链接
const blob = new Blob([response], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
});
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', '机柜导入模板.xlsx');
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
message.destroy();
message.success('模板下载成功');
} catch (error) {
message.destroy();
message.error('模板下载失败');
console.error('模板下载失败:', error);
}
}, []);
// 导出租机柜数据