function workDownLoad() {
var rows = reportForm1.getSelecteds();
var dataList = []
if(rows.length){
exportList = rows
}
$(exportList).each(function(index,element){
var item = {
db: element.DB,
proposalId: element.proposalId,
unitName: element.unitName
}
dataList.push(item)
});
var url = "/url";
var xhr = new XMLHttpRequest();
xhr.open('post', url, true);
xhr.setRequestHeader("Content-type","application/json;");
xhr.setRequestHeader("Content-disposition", "attachment; ");
xhr.send(JSON.stringify(dataList));
xhr.responseType = "blob";
xhr.onload = function (data, textStatus, request) {
if (this.status===200) {
var blob = this.response;
var reader = new FileReader();
reader.readAsDataURL(blob);
reader.onload=function (e) {
console.log(e);
var a = document.createElement('a');
a.download="推荐提案"+".zip";
a.href = e.target.result;
$("body").append(a);
a.click();
$(a).remove();
}
}
else{
alert("出现了未知的错误!");
}
};
}