Commit bf2ccaa3 authored by 熊海's avatar 熊海

修复页面导出loading状态

parent ea9a1e83
......@@ -61,6 +61,13 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
</div>
</div>
</div>
<div class="modal fade" id="loadingModal" backdrop="static" keyboard="false">
  <div style="width: 200px;height:20px; z-index: 20000; position: absolute; text-align: center; left: 50%; top: 50%;margin-left:-100px;margin-top:-10px">
    <div class="progress progress-striped active" style="margin-bottom: 0;background-color:rgba(0,0,0,0)">
    <img src="<%=request.getContextPath()%>/res/image/loading.gif"><span style="color: white">数据加载中,请稍候...</span>
</div>
  </div>
</div>
<!-- 全局js -->
<script
src="<%=request.getContextPath()%>/res/js/jquery.min.js?v=2.1.4"></script>
......
......@@ -90,6 +90,13 @@ String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.
</div>
</div>
</div>
<div class="modal fade" id="loadingModal" backdrop="static" keyboard="false">
  <div style="width: 200px;height:20px; z-index: 20000; position: absolute; text-align: center; left: 50%; top: 50%;margin-left:-100px;margin-top:-10px">
    <div class="progress progress-striped active" style="margin-bottom: 0;background-color:rgba(0,0,0,0)">
    <img src="<%=request.getContextPath()%>/res/image/loading.gif"><span style="color: white">数据加载中,请稍候...</span>
</div>
  </div>
</div>
<!-- 全局js -->
<script
src="<%=request.getContextPath()%>/res/js/jquery.min.js?v=2.1.4"></script>
......
......@@ -856,7 +856,7 @@ function synchronizeUpperAndLowerFormContents() {
text7.attr("disabled","disabled")
$("#guidingindicators7 #submit16").prepend(text7)
$("#guidingindicators7 table tr").each((index,element)=>{
if ($($(element).children()[12]).children().attr('title')=="否"||$($(element).children()[16]).children().attr('title')=="否") {
if (!($($(element).children()[12]).children().attr('title')=="否"&&$($(element).children()[16]).children().attr('title')=="否")) {
$(element).remove()
}
})
......
......@@ -117,7 +117,37 @@ function getAllTeam_show(teamid){
* @returns
*/
function project_DIV_Derive(){
downloadFile(webroot+"teamMessage/deriveTeamOFFLINE");
showLoading()
//downloadFile(webroot+"teamMessage/deriveTeamONLINE");
var url = webroot+"teamMessage/deriveTeamONLINE";
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true); // 也可以使用POST方式,根据接口
xhr.responseType = "blob"; // 返回类型blob
// 定义请求完成的处理函数,请求前也可以增加加载框/禁用下载按钮逻辑
xhr.onload = function () {
// 请求完成
if (this.status === 200) {
// 返回200
var blob = this.response;
var reader = new FileReader();
reader.readAsDataURL(blob); // 转换为base64,可以直接放入a表情href
reader.onload = function (e) {
// 转换完成,创建一个a标签用于下载
var a = document.createElement('a');
a.download = '团队详细.xls';
a.href = e.target.result;
$("body").append(a); // 修复firefox中无法触发click
a.click();
$(a).remove();
hideLoading()
}
}else {
hideLoading()
swal("失败!", '网络错误,稍后再试', "error");
}
};
// 发送ajax请求
xhr.send()
}
/**
* 下载文件
......@@ -131,4 +161,10 @@ function downloadFile(url){
$('body').append(downloadFrame);
}
downloadFrame.attr('src',url);
}
showLoading = function(){
$('#loadingModal').modal({backdrop: 'static', keyboard: false});
}
hideLoading = function(){
$('#loadingModal').modal('hide');
}
\ No newline at end of file
......@@ -162,4 +162,11 @@ function downloadFile(url){
$('body').append(downloadFrame);
}
downloadFrame.attr('src',url);
}
showLoading = function(){
$('#loadingModal').modal({backdrop: 'static', keyboard: false});
}
hideLoading = function(){
$('#loadingModal').modal('hide');
}
\ No newline at end of file
......@@ -165,7 +165,37 @@ function getAllTeam_STATE_no2()
* @returns
*/
function project_DIV_Derive(){
downloadFile(webroot+"teamMessage/deriveTeamOFFLINE");
showLoading()
//downloadFile(webroot+"teamMessage/deriveTeamONLINE");
var url = webroot+"teamMessage/deriveTeamONLINE";
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true); // 也可以使用POST方式,根据接口
xhr.responseType = "blob"; // 返回类型blob
// 定义请求完成的处理函数,请求前也可以增加加载框/禁用下载按钮逻辑
xhr.onload = function () {
// 请求完成
if (this.status === 200) {
// 返回200
var blob = this.response;
var reader = new FileReader();
reader.readAsDataURL(blob); // 转换为base64,可以直接放入a表情href
reader.onload = function (e) {
// 转换完成,创建一个a标签用于下载
var a = document.createElement('a');
a.download = '团队详细.xls';
a.href = e.target.result;
$("body").append(a); // 修复firefox中无法触发click
a.click();
$(a).remove();
hideLoading()
}
}else {
hideLoading()
swal("失败!", '网络错误,稍后再试', "error");
}
};
// 发送ajax请求
xhr.send()
}
/**
* 下载文件
......@@ -179,4 +209,10 @@ function downloadFile(url){
$('body').append(downloadFrame);
}
downloadFrame.attr('src',url);
}
showLoading = function(){
$('#loadingModal').modal({backdrop: 'static', keyboard: false});
}
hideLoading = function(){
$('#loadingModal').modal('hide');
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment