...
|
...
|
@@ -106,11 +106,11 @@ layui.define(['common', 'swiper', 'admin', 'commonDetail', 'mxClient', 'sessions |
|
|
<form class="layui-form" style="margin-top: 15px;" lay-filter="vulnerabilityForm">
|
|
|
<div class="layui-form-item">
|
|
|
<label class="layui-form-label">漏洞名称:</label>
|
|
|
<div class="layui-input-block">${d.name}</div>
|
|
|
<div class="layui-input-block" style="line-height: 36px;">${d.name}</div>
|
|
|
</div>
|
|
|
<div class="layui-form-item">
|
|
|
<label class="layui-form-label">漏洞详情:</label>
|
|
|
<div class="layui-input-block">${d.remark}</div>
|
|
|
<div class="layui-input-block" style="line-height: 36px;">${d.remark}</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="layui-form-item">
|
...
|
...
|
@@ -129,7 +129,9 @@ layui.define(['common', 'swiper', 'admin', 'commonDetail', 'mxClient', 'sessions |
|
|
<div><input type="hidden" id="vulnerabilitiesId" name="vulnerabilitiesId" value="${d.id}"></div>
|
|
|
</div>
|
|
|
<div class="layui-form-item">
|
|
|
<button type="button" class="download">下载附件</button>
|
|
|
<label class="layui-form-label">
|
|
|
<button type="button" data-filePath="${d.filePath}" data-fileName="${d.fileName}" class="download layui-btn layui-btn-normal layui-btn-normal searchButton">下载附件</button>
|
|
|
</label>
|
|
|
</div>
|
|
|
</form>
|
|
|
`
|
...
|
...
|
@@ -146,50 +148,15 @@ layui.define(['common', 'swiper', 'admin', 'commonDetail', 'mxClient', 'sessions |
|
|
move: false,
|
|
|
success:()=>{
|
|
|
form.render();
|
|
|
if(d.filePath){
|
|
|
|
|
|
let docMime = d.fileName.slice(d.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;
|
|
|
$('button.download').unbind("click").on('click',function (){
|
|
|
var filePath = $(this).data("filepath");
|
|
|
var fileName = $(this).data("filename");
|
|
|
if(filePath){
|
|
|
window.open(common.domainName+'/api-web/vulnerabilities/download?name='+fileName+'&access_token='+access_token)
|
|
|
}else{
|
|
|
layer.msg("无附件信息", {offset: '15px', icon: 7, time: 1000});
|
|
|
}
|
|
|
let url = window.URL.createObjectURL(new Blob([d.filePath], { type: mineType }));
|
|
|
console.log(url);
|
|
|
let link = document.createElement("a");
|
|
|
link.style.display = "none";
|
|
|
link.href = url;
|
|
|
link.setAttribute("download", d.fileName);
|
|
|
document.body.appendChild(link);
|
|
|
link.click();
|
|
|
// 销毁超连接
|
|
|
window.URL.revokeObjectURL(url);
|
|
|
}else{
|
|
|
layer.msg("无附件信息", {offset: '15px', icon: 7, time: 1000});
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
yes:(index)=>{
|
|
|
var formData = form.val('vulnerabilityForm');
|
...
|
...
|
|