global.js 1.53 KB

$.ajaxSetup({
	type: "POST",
	complete : function(XMLHttpRequest, textStatus) {
		var status = XMLHttpRequest.status;
		if (status == 200) {
			return;
		}
		if (status == 900) {
			//数据库超时
			$.messageAlert("错误", "查询超时了");
		} else if (status == 901) {
			//session超时
			var dialog = $("<div>").appendTo($("body"));
			dialog.dialog({
				backdrop : "static",
				title : "错误",
				content : "登录超时了!",
				buttons : [{
					text : "重新登录",
					className : "btn-danger",
					onclick : function() {
						window.location.href = contextPath + "/";
					}
				}]
			});
		} else {
			$.messageAlert("错误", "操作失败");
		}
	}
});



//操作符
var opMap = {
	"=" : "等于",
	">" : "大于",
	"<" : "小于",
	">=" : "大于等于",
	"<=" : "小于等于",
	"<>" : "不等于",
	"prefix" : "前缀匹配",
	"postfix" : "后缀匹配",
	"contain" : "包含",
	"not_contain" : "不包含"
};
//全局的panel的样式
var panelStyle = "panel-primary";

//全局的按钮的样式
var btnStyle = "btn-primary";


//全局用来html传递参数使用
var paramObj = {};

/**
 * html中传递参数,获取方法
 * @param key
 * @returns
 */
function getQueryStr(key){
    var svalue = window.location.search.match(new RegExp("[\?\&]" + key + "=([^\&]*)(\&?)","i"));
    var str = svalue ? svalue[1] : svalue;
    return str == null ? "" : str;
}

//通用的LoadFilter
function defaultLoadFilter(data) {
	if (!data || data.code != 200) {
		return [];
	}
	return data.data;
}

var submitFileParamObj = {};