function deleteCase(){
	var claimNo = $("#claimNo").val();
	var reason = $("#reason").val();
	if(claimNo.trim()==""){
		alert("请输入赔案号！");
		return false;
	}
	if(reason.trim()==""){
		alert("请输入删除案件原因！");
		return false;
	}
	var url = location.href;
	var basePath = url.split("/")[3];
	if (confirm("删除后不可恢复！是否确认删除该赔案？ ")){
		$.ajax({
			cache:false,
			type :"POST",
			url  :"/"+basePath+"/claim/lifeinsurance/deletecase.do",
			data :{"claimNo":claimNo,"reason":reason},
			async:false,
			error:function(){
				alert("错误");
			},
			success:function(data){
				alert("成功");
			}
		});
	}
}
function revokeCase(){
	var claimNo = $("#claimNo").val();
	var reason = $("#reason").val();
	var trackFlag = $("#tracked input[name='track']:checked").val();
	if(claimNo.trim()==""){
		alert("请输入赔案号！");
		return false;
	}
	if(reason.trim()==""){
		alert("请输入撤销案件原因！");
		return false;
	}
	var url = location.href;
	var basePath = url.split("/")[3];
	if (confirm("是否确认撤销该赔案？ ")){
		$.ajax({
			cache:false,
			type :"POST",
			url  :"/"+basePath+"/claim/lifeinsurance/revokecase.do",
			data :{"claimNo":claimNo,"reason":reason,"trackFlag":trackFlag},
			async:false,
			error:function(){
				alert("错误");
			},
			success:function(data){
				if(data=="01"){
					alert("撤案成功！");
				}else{
					alert("没有查到该赔案任务！");
				}
			}
		});
	}
}
function noCareCase(){
	var claimNo = $("#claimNo").val();
	var reason = $("#reason").val();
	var trackFlag = $("#tracked input[name='track']:checked").val();
	if(claimNo.trim()==""){
		alert("请输入赔案号！");
		return false;
	}
	if(reason.trim()==""){
		alert("请输入不受理案件原因！");
		return false;
	}
	var url = location.href;
	var basePath = url.split("/")[3];
	if (confirm("不受理案件后不可恢复！是否确认不受理该赔案？ ")){
		$.ajax({
			cache:false,
			type :"POST",
			url  :"/"+basePath+"/claim/lifeinsurance/nocarecase.do",
			data :{"claimNo":claimNo,"reason":reason,"trackFlag":trackFlag},
			async:false,
			error:function(){
				alert("错误");
			},
			success:function(data){
				if(data=="01"){
					alert("不予受理案件成功！");
				}else{
					alert("没有查到该赔案任务！");
				}
			}
		});
	}
}
function modifyDate(flag){
	var policyNo = $("#policyNo").val();
	var certificateNo = $("#certificateNo").val();
	var cappNo = $("#cappNo").val();
	var beginDate =$("#beginDate").val();
	var endDate = $("#endDate").val();
	if(policyNo.trim()=="" || policyNo== null || certificateNo.trim()=="" || certificateNo== null || beginDate.trim()=="" || beginDate== null || endDate.trim()=="" || endDate== null ){
		alert("保单号、证件号码、生效日期、结束日期均不能为空！");
		return;
	}
	if(flag==2 && (cappNo=="" || cappNo== null)){
		alert("产险保单号不能为空！");
		return;
	}
	var url = location.href;
	var basePath = url.split("/")[3];
	$.ajax({
		cache:false,
		type :"POST",
		url  :"/"+basePath+"/claim/lifeinsurance/modifydate.do",
		data :{"policyNo":policyNo,"certificateNo":certificateNo,"cappNo":cappNo,"beginDate":beginDate,"endDate":endDate,"flag":flag},
		async:false,
		error:function(){
			alert("错误");
		},
		success:function(data){
			if(data==0){
				alert("没有查到保单！");
			}else{
				alert("有"+data+"条数据被修改");
			}
		}
	});
}
function queryClaimState(){
	var claimNo = $("#claim_Pl_No").val();
	var url = location.href;
	var basePath = url.split("/")[3];
	$.ajax({
		cache:false,
		type :"POST",
		url  :"/"+basePath+"/claim/lifeinsurance/queryclmtaskstate.do",
		data :{"claimNo":claimNo},
		async:false,
		error:function(){
			alert("错误");
		},
		success:function(data){
			 $("#claimstatus").val(data.claimState);
			 $("#clmSubState").val(data.claimSubState);
		}
	});
}
function saveClaimState(){
	var claimNo = $("#claim_Pl_No").val();
	var claimstatus = $("#claimstatus option:selected").val();
	var clmSubState = $("#clmSubState option:selected").val();
	var url = location.href;
	var basePath = url.split("/")[3];
	$.ajax({
		cache:false,
		type :"POST",
		url  :"/"+basePath+"/claim/lifeinsurance/saveclmtaskstate.do",
		data :{"claimNo":claimNo,"claimstatus":claimstatus,"clmSubState":clmSubState},
		async:false,
		error:function(){
			alert("错误");
		},
		success:function(data){
			alert("修改成功");
		}
	});
}



function queryXAYClaimState(){
	var claimNo = $("#claim_XAY_No").val();
	var url = location.href;
	var basePath = url.split("/")[3];
	$.ajax({
		cache:false,
		type :"POST",
		url  :"/"+basePath+"/claim/lifeinsurance/queryXAYClaimState.do",
		data :{"claimNo":claimNo},
		async:false,
		error:function(){
			alert("错误");
		},
		success:function(data){
			$("#XAY_AUTOstatus").val(data.XAY_AUTOstatus);
			$("#XAY_AUTOcode").val(data.XAY_AUTOcode);
			$("#XAY_AUTOclaimstate").val(data.XAY_AUTOclaimstate);
			$("#XAY_AUTOclaimsubstate").val(data.XAY_AUTOclaimsubstate);
			$("#XAY_AUTOclaimtype").val(data.XAY_AUTOclaimtype);
			$("#XAY_AUTOdesc").val(data.XAY_AUTOdesc);
		}
	});
}

function saveXAYClaimState(){
	var claimNo = $("#claim_XAY_No").val();
	var claimstatus = $("#XAY_AUTOstatus option:selected").val();
	var clmState = $("#XAY_AUTOclaimstate option:selected").val();
	var clmSubState = $("#XAY_AUTOclaimsubstate option:selected").val();
	var clmType = $("#XAY_AUTOclaimtype option:selected").val();
	var XAY_AUTOcode = $("#XAY_AUTOcode").val();
	var XAY_AUTOdesc = $("#XAY_AUTOdesc").val();
	var url = location.href;
	var basePath = url.split("/")[3];
	$.ajax({
		cache:false,
		type :"POST",
		url  :"/"+basePath+"/claim/lifeinsurance/saveXAYClaimState.do",
		data :{"claimNo":claimNo,
			"claimstatus":claimstatus,
			"clmSubState":clmSubState,
			"clmState":clmState,
			"clmType":clmType,
			"XAY_AUTOcode":XAY_AUTOcode,
			"XAY_AUTOdesc":XAY_AUTOdesc
		},
		async:false,
		error:function(){
			alert("错误");
		},
		success:function(data){
			alert("修改成功");
		}
	});
}