|
|
|
@ -110,26 +110,30 @@ onMounted(() => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
function handleDownload(row) { |
|
|
|
function handleDownload(row) { |
|
|
|
if (row.status !== '1') { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
fetch(`${BASE_PATH}/file/stream${row.filePath}`) |
|
|
|
fetch(`${BASE_PATH}/file/stream${row.filePath}`) |
|
|
|
.then((response) => { |
|
|
|
.then((response) => response.blob()) |
|
|
|
console.log(response); |
|
|
|
.then((blob) => { |
|
|
|
return response.blob(); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.then((res) => { |
|
|
|
|
|
|
|
console.log(res); |
|
|
|
|
|
|
|
const blob = new Blob([res], { |
|
|
|
|
|
|
|
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
const url = window.URL.createObjectURL(blob); |
|
|
|
const url = window.URL.createObjectURL(blob); |
|
|
|
|
|
|
|
|
|
|
|
const link = document.createElement("a"); |
|
|
|
const link = document.createElement("a"); |
|
|
|
link.href = url; |
|
|
|
link.href = url; |
|
|
|
link.setAttribute("download", row.taskName + ".xlsx"); |
|
|
|
|
|
|
|
|
|
|
|
let fileName = row.taskName; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (row.filePath.endsWith(".docx")) { |
|
|
|
|
|
|
|
fileName += ".docx"; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
fileName += ".xlsx"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
link.download = fileName; |
|
|
|
|
|
|
|
|
|
|
|
document.body.appendChild(link); |
|
|
|
document.body.appendChild(link); |
|
|
|
link.click(); |
|
|
|
link.click(); |
|
|
|
document.body.removeChild(link); |
|
|
|
document.body.removeChild(link); |
|
|
|
|
|
|
|
|
|
|
|
window.URL.revokeObjectURL(url); |
|
|
|
window.URL.revokeObjectURL(url); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|