第一步
<th halign="center" align="center" field="oo" formatter="zgglfilesome" width="8%">操作</th>
第二步
function downsome(val, row, index) {
var btn = "<a class='new_btn' title='下载' οnclick='fileDownLoad("+ JSON.stringify(row) +")'><i class='fa fa-download fa-lg btnUse' /></a>";
return btn;
第三步
function fileDownLoad(row){
let oldName = "";
let filePath = "";
if(typeof row.oldname != "undefined"){
oldName = row.oldname;
}else{
oldName = row.oldName;
}
if(typeof row.filePath != "undefined"){
filePath = row.filePath;
}else{
filePath = row.filepath;
}
if (row.filePath) {
var params = {};
params["filepath"] = filePath;
params["oldname"] = oldName;
jsutil.core.download("${pageContext.request.contextPath}/common/fileDownload.do", params, "_self");
} else {
$.messager.alert("提示", "未检测到文件路径", "info");
}
}