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('下载出现错误') }