1. Due to some environmental reasons, the backend cannot give the file download address, and cannot download the binary stream using blob. Ajax simulated form submission cannot download excal directly.
2. Now download the form form of the browser to download the excal file.
triggers the download button to execute the following code. After requesting form, there will be a process of querying data in the background. When the amount of data is large, the download box will pop up only after the browser has been queried. How do I monitor the query process in the background of form? after all, it is not ajax that returns results, and how to add loading to the user"s page. Or how to monitor the user to click Save as to cancel Save as and other actions?
3. Thank you guys for seeing this and hope you can help me.
export default function(options){
return new Promise((resolve, reject)=>{
let dlform = document.createElement("form");
dlform.style = "display:none;";
dlform.method = options.method;
dlform.action = options.url;
// dlform.target = "_blank"; actionloading
let token = document.createElement("input");
token.type = "hidden";
token.name = "x-access-token";
token.value = tool.getSession("TKid");
dlform.appendChild(token);
for(let index in options.data){
let hdnFilePath = document.createElement("input");
hdnFilePath.type = "hidden";
hdnFilePath.name = index;
hdnFilePath.value = options.data[index];
dlform.appendChild(hdnFilePath);
}
document.body.appendChild(dlform);
dlform.submit();
document.body.removeChild(dlform);
resolve("")
})
}