<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/include/header2.jsp"%>
<title>疑案管理</title>
<style>
	.num {
		padding-left: 20px;
		
	}
	.num2{
		font-size: 16px;
		font-family: initial;
		color: #F4DBCC;
		font-weight: 700;
	}	
	.num b{
		color: #fff;
		font-size: 18px;
	}
	.num2 b{
		color: #e77e3b;
		font-size: 28px;
	}
	.taskType_title {
		margin-bottom: 10px;
		font-size: 16px;
	}
	table td{
		padding:5px;
	}
	input {
		height: 25px;
		border: 1px solid #ddd;
		padding: 0px 5px;
		border-radius: 3px;
	}
	input[type=checkbox], input[type=radio] {
	    vertical-align: middle;
	}
	.taskType_tabCon th{
		text-align: center;
	}
</style>
</head>
<body class="bg1">
	<div class="headCon">
		<jsp:include page="/WEB-INF/jsp/top2.jsp">
		<jsp:param name="index" value="疑案管理" />
		</jsp:include>
	</div>
	<div class="container_fluid">
		<!--左侧菜单-->
		<div class="searchCon left_menu managerLeft">
			<jsp:include page="/include/personalLeft.jsp">
				<jsp:param name="index" value="串案模型申请" />
			</jsp:include>
		</div>
		
		<!-- <div id="resultCon1" class="resultCon" style="margin-left: 255px;"> -->
		<div class="resultCon" style="margin-left: 255px;position:relative;">
		<div class="wrap">
			<div class="m_right">
				<div class="switch" id="switch"></div>
				<div class="p_bar">您当前的位置：任务申请</div>
			</div>
			<!--right end-->
		</div>
		<div style="overflow:hidden;margin-top:15px;">
			<!--左边，类型选择-->
			<div class="dealNum" style="float:left;width:30%;">	
				<p class="taskType_title">任务情况</p>		
				<div>
					<p class="num num2">申请数量上限/每天：<b>${total}</b>组</p>					
					<p class="num num2">当天已申请数量：<b>${applied}</b>组</p>
					<p class="num num2">当天可申请数量：<b>${rest}</b>组</p>
					<!--<p class="num num2">申请数量上线/每天：<b>100</b>条</p>				
					<p class="num finshTask">本月已完成任务：<b>0</b>条</p>
					<p class="num">目前剩余任务：<b>15</b>条-->
				</div>
			</div>
			<!--右边，类型选择-->
			<div class="taskType" style="float:rigth;">
				<p class="taskType_title">任务分配类型</p>
				<div class="taskType_tabCon" style="position:relative;" id="taskTypeTable">
					<table style="white-space:pre-line;border: 1px solid #6a8694;width:65%;" border="1">
						<tr style="height:30px">
							<th>模型</th>
							<th>详情</th>
						</tr>
						<tr>
							<td style="width:15%;text-align:center;"><input type="checkbox" name="mytype" class="taskCheckBox" data-id="1" min="0"><span>同地多案</span></td>
							<td class="white">同一“出险地点”多次报案，“出险时驾驶员”、“报案人”或“报案电话”、“牌照号码”、“估损单维修厂名称”均相同<input data-default="2" data-source="1" type="number" value="2" class="input_txt" style="width:60px;" min="0">次以上的案件清单；或“牌照号码”不同，但“出险时驾驶员”、“报案人”或“报案电话有一相同<input data-default="2" data-source="1" type="number" value="2" class="input_txt" style="width:60px;" min="0">次以上的案件</td>
						</tr>
						<tr>
							<td style="text-align:center;"><input type="checkbox" name="mytype" class="taskCheckBox" data-id="2"min="0"><span>同号多案</span></td>
							<td class="white">同一报案电话不同车辆报案<input data-default="2" data-source="2" type="number" value="2" class="input_txt" style="width:60px;" min="0">次以上或在不同承保公司案件中报案<input data-default="2" data-source="2" type="number" value="2" class="input_txt" style="width:60px;" min="0">次以上</td>
						</tr>
						<tr>
							<td style="text-align:center;"><input type="checkbox" name="mytype" class="taskCheckBox" data-id="8"min="0"><span>可疑时间</span></td>
							<td class="white">保单起期后<input data-default="15" data-source="8" type="number" value="15" class="input_txt" style="width:60px;" min="0">天内出险的案件及保单到期前<input data-default="7" data-source="8" type="number" value="7" class="input_txt" style="width:60px;" min="0">天内出险的案件</td>
						</tr>
						<tr>
							<td style="text-align:center;"><input type="checkbox" name="mytype" class="taskCheckBox" data-id="16"min="0"><span>可疑三者</span></td>
							<td class="white">同一车辆作为三者出险<input data-default="2" data-source="16" type="number" value="2" class="input_txt" style="width:60px;" min="0">次以上</td>
						</tr>
						<tr>
							<td style="text-align:center;"><input type="checkbox" name="mytype" class="taskCheckBox" data-id="4"  min="0"><span>同车多案</span></td>
							<td class="white">同一“车架号”号码车辆一个“出险年度”内有<input data-default="2" data-source="4" type="number" value="2" min="0" class="input_txt" style="width:60px;">次以上的报案且报案人或驾驶员不是同一个人的案件</td>
						</tr>
						<!--
						<tr>
							<td style="width:30%;text-align:center;"><input type="checkbox" name="mytype" class="taskCheckBox" data-id="32"><span>复杂串联案件</span></td>
							<td class="white"></td>
						</tr>
						-->
					</table>
				</div>
			</div>
		</div>
		<div class="alertRight" style="margin-top:20px;text-align: center;">					
			<!--需分配任务的类型-->
			<span class="applyNum" style="margin-right: 10px;">
				<label>申请数量：</label>
				<input type="number" value="1" min="0" class="input_txt" style="width:60px;">
			</span>
			<button id="apply" class="btn btn-primary"><span class="glyphicon glyphicon-send" aria-hidden="ture"></span>申请</button>
		</div>
	</div>
