修改导出遮罩层显示时间:处理完成时关闭

This commit is contained in:
wangwei
2019-04-22 18:39:30 +08:00
parent 77716a9517
commit 8719ed0527
3 changed files with 313 additions and 258 deletions

View File

@@ -114,9 +114,11 @@ Date.prototype.Format = function (fmt) {
return fmt;
}
function aJaxImportPost(url, params) {
function aJaxImportPost(url, params) {
top.$.jBox.tip("onloading",'loading',{opacity:0.5,persistent:true});
// 创建form元素
var temp_form = document.createElement("form");
temp_form.id = "temp_form";
// 设置form属性
temp_form .action = url;
temp_form .target = "_self";
@@ -129,7 +131,32 @@ function aJaxImportPost(url, params) {
opt.value = params[x];
temp_form .appendChild(opt);
}
document.body.appendChild(temp_form);
// 提交表单
temp_form .submit();
document.body.appendChild(temp_form);
url=url+"?";
url+="&"+$('#temp_form').serialize();
var xmlResquest = new XMLHttpRequest();
xmlResquest.open("POST", url, true);
xmlResquest.setRequestHeader("Content-type", "application/json");
xmlResquest.setRequestHeader("Content-Disposition","attachment");
xmlResquest.responseType = "blob";
xmlResquest.onload = function (oEvent) {
var contDisp = xmlResquest.getResponseHeader("content-disposition")
var fileName = contDisp.substring(contDisp.indexOf("=")+1,contDisp.length).replace(/\"/g,"")
var content = xmlResquest.response;
var elink = document.createElement('a');
elink.download = fileName;
elink.style.display = 'none';
var blob = new Blob([content]);
elink.href = URL.createObjectURL(blob);
document.body.appendChild(elink);
elink.click();
document.body.removeChild(elink);
};
xmlResquest.onreadystatechange = function() {
if (xmlResquest.readyState==4) {
top.$.jBox.closeTip();
}
};
xmlResquest.send();
}