

//获取跟目录
function getRootPath(){
    return window.document.location.href.substring(
    		0,window.document.location.href.indexOf(
    		window.document.location.pathname));
}

//跟目录全局变量
var rootPath = getRootPath();
//当前目录前缀
var currPath = "/claimserver/management/pubAmount/";

//查询
function query(){
	$("#context").empty();
	var policyNo = $.trim($("#policyno").val());
	
		if(policyNo == "") {
			alert("请输入查询条件");
			return;
		};
	
	$("#policy-no").val(policyNo);
	
	$.ajax({
		type:"POST",
		url:rootPath+currPath+"queryCompensateDetails.do",
		data:{"policyNo":policyNo},
		async:true,
		error:function(){
			alert("查询出错！");
		},
		success:function(data){
			
			//团体保单信息
			$("#unitName").html(data.unitName);                       //投保单位名称
			$("#policyNo").html(data.policyNo);                    //团体保单号
			$("#insuranceDuration").html(data.insuranceDuration);          //保险期限
			$("#total").html(data.total);                   //公共保额总额度
			$("#surpTotal").html(data.surpTotal);              //公共保额剩余总额度
			$("#ordTotal").html(data.ordTotal);                 //公共保额普通总额度
			$("#surpOrdTotal").html(data.surpOrdTotal);                     //公共额度剩余普通总额度
			$("#specTotal").html(data.specTotal);                     //公共保额特殊总额度
			$("#surpSpecTotal").html(data.surpSpecTotal);                    //公共保额剩余特殊总额度
			
			//公共保额赔付信息
			var compList = data.compList;
			
			for ( var i = 0; i < compList.length; i++) {
				var comp = compList[i];
				
				if(comp.useDate!=""&&comp.useDate!=null){
				$("#context").append("<tr>" +
							"<td>"+comp.useDate+"</td>" +
							"<td><a style=\"color:#0000FF; cursor:pointer;\" title=\"打开赔案详情\" href=\""+rootPath+"/claimserver/claim/commonsearch/clmtaskdetailQuery.do?claimNo="+comp.claimNo+"&claimState="+comp.claimState+"&claimSubState="+comp.claimSubState+"&gohistory=close\" target=\"_blank\">"+comp.claimNo+"</a></td>" +
							"<td>"+comp.name+"</td>" +
							"<td>"+comp.pid+"</td>" +
							"<td>"+comp.authorizedNo+"</td>" +
							"<td>"+comp.authorizedType+"</td>" +
							"<td>"+comp.authorizedAmt+"</td>" +
							"<td>"+comp.authorizedBegdate+"</td>" +
							"<td>"+comp.authorizedStopdate+"</td>" +
							"<td>"+comp.useAmt+"</td>" +
						  "</tr>");
				}else{
					$("#context").append("<tr>" +
							"<td></td>" +
							"<td class=\"no-end-case\" title=\"未结案\">"+comp.claimNo+"</td>" +
							"<td>"+comp.name+"</td>" +
							"<td>"+comp.pid+"</td>" +
							"<td>"+comp.authorizedNo+"</td>" +
							"<td>"+comp.authorizedType+"</td>" +
							"<td>"+comp.authorizedAmt+"</td>" +
							"<td>"+comp.authorizedBegdate+"</td>" +
							"<td>"+comp.authorizedStopdate+"</td>" +
							"<td>"+comp.useAmt+"</td>" +
						  "</tr>");
			}
			
		}
		
		}
		
	});
}

//跳转赔案详情页面
//function daaaa(obj){
//	SkipByPost(rootPath+"/claimserver/claim/commonsearch/clmtaskdetailQuery.do",{claimNo:$(obj).html()});
//}