Basf_FCL/FCL/FineUIPro.Web/res/ProcessBar.js

65 lines
1.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 获取id为box的元素
//初始化y此值只可以放在方法外部若放到方法内部的话那方法的每一次执行都是从宽度为0开始从而使得进度条会一直停留在第一次执行方法的位置。
//定义parse()方法
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.WindowExport.hide();
}
});
}, 1000);
}
function showProcessBar() {
F.ui.WindowExport.show();
parse(0);
var begin = setInterval(function () {
PageMethods.getPercent(function (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 = "";
//]]>
}