$(document).ready(function(){
	$("#cusSearch").click(function(){
		
		cusquery();
	}); 
	$("#queryMyTask").click(function(){
		queryMyTask();
	});
	
}); 
function submitPageForm(rightOrleft){
	 if(rightOrleft=="right"){
		 if(parseInt($("#page").val())+1==parseInt($("#totalPages").val())){
			 return;
		 }
		 $("#page").val(parseInt($("#page").val())+1);
	 }
	 else {
		 if(parseInt($("#page").val())==0){
			 return;
		 }
		 $("#page").val(parseInt($("#page").val())-1);
	 }
	 $("#taskListForm").submit();
		
}
 
 function cusquery(){
	 if($("#keyWord").val().length!=10&&$("#keyWord").val().length!=8&&$("#keyWord").val().length!=15){
		 alert("录入格式错误，请输入15位赔案号或者8位和10位日期(20140101/2014-01-01)");
		 return;
	 }
	 
	 $("#taskListForm").attr("action","cusquery.do?type=0");
	 $("#taskListForm").submit();
 }
 function queryMyTask(){
	 $("#taskListForm").attr("action","queryMyTask.do");
	 $("#taskListForm").submit();
 }
 function dispatchClaimPage(claimNo){
	 $("#claimNo").val(claimNo);
	 $.ajax({
			type:"POST",
			url:"checkOperater.do",
			data:{"claimNo":claimNo},
			error :function(){
				alert("系统错误，请稍后再试。");
				return ;
			},
			success :function(data){
				if(data=="errMsg"){
					alert("当前数据录入任务已被其他操作员获取，获取失败。");
				}else{
					 $("#taskListForm").attr("action","dispatcherClmInfo.do");
					 $("#taskListForm").submit();
				}
			}
		});
 }
 function dispatchClaimPageAlert(){
	 window.alert("BPO正在进行数据录入！");
 }
//	查询赔案操作轨迹
	function queryClaimTrack(claimNo){
		$("#historyTrack").find("p").remove();
		$.ajax({
			type:"POST",
			url:"queryClaimTrack.do",
			data:{"claimNo":claimNo},
			error :function(){
				alert("查询赔案操作轨迹失败，请稍后再试！");
				return ;
			},
			success :function(data){
				$("#historyTrackClaim").text(claimNo+" 历史轨迹");
				if(data ==""){
					alert("查询赔案操作轨迹失败，请稍后再试！");
					return ;
				}
				for ( var i= 0; i < data.length; i++) {
					var t=data[i];
					var p=$("<p class=\"sild_open_his\"><span class=\"sild_open_his_icon\" style=\"width:20%;white-space:nowrap;\">" +t.operateType+"</span><span style=\"width:30%;white-space:nowrap;\">"+t.operateDate+
							"	</span><span style=\"width:30%;white-space:nowrap;\">"+t.operator+"</span></p>");
					$("#historyTrack").append(p);
				}
				showDiv('open1');
			}
		});
	}
	

//	时间显示工具
	function jsonDateFormat(date,length){
	    var datetime = new Date();
	    datetime.setTime(date);
	    var year = datetime.getFullYear();
	    var month = datetime.getMonth() + 1 < 10 ? "0" + (datetime.getMonth() + 1) : datetime.getMonth() + 1;
	    var date = datetime.getDate() < 10 ? "0" + datetime.getDate() : datetime.getDate();
	    var hour = datetime.getHours()< 10 ? "0" + datetime.getHours() : datetime.getHours();
	    var minute = datetime.getMinutes()< 10 ? "0" + datetime.getMinutes() : datetime.getMinutes();
	    var second = datetime.getSeconds()< 10 ? "0" + datetime.getSeconds() : datetime.getSeconds();
	    if(length==10){
	    	return year + "-" + month + "-" + date;
	    }else{
	    	return year + "-" + month + "-" + date+" "+hour+":"+minute+":"+second;
	    }
	}
	
	
	function setSortValue(sortValue){
		$("#sortValue").val(sortValue);
		$("#taskListForm").attr("action","showTask.do");
		$("#taskListForm").submit();
	}
	
	//数据清单导出(REQHOP1-161013-1399) txb，2017/2/16
	function ListExtraction(reportDateFrom) {
		var reportDateFrom = $("#reportDateFrom").val();
		if(reportDateFrom == "" || reportDateFrom == null){
			alert("录入时间为空");
		}else{
			SkipByPost("ExcelExportSJ.do",{reportDateFrom:reportDateFrom});
			closeDiv('open3');
		}
	}