修改导出遮罩层显示时间:处理完成时关闭

This commit is contained in:
wangwei
2019-04-22 18:39:30 +08:00
parent 77716a9517
commit 8719ed0527
3 changed files with 313 additions and 258 deletions

View File

@@ -348,262 +348,290 @@ function cancelPassOpt(url){
}
}
}
function doAll(checkboxes,url){
// var url = $(this).attr('data-url');
var str="";
var compileIdStr="";
var ids="";
var compileIds="";
var flag=false;//是否删除的为但是响应策略的无策略配置
checkboxes.each(function(){
if(true == $(this).is(':checked')){
var id=$(this).attr("id");
var serviceId=$(this).attr("id");
if($(this).attr("serviceId")){
serviceId=$(this).attr("serviceId");
}
if(serviceId == 65 && id==0){
flag=true;
}
str+=$(this).attr("id")+",";
if($(this).attr("compileId")){
compileIdStr +=$(this).attr("compileId")+",";
}
}
});
if(flag && url.indexOf("?isAudit=3") > 1){
top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
return;
}
if(str.substr(str.length-1)== ','){
ids = str.substr(0,str.length-1);
}
if(compileIdStr.substr(compileIdStr.length-1)== ','){
compileIds = compileIdStr.substr(0,compileIdStr.length-1);
}
if(ids == ""){
//top.$.jBox.tip("不能选择公共模型("+nodes[i].name+")请重新选择。");
top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
return;
}
if((url.indexOf("?isAudit=3") > 1)){
// 审核中区分是否有添加取消来函
var requestName=$("#ifCancelRequestInfo").attr("requestName");
var indexTable=$("#ifCancelRequestInfo").attr("indexTable");
// 有来函业务的取消审核
if(requestName!=null&&indexTable!=null&&requestName.indexOf("null")==-1&&indexTable.indexOf("null")==-1){
/****************取消审核时增加来函************************** */
$.jBox.open("iframe:${ctx}/cfg/request/requestSelectInfo", "<spring:message code='cancel_approved'/>",500, 400, { buttons: { '<spring:message code="ok"/>': 1, '<spring:message code="cancel"/>': 0 },
submit: function (v, h, f) {
if (v == 0) {
return true; // close the window
} else {
h.find('.errorBlock').hide('fast', function () { $(this).remove(); });
var cancelRequestId = h.find("iframe")[0].contentWindow.requestIsAudit.value;
if (!cancelRequestId) {
$('<div class="errorBlock" style="display: none;font-size:18px;color:red;text-align:center;margin-top:10px"><spring:message code="required"/></div>').prependTo(h).show('fast');
return false;
}
if(url.indexOf("?")>0){
$.ajax({
type:'post',
url:'${ctx}/basics/serviceDictInfo/requestCancleInfoAjax',
data:{"cancelRequestId":cancelRequestId,"ids":ids,"indexTable":indexTable},
async:false,
success:function(data,textStatus){//处理返回结果
window.location = url+"&ids="+ids+"&compileIds="+compileIds;
}
});
}else{
window.location = url+"?ids="+ids+"&compileIds="+compileIds;
}
if(url.indexOf("?isAudit") > 1){
loading('<spring:message code="onloading"/>');
}else if(url.indexOf("export") > 1){
closeTip();
}
}
return true;
},
loaded:function(h){
$(".jbox-content,top.document").css("overflow-y","hidden")
$(".jbox-content,top.document.children").css("clear","both")
$(".jbox-content,top.document.children").css("z-index","999999")
$(".jbox-content,top.document.children").css("overflow;","auto")
$(".jbox-content,top.document").css("width","90%")
}
});
/****************************************** */
}else{
// 无来函选项的取消审核操作
top.$.jBox.confirm("<spring:message code='confirm_message'/>","<spring:message code='info'/>",function(v,h,f){
if(v=="ok"){
if(url.indexOf("?")>0){
window.location = url+"&ids="+ids+"&compileIds="+compileIds;
}else{
window.location = url+"?ids="+ids+"&compileIds="+compileIds;
}
function doAll(checkboxes,url){
// var url = $(this).attr('data-url');
var str="";
var compileIdStr="";
var ids="";
var compileIds="";
var flag=false;//是否删除的为但是响应策略的无策略配置
checkboxes.each(function(){
if(true == $(this).is(':checked')){
var id=$(this).attr("id");
var serviceId=$(this).attr("id");
if($(this).attr("serviceId")){
serviceId=$(this).attr("serviceId");
}
if(serviceId == 65 && id==0){
flag=true;
}
str+=$(this).attr("id")+",";
if($(this).attr("compileId")){
compileIdStr +=$(this).attr("compileId")+",";
}
}
});
if(flag && url.indexOf("?isAudit=3") > 1){
top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
return;
}
if(str.substr(str.length-1)== ','){
ids = str.substr(0,str.length-1);
}
if(compileIdStr.substr(compileIdStr.length-1)== ','){
compileIds = compileIdStr.substr(0,compileIdStr.length-1);
}
if(ids == ""){
//top.$.jBox.tip("不能选择公共模型("+nodes[i].name+")请重新选择。");
top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
return;
}
if((url.indexOf("?isAudit=3") > 1)){
// 审核中区分是否有添加取消来函
var requestName=$("#ifCancelRequestInfo").attr("requestName");
var indexTable=$("#ifCancelRequestInfo").attr("indexTable");
// 有来函业务的取消审核
if(requestName!=null&&indexTable!=null&&requestName.indexOf("null")==-1&&indexTable.indexOf("null")==-1){
/****************取消审核时增加来函************************** */
$.jBox.open("iframe:${ctx}/cfg/request/requestSelectInfo", "<spring:message code='cancel_approved'/>",500, 400, { buttons: { '<spring:message code="ok"/>': 1, '<spring:message code="cancel"/>': 0 },
submit: function (v, h, f) {
if (v == 0) {
return true; // close the window
} else {
h.find('.errorBlock').hide('fast', function () { $(this).remove(); });
var cancelRequestId = h.find("iframe")[0].contentWindow.requestIsAudit.value;
if (!cancelRequestId) {
$('<div class="errorBlock" style="display: none;font-size:18px;color:red;text-align:center;margin-top:10px"><spring:message code="required"/></div>').prependTo(h).show('fast');
return false;
}
if(url.indexOf("?")>0){
$.ajax({
type:'post',
url:'${ctx}/basics/serviceDictInfo/requestCancleInfoAjax',
data:{"cancelRequestId":cancelRequestId,"ids":ids,"indexTable":indexTable},
async:false,
success:function(data,textStatus){//处理返回结果
window.location = url+"&ids="+ids+"&compileIds="+compileIds;
}
});
}else{
window.location = url+"?ids="+ids+"&compileIds="+compileIds;
}
if(url.indexOf("?isAudit") > 1){
loading('<spring:message code="onloading"/>');
}else if(url.indexOf("export") > 1){
closeTip();
closeTip();
}
//$("#searchForm").submit();
}
},{buttonsFocus:1});
top.$('.jbox-body .jbox-icon').css('top','55px');
}
//除取消审核之外的业务
}else{
top.$.jBox.confirm("<spring:message code='confirm_message'/>","<spring:message code='info'/>",function(v,h,f){
if(v=="ok"){
if(url.indexOf("?")>0){
window.location = url+"&ids="+ids+"&compileIds="+compileIds;
}else{
window.location = url+"?ids="+ids+"&compileIds="+compileIds;
}
if(url.indexOf("?isAudit") > 1){
loading('<spring:message code="onloading"/>');
}else if(url.indexOf("export") > 1){
closeTip();
}
//$("#searchForm").submit();
}
},{buttonsFocus:1});
top.$('.jbox-body .jbox-icon').css('top','55px');
}
}
//验证选择的配置,是否可删除或者审核未通过或者审核通过,只有未审核的配置可删除或审核未通过或审核通过
function validateAllNoAudit(checkboxes){
var flag = false;
$(checkboxes).filter(":checked").each(function(){
//alert($(this).val());
if($(this).val()!=0){
flag = true;
return;
}
});
return flag;
}
//验证是否可删除
function validateIsDelete(checkboxes){
var flag = false;
$(checkboxes).filter(":checked").each(function(){
//alert($(this).val());
if($(this).val()!=0 && $(this).val()!=3){//状态为3的配置为取消审核的配置可删除
flag = true;
return;
}
});
return flag;
}
//验证选择的配置,是否有审核通过的
function validatePass(checkboxes){
var flag = false;
$(checkboxes).filter(":checked").each(function(){
if($(this).val()==1){
flag = true;
return;
}
});
return flag;
}
//验证选择的配置,是否全部为审核通过的
function validateAllPass(checkboxes){
var flag = true;
$(checkboxes).filter(":checked").each(function(){
if($(this).val()!=1){
flag = false;
return;
}
});
return flag;
}
function validateIsScheduler(checkboxes){
var flag = false;
$(checkboxes).filter(":checked").each(function(){
var schedulerFlag = $(this).parent().parent().find(".schedulerFlag").find("span").attr("isScheduler");
if(schedulerFlag!= "undefined" && schedulerFlag=="yes"){
flag = true;
return;
}
});
return flag;
}
//导出
function exportData(url,maxRow,searchUrl,exType){
var column=[];
var hColumn=[]; //隐藏列名
$("#${id} ${value} thead tr th").each(function(){
if($(this).is(":visible")){
column.push($(this).text().trim());
}else{
hColumn.push($(this).attr("column"));
}
});
if($("#exportType").val() != null && $("#exportType").val() != ""){
if($("#exportValue").val() != null && $("#exportValue").val() != ""){
url+="&"+$("#exportType").val()+"="+$("#exportValue").val();
}
}
if(column.toString()!="" && column.toString() =="<spring:message code='log'/>"){
top.$.jBox.tip("<spring:message code='all_columns_hidden'/>", "<spring:message code='info'/>");
return;
}
if(column.toString()!=""){
url+="&columns="+column.toString();
}else{
top.$.jBox.tip("<spring:message code='all_columns_hidden'/>", "<spring:message code='info'/>");
return;
}
if(hColumn.toString()!=""){
url+="&hColumns="+hColumn.toString();
}
var checkboxes=$("#${id} ${value} tbody tr td input.i-checks:checkbox");
//导出选中数据
if($(checkboxes).filter(":checked").length>0){
doAll(checkboxes,url);
//导出检索条件下所有数据
}else{
var totalCount = $("#showTotalCount").html() == undefined ? '' : $("#showTotalCount").html().trim();
if (exType!='log') {
if(totalCount > maxRow){
top.$.jBox.confirm("<spring:message code='export_confirm_message'/>"+maxRow+"!","<spring:message code='info'/>",function(v,h,f){
if(v=="ok"){
$("#searchForm").attr("action",url);
$("#searchForm").submit();
closeTip();
$("#searchForm").attr("action",searchUrl);
}
},{buttonsFocus:1});
top.$('.jbox-body .jbox-icon').css('top','55px');
}else{
$("#searchForm").attr("action",url);
$("#searchForm").submit();
closeTip();
$("#searchForm").attr("action",searchUrl);
}
}else{
$("#searchForm").attr("action",url);
$("#searchForm").submit();
closeTip();
$("#searchForm").attr("action",searchUrl);
}
}
}
}
return true;
},
loaded:function(h){
$(".jbox-content,top.document").css("overflow-y","hidden")
$(".jbox-content,top.document.children").css("clear","both")
$(".jbox-content,top.document.children").css("z-index","999999")
$(".jbox-content,top.document.children").css("overflow;","auto")
$(".jbox-content,top.document").css("width","90%")
}
});
/****************************************** */
}else{
// 无来函选项的取消审核操作
top.$.jBox.confirm("<spring:message code='confirm_message'/>","<spring:message code='info'/>",function(v,h,f){
if(v=="ok"){
if(url.indexOf("?")>0){
window.location = url+"&ids="+ids+"&compileIds="+compileIds;
}else{
window.location = url+"?ids="+ids+"&compileIds="+compileIds;
}
if(url.indexOf("?isAudit") > 1){
loading('<spring:message code="onloading"/>');
}else if(url.indexOf("export") > 1){
closeTip();
}
//$("#searchForm").submit();
}
},{buttonsFocus:1});
top.$('.jbox-body .jbox-icon').css('top','55px');
}
alert("333");
//除取消审核之外的业务
}else{
top.$.jBox.confirm("<spring:message code='confirm_message'/>","<spring:message code='info'/>",function(v,h,f){
if(v=="ok"){
if(url.indexOf("?")>0){
//window.location = url+"&ids="+ids+"&compileIds="+compileIds;
url = url+"&ids="+ids+"&compileIds="+compileIds;
exportXmlRequest(url);
}else{
window.location = url+"?ids="+ids+"&compileIds="+compileIds;
}
if(url.indexOf("?isAudit") > 1){
loading('<spring:message code="onloading"/>');
}else if(url.indexOf("export") > 1){
closeTip();
}
//$("#searchForm").submit();
}
},{buttonsFocus:0});
top.$('.jbox-body .jbox-icon').css('top','55px');
}
}
//验证选择的配置,是否可删除或者审核未通过或者审核通过,只有未审核的配置可删除或审核未通过或审核通过
function validateAllNoAudit(checkboxes){
var flag = false;
$(checkboxes).filter(":checked").each(function(){
//alert($(this).val());
if($(this).val()!=0){
flag = true;
return;
}
});
return flag;
}
//验证是否可删除
function validateIsDelete(checkboxes){
var flag = false;
$(checkboxes).filter(":checked").each(function(){
//alert($(this).val());
if($(this).val()!=0 && $(this).val()!=3){//状态为3的配置为取消审核的配置可删除
flag = true;
return;
}
});
return flag;
}
//验证选择的配置,是否有审核通过的
function validatePass(checkboxes){
var flag = false;
$(checkboxes).filter(":checked").each(function(){
if($(this).val()==1){
flag = true;
return;
}
});
return flag;
}
//验证选择的配置,是否全部为审核通过的
function validateAllPass(checkboxes){
var flag = true;
$(checkboxes).filter(":checked").each(function(){
if($(this).val()!=1){
flag = false;
return;
}
});
return flag;
}
function validateIsScheduler(checkboxes){
var flag = false;
$(checkboxes).filter(":checked").each(function(){
var schedulerFlag = $(this).parent().parent().find(".schedulerFlag").find("span").attr("isScheduler");
if(schedulerFlag!= "undefined" && schedulerFlag=="yes"){
flag = true;
return;
}
});
return flag;
}
//导出
function exportData(url,maxRow,searchUrl,exType){
var column=[];
var hColumn=[]; //隐藏列名
$("#${id} ${value} thead tr th").each(function(){
if($(this).is(":visible")){
column.push($(this).text().trim());
}else{
hColumn.push($(this).attr("column"));
}
});
if($("#exportType").val() != null && $("#exportType").val() != ""){
if($("#exportValue").val() != null && $("#exportValue").val() != ""){
url+="&"+$("#exportType").val()+"="+$("#exportValue").val();
}
}
if(column.toString()!="" && column.toString() =="<spring:message code='log'/>"){
top.$.jBox.tip("<spring:message code='all_columns_hidden'/>", "<spring:message code='info'/>");
alert("第一个return");
return;
}
if(column.toString()!=""){
url+="&columns="+column.toString();
}else{
top.$.jBox.tip("<spring:message code='all_columns_hidden'/>", "<spring:message code='info'/>");
alert("第二个return");
return;
}
if(hColumn.toString()!=""){
url+="&hColumns="+hColumn.toString();
}
var checkboxes=$("#${id} ${value} tbody tr td input.i-checks:checkbox");
//导出选中数据
if($(checkboxes).filter(":checked").length>0){
doAll(checkboxes,url);
alert("doAll");
//导出检索条件下所有数据
}else{
var totalCount = $("#showTotalCount").html() == undefined ? '' : $("#showTotalCount").html().trim();
if (exType!='log') {
if(totalCount > maxRow){
top.$.jBox.confirm("<spring:message code='export_confirm_message'/>"+maxRow+"!","<spring:message code='info'/>",function(v,h,f){
if(v=="ok"){
if($("#intype").val() != null && $("#intype").val() != ""){
$("#intype").attr("name",$("#seltype").val());
}
exportXmlRequest(url);
}
},{buttonsFocus:1});
top.$('.jbox-body .jbox-icon').css('top','55px');
}else{
if($("#intype").val() != null && $("#intype").val() != ""){
$("#intype").attr("name",$("#seltype").val());
}
exportXmlRequest(url);
}
}else{
exportXmlRequest(url);
}
}
}
function exportXmlRequest(url){
loading('onloading');
url+="&"+$('#searchForm').serialize();
var xmlResquest = new XMLHttpRequest();
xmlResquest.open("POST", url, true);
xmlResquest.setRequestHeader("Content-type", "application/json");
xmlResquest.responseType = "blob";
xmlResquest.onload = function (oEvent) {
var contDisp = xmlResquest.getResponseHeader("content-disposition");
var fileName = contDisp.substring(contDisp.indexOf("=")+1,contDisp.length).replace(/\"/g,"");
var content = xmlResquest.response;
var elink = document.createElement('a');
elink.download = fileName;
elink.style.display = 'none';
var blob = new Blob([content]);
elink.href = URL.createObjectURL(blob);
document.body.appendChild(elink);
elink.click();
document.body.removeChild(elink);
};
xmlResquest.onreadystatechange = function() {
if (xmlResquest.readyState==4) {
top.$.jBox.closeTip();
}
}
xmlResquest.send();
}
</script>

View File

@@ -543,7 +543,7 @@ function customColumnClick(){
var exports=JSON.stringify(map);
aJaxImportPost(url,{"exports":exports});
pagination(30);
closeTip();
//closeTip();
}

View File

@@ -114,9 +114,11 @@ Date.prototype.Format = function (fmt) {
return fmt;
}
function aJaxImportPost(url, params) {
function aJaxImportPost(url, params) {
top.$.jBox.tip("onloading",'loading',{opacity:0.5,persistent:true});
// 创建form元素
var temp_form = document.createElement("form");
temp_form.id = "temp_form";
// 设置form属性
temp_form .action = url;
temp_form .target = "_self";
@@ -129,7 +131,32 @@ function aJaxImportPost(url, params) {
opt.value = params[x];
temp_form .appendChild(opt);
}
document.body.appendChild(temp_form);
// 提交表单
temp_form .submit();
document.body.appendChild(temp_form);
url=url+"?";
url+="&"+$('#temp_form').serialize();
var xmlResquest = new XMLHttpRequest();
xmlResquest.open("POST", url, true);
xmlResquest.setRequestHeader("Content-type", "application/json");
xmlResquest.setRequestHeader("Content-Disposition","attachment");
xmlResquest.responseType = "blob";
xmlResquest.onload = function (oEvent) {
var contDisp = xmlResquest.getResponseHeader("content-disposition")
var fileName = contDisp.substring(contDisp.indexOf("=")+1,contDisp.length).replace(/\"/g,"")
var content = xmlResquest.response;
var elink = document.createElement('a');
elink.download = fileName;
elink.style.display = 'none';
var blob = new Blob([content]);
elink.href = URL.createObjectURL(blob);
document.body.appendChild(elink);
elink.click();
document.body.removeChild(elink);
};
xmlResquest.onreadystatechange = function() {
if (xmlResquest.readyState==4) {
top.$.jBox.closeTip();
}
};
xmlResquest.send();
}