|
|
|
|
@ -82,46 +82,18 @@ function enterEngineering(item: IEngineeringOV) {
@@ -82,46 +82,18 @@ function enterEngineering(item: IEngineeringOV) {
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// function handleDownload(item: IEngineeringOV) { |
|
|
|
|
// if (!item.downloadPath) { |
|
|
|
|
// ElMessage.warning('下载地址为空') |
|
|
|
|
// return |
|
|
|
|
// } |
|
|
|
|
// const link = document.createElement('a') |
|
|
|
|
// link.style.display = 'none' |
|
|
|
|
// link.href = item.downloadPath |
|
|
|
|
// link.setAttribute('download', item.name) |
|
|
|
|
// document.body.appendChild(link) |
|
|
|
|
// link.click() |
|
|
|
|
// document.body.removeChild(link) |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
async function handleDownload(item: IEngineeringOV) { |
|
|
|
|
function handleDownload(item: IEngineeringOV) { |
|
|
|
|
if (!item.downloadPath) { |
|
|
|
|
ElMessage.warning('请完成工程配置!') |
|
|
|
|
ElMessage.warning('下载地址为空') |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
const res = await fetch(item.downloadPath) |
|
|
|
|
if (!res.ok) { |
|
|
|
|
throw new Error('Network response was not ok') |
|
|
|
|
} |
|
|
|
|
const blob = await res.blob() |
|
|
|
|
const link = document.createElement('a') |
|
|
|
|
link.style.display = 'none' |
|
|
|
|
link.href = URL.createObjectURL(blob) |
|
|
|
|
const urlFileName = item.downloadPath.substring( |
|
|
|
|
item.downloadPath.lastIndexOf('/') + 1, |
|
|
|
|
) |
|
|
|
|
link.download = urlFileName |
|
|
|
|
document.body.appendChild(link) |
|
|
|
|
link.click() |
|
|
|
|
document.body.removeChild(link) |
|
|
|
|
URL.revokeObjectURL(link.href) |
|
|
|
|
} catch (error) { |
|
|
|
|
ElMessage.error('下载失败,请检查网络或联系管理员') |
|
|
|
|
console.error('Download failed:', error) |
|
|
|
|
} |
|
|
|
|
const link = document.createElement('a') |
|
|
|
|
link.style.display = 'none' |
|
|
|
|
link.href = item.downloadPath |
|
|
|
|
link.setAttribute('download', item.name) |
|
|
|
|
document.body.appendChild(link) |
|
|
|
|
link.click() |
|
|
|
|
document.body.removeChild(link) |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|