ChengDa_English/SGGL/FineUIPro.Web/res/ProgressBarIn.js

71 lines
1.7 KiB
JavaScript
Raw Normal View History

2022-03-15 17:36:38 +08:00

function parse(y) {
var box = document.getElementById("box");
//获取进度条div的宽度
var x = box.style.width;
x = parseInt(x) + 1;
y = y + 1;
//将y值加上百分号赋值给box的宽度。这样每次+1就可以实现进度条占父容器的100%;
box.style.width = y + "%";
//将y值加上百分号并赋值给显示下载百分比的div上
document.getElementById("box").innerHTML = y + "%";
//判断当y已经100的时候也就是进度条的宽度和父容器的宽度一致的时候停止。
if (y >= 100) {
document.getElementById("box").innerHTML = "100%";
}
}
function downFile() {
var begin = setInterval(function () {
PageMethods.getUrl(function (res) {
if (res != "") {
window.open("../" + res);
clearInterval(begin);
F.ui.Window1.hide();
}
});
}, 1000);
}
function printX() {
parse(0);
var begin = setInterval(function () {
PageMethods.getPercent(function (result) {
console.log(result);
parse(result);
if (result >= 100) {
downFile();
clearInterval(begin);
}
});
}, 1000);
y = 0;
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
// theForm.__EVENTTARGET.value = 'RegionPanel1$Region1$Form2$Toolbar1$btnPrint';
theForm.target = "_blank";
//theForm.submit();
theForm.target = "";
//]]>
}
var laterOnSecond = setInterval(function () {
PageMethods.getPercent(function (result) {
printX();
clearInterval(laterOnSecond);
});
}, 1000);