/**页面跳转，params为json格式, 使用方法：如果没有参数，params 直接用{}代替，*/
function SkipByPost(url, params){
	//showLoading();//加载进度条
	var divElem = document.createElement("div");
	$(divElem).css("display", "none");

	var form = document.createElement("form");

	form.method = "post";
	form.action = url;
 
	for ( var p in params) {
		var input = document.createElement("input");
		$(input).attr("name", p);
		$(input).attr("value", params[p]);
		form.appendChild(input);
	}

	$(divElem).append($(form));
	$("body").append($(divElem));
 
	form.submit();
};
/**获取项目的域名及上下文*/
function getRootPath(){
	var host = window.location.host;
	var strPath=window.document.location.pathname;
	var context = strPath.substring(0, strPath.substr(1).indexOf('/') + 1);
	return "http://"+host+context;
}
/**将form转换为json对象，参数：form的ID*/
function getFormJson(id){
	 var o = {};    
	   var a = $('#'+id).serializeArray();    
	   $.each(a, function() {    
	       if (o[this.name]) {    
	           if (!o[this.name].push) {    
	               o[this.name] = [o[this.name]];    
	           }    
	           o[this.name].push(this.value || '');    
	       } else {    
	           o[this.name] = this.value || '';    
	       }    
	   });
	   return o;
}

/**页面跳转，params为json格式, 使用方法：如果没有参数，params 直接用{}代替，*/
function openNewByPost(url, params){
	//showLoading();//加载进度条
	var divElem = document.createElement("div");
	$(divElem).css("display", "none");

	var form = document.createElement("form");

	form.method = "post";
	form.action = url;
	form.target="_blank";
 
	for ( var p in params) {
		var input = document.createElement("input");
		$(input).attr("name", p);
		$(input).attr("value", params[p]);
		form.appendChild(input);
	}

	$(divElem).append($(form));
	$("body").append($(divElem));
 
	form.submit();
};




function enterAdjustment(inputUrl,claimNos){
	var params = {};
	params["claimNo"] = claimNos;
	
	//AJAX提交
	 $.ajax({
		 type:"POST",
		 url: inputUrl,
		 dataType:"json",
		 contentType:"application/json",
		 data:JSON.stringify(params),	
		 error:function(){
			alert("理算详情页面展示失败！");
			 return;
		 },
		 success:function(data){
			 if (data.successFlag == 'Y') {
				var skipFlag = data.skipFlag;//1跳理算页面
				
				if (skipFlag == '1') {
					var claimNo = data.claimNo;
					var claimAuditTaskNo = data.claimAuditTaskNo;
					var claimState = data.claimState;
					var claimSource = data.claimSource;
					var taskType = data.taskType;
					var customerno = data.customerno;
					var regDate = data.regDate;
					
					params = {};
					params["claimNo"] = claimNo;
					params["claimAuditTaskNo"] = claimAuditTaskNo;
					params["claimState"] = claimState;
					params["claimSource"] = claimSource;
					params["taskType"] = taskType;
					params["customerno"] = customerno;
					params["regDate"] = regDate;
					
					//判断是否寿组合贴牌
					var lifeClaimStatus = $("#lifeClaimStatus").val();
					var caseSource = $("#caseSource").val();
					var lifeFLag = $("#lifeFLag").val();
					if(caseSource=='2'&&lifeFLag=='1'){
						params["lifeClaimStatus"] = lifeClaimStatus;
					}else{
						params["lifeClaimStatus"] = '0';
					}
					
					SkipByPost("../adjustment/adjustmentInfo.do", params);
				}
			 } 
		 }
	 });
}