...
|
...
|
@@ -233,11 +233,51 @@ export default { |
|
|
// 下载文件
|
|
|
const handleDownload = (row)=>{
|
|
|
if(row.filePath){
|
|
|
proxy.$http.get('/api-web/vulnerabilities/download',{
|
|
|
path: row.filePath,name:row.fileName
|
|
|
}, function (res) {
|
|
|
handleForm.value.manufacturerName = res.str;
|
|
|
})
|
|
|
|
|
|
let docMime = row.fileName.slice(row.fileName.lastIndexOf('.') + 1); // 获取文件的后缀
|
|
|
console.log(docMime,"-------");
|
|
|
// 判断下载的文件类型
|
|
|
let mineType = "";
|
|
|
switch (docMime) {
|
|
|
case "xls":
|
|
|
mineType = "application/vnd.ms-excel";
|
|
|
break;
|
|
|
case "xlsx":
|
|
|
mineType = "application/vnd.ms-excel";
|
|
|
break;
|
|
|
case "docx":
|
|
|
mineType = "application/msword";
|
|
|
break;
|
|
|
case "doc":
|
|
|
mineType = "application/msword";
|
|
|
break;
|
|
|
case "zip":
|
|
|
mineType = "application/zip";
|
|
|
break;
|
|
|
case "html":
|
|
|
mineType = "text/html";
|
|
|
break;
|
|
|
case "markdown":
|
|
|
mineType = "text/markdown";
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
let url = window.URL.createObjectURL(new Blob([row.filePath], { type: "application/msword" }));
|
|
|
let link = document.createElement("a");
|
|
|
link.style.display = "none";
|
|
|
link.href = url;
|
|
|
link.setAttribute("download", row.fileName);
|
|
|
document.body.appendChild(link);
|
|
|
link.click();
|
|
|
// 销毁超连接
|
|
|
window.URL.revokeObjectURL(url);
|
|
|
|
|
|
// proxy.$http.get('/api-web/vulnerabilities/download',{
|
|
|
// path: row.filePath,name:row.fileName
|
|
|
// }, function (res) {
|
|
|
// handleForm.value.manufacturerName = res.str;
|
|
|
// })
|
|
|
}else{
|
|
|
proxy.$global.showMsg("无附件信息", 'warning');
|
|
|
}
|
...
|
...
|
|