</div>

	<script type="text/javascript">
		var sysRoleDialog;
		$(function() {
			
		})	
	</script>
	<%@ include file="/include/zTree.jsp" %>	
	<script src="${ctx}/js/lib/perfect-scrollbar.jquery.js"></script>
	<script>
	     $(function () {
	     	//初始化滚动条
			$(".resultCon ").perfectScrollbar();
			resize();
            $(window).resize(function(){
				resize();
			});	
			//点击申请时
			var isApply=false;
			$(".bg1").delegate("#apply","click",function(){

				//判断数字不能小于0
				var numberVal=[];
				$("input[type='number']").each(function(){
					if($(this).val()<0){
						numberVal.push($(this).val());						
					}
				});
				if(isApply){
					return;
				}
				isApply=true;
				
				if(numberVal.length>0){
					isApply=false;
					alert("输入的数字不能为负数！");
						return false;
				}
				var taskNum = $(".applyNum input").val();
				if(taskNum=='' || taskNum==0){
					isApply=false;
					alert("申请数不能为空或0！");
					return;
				}else if(taskNum>10){
					isApply=false;
					alert("每次申请数量不能超过10条！");
					return;
				}
				var checkedType=[];
				var argMap = {};
				$("input[name='mytype']:checked").each(function(){
					checkedType.push($(this).data("id"));
				});
				if(checkedType.length<=0){
					isApply=false;
					alert("申请模型不能为空！");
					return false;
				}
				for(var i=0;i<checkedType.length;i++){
					var paras = $("#taskTypeTable [data-source='"+checkedType[i]+"']");
					argMap[checkedType[i]] = {};
					for(var j=0;j<paras.length;j++){
						argMap[checkedType[i]]["ARG"+(j+1)] = $(paras[j]).val() || $(paras[j]).data("default");
					}
				}
				 console.log(argMap)
					
				$('body').append('<div class="ajaxloading" style="position:absolute;left:45%;top:30%;width:130px;height:130px;z-index:3000000;"><img src='+url+'"/images/nloding.gif"></div>');
				$.ajax({
					type:"POST",
					url:"${ctx}/sysPersonal/personalTask.do",
					data:{
						taskNum:taskNum,
						checkedType:checkedType.join(","),
						argMap:argMap
					},
					dataType:"json",
					success:function(data){
						$(".ajaxloading").remove();
						if(data.code=="succ"){
							var msg = "申请成功\n";
							for(var proname in data.mess){
								msg = msg+"成功申请到"+data.mess[proname]+"组案件\n";
							}
							alert(msg);
							top.location.replace("${ctx}/sysPersonal/taskApply.do?ts="+ new Date().getTime());
						}else{
							if(data.mess!=undefined){
								alert(data.mess);
							}else{
								alert("分配失败");
							}
							isApply=false;
						}
					},
					error:function(){
						$(".ajaxloading").remove();
						isApply=false;
					}
				});
				$(".backg").css({"display":"none"});
			});
	    });
	    function resize(){
			//获取窗口高度
			var windowheight=$(window).height();
			var leftList = windowheight-40;
			$(".searchCon").css({"height":leftList+"px"});
			$(".resultCon").css({"height":leftList-12+"px"});
			//$(".tableMain").css({"height":windowheight-40-42-131+"px"});
			//$(".table_list").css({"height":windowheight-40-42-100-85+"px"});
			$(".resultCon").perfectScrollbar("update");
		}
	</script>
	<%@ include file="/include/footer.jsp"%>
</body>
</html>
