processBar.js 1.89 KB
function processBar(){
	this._index = null;
	this.showBar = function(){
		this._index = load(2, {time: 10*1000}); 
		/*$('#progress').attr('style','margin-bottom:0px;');*/
	}
	this.hideBar = function(){
		if(this._index)
			layer.close(this._index);
		else
			layer.closeAll('loading');
	}
	function load(icon,options){
//		 return layer.open($.extend({
//		      type: 3,
//		      icon: icon || 0,
//		      resize: false,
//		      shade: 0.05
//		    }, options));
		return layer.msg('加载中', {
			  icon: 16
			  ,time:10*1000
			  ,shade: 0.01
			});
	}
}


//日期加上天数后的新日期.
function AddDays(date,days,suptotaltime){
var nd = new Date(date);
  nd = nd.valueOf();
  if(days && days!=""){
	  nd = nd + days * 24 * 60 * 60 * 1000+suptotaltime * 1000;
  }
  nd = new Date(nd);
  //alert(nd.getFullYear() + "年" + (nd.getMonth() + 1) + "月" + nd.getDate() + "日");
var y = nd.getFullYear();
var m = nd.getMonth()+1;
var d = nd.getDate();
if(m <= 9) m = "0"+m;
if(d <= 9) d = "0"+d; 
var cdate = y+"-"+m+"-"+d;
return cdate;
}
/**
 * 从数据库查出总时限,并取消异步,返回到界面
 * @param flowrevisionid
 * @returns {String}
 */
function getTimelimit(flowrevisionid){
	var timelimit=0;
	//从数据库获取总时限(单位天数)
	if(flowrevisionid!=null&&flowrevisionid!=""){
		$.ajax({
			type : "post",
			url : global.contextPath + global.modelctls.flow.limitTime,
			data : "flowrevisionid=" + flowrevisionid,
			async : false,
			success : function(result) {
				timelimit = result;
			}
		});
	}
	return timelimit;
}
function getLastTaskOperation(instanceId){
	var operation = null;
	if(instanceId!=null&&instanceId!=""){
		$.ajax({
			type : "post",
			url : global.contextPath + global.modelctls.flowEngine.task.getLastTaskOperation,
			data : "instanceId=" + instanceId,
			async : false,
			success : function(result) {
				operation = result;
			}
		});
	}
	return operation;
}