From 44cbc75091a19907fc14418f88580e07dd6937b3 Mon Sep 17 00:00:00 2001 From: betaqi <3188864257@qq.com> Date: Tue, 16 Dec 2025 19:12:03 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=B8=80=E4=BA=9B=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/components/StepDeviceCategory.vue | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/views/engineering/config/components/StepDeviceCategory.vue b/src/views/engineering/config/components/StepDeviceCategory.vue index be19cd8..e6b64d6 100644 --- a/src/views/engineering/config/components/StepDeviceCategory.vue +++ b/src/views/engineering/config/components/StepDeviceCategory.vue @@ -349,23 +349,23 @@ const cancelAllUploads = () => { async function handleDownload(pointName: string) { try { - const res = await fetch( - `/remoteServer/admin-api/project/point/download-excel?projectName=${projectName.value}&pointName=${pointName}`, - ) - debugger - // 检查响应是否成功 - if (!res.ok) { - throw new Error('Network response was not ok') + const res = await downloadDeviceTypeFile({ + projectName: projectName.value, + pointName, + }) + if (res) { + const blob = res.data + const link = document.createElement('a') + link.style.display = 'none' + link.href = URL.createObjectURL(blob) + link.download = `${pointName}.xlsx` + document.body.appendChild(link) + link.click() + document.body.removeChild(link) + URL.revokeObjectURL(link.href) + } else { + ElMessage.error('下载失败') } - const blob = await res.blob() - const link = document.createElement('a') - link.style.display = 'none' - link.href = URL.createObjectURL(blob) - link.download = `${pointName}.xlsx` - document.body.appendChild(link) - link.click() - document.body.removeChild(link) - URL.revokeObjectURL(link.href) } catch (error) { ElMessage.error('下载出现错误') }