<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/include/header2.jsp"%>
<!-- <link type="text/css" rel="stylesheet" href="${ctx}/css/baseFrame.css" /> -->
<script src="${ctx}/component/My97DatePicker/WdatePicker.js" type="text/javascript"></script>

<title>查询日志列表</title>
<style>
	.blockCon{
		/*height: 400px;*/
		border: 1px solid #517184;
		padding:10px 20px ;
	}
	.content3{						
		overflow: hidden;
		color: #eee;			
	}
	.leftCon{
		float: left;
		width: 45%;
	}
	.rightCon{
		float: right;
		width: 45%;
	}
	.mark_hiatus{
		height: 245px;
		position:relative;
		border: 1px solid #517184;
		overflow: auto;
	}
	.mark_hiatus tr{
		line-height: 30px;
	}
	.mark_hiatus th,.mark_hiatus td{
		padding: 0px 10px;
		white-space: nowrap;
	}
	.mark_hiatus td{
		text-align: center;
	}
	.mark_hiatusBtn{
		margin-top: 10px;
		overflow: hidden;
	}
	/*.checkOrdelete{
		color:#fff;
		float: right;
		padding: 5px 10px;
		border: none;
		border-radius: 3px;
		background: #00b591;
	}
	.checkOrdelete2{
		color:#fff;
		float: right;
		padding: 5px 10px;
		border: none;
		border-radius: 3px;
		background: #00b591;
	}
	.commit_synchro {
		color:#fff;
		padding: 5px 10px;
		border: none;
		border-radius: 3px;
		background: #00b591;
	}*/
	.synchro{
		margin-top:10px;
		text-align: center;
	}
	
	.lineHeight{
		line-height:30px;
	}
</style>
</head>
<body class="bg1">
	<!--头部-->
    <div class="headCon">
        <%@ include file="/WEB-INF/jsp/top2.jsp"%>
    </div>
    <div class="container_fluid">
    	<!--左侧菜单-->
		<div class="searchCon left_menu managerLeft">
			<jsp:include page="/include/manageLeft.jsp">
				<jsp:param name="index" value="日志查看" />
			</jsp:include>
		</div>

		<div class="resultCon" style="margin-left: 255px;position:relative">	
			<div class="reSearch">	
		        <div class="p_bar" style="border-bottom: 1px dashed #afb4bb;">您当前的位置：日志管理/同步日志</div>
				<div style="font-size:16px; margin-top: 10px;" class="lineHeight">同步日志</div>
				<div class="blockCon">
					<div class="content3">
						<div class="leftCon">
							<p class="lineHeight">图数据库中缺失的标注信息</p>
							<div class="mark_hiatus scroll" id="pic_data">
								<table>
									<thead>
									<tr>
										<th>案件号</th><th>标注状态</th><th>标注日期</th><th>标注人</th>
									</tr>
									</thead>
									<tbody>
										<c:forEach items="${weaver}" var="one">
										<tr>
											<td><input type="checkbox" class="check_box" data-id="${one.dajaid}"/>${one.caseId}</td><td><c:if test="${one.markStatus eq '10'}">正常</c:if><c:if test="${one.markStatus eq '11'}">可疑</c:if><c:if test="${one.markStatus eq '12'}">欺诈</c:if></td><td><fmt:formatDate value="${one.markDate}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td><td>${one.markUser}</td>
										</tr>
										</c:forEach>
									</tbody>							
								</table>						
							</div>
							<div class="mark_hiatusBtn">
								<button type="button" class="btn btn-primary checkOrdelete2"><span class="glyphicon glyphicon-check" aria-hidden="ture"></span>全选/取消</button>
								<!-- <input type="button"class="checkOrdelete" value="全选/取消"/> -->
							</div>
						</div>
						<div class="rightCon">
							<p class="lineHeight">MYSQL数据库中缺失的标注信息</p>
							<div class="mark_hiatus scroll" id="mysql_data">
								<table>
									<thead>
										<tr>
										<th>案件号</th><th>标注状态</th><th>标注日期</th><th>标注人</th>
									</tr>	
									</thead>
									<tbody>
										<c:forEach items="${db}" var="one">
										<tr>
											<td><input type="checkbox" class="check_box" data-id="${one.dajaid}"/>${one.caseId}</td><td><c:if test="${one.markStatus eq '10'}">正常</c:if><c:if test="${one.markStatus eq '11'}">可疑</c:if><c:if test="${one.markStatus eq '12'}">欺诈</c:if></td><td><fmt:formatDate value="${one.markDate}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td><td>${one.markUser}</td>
										</tr>
										</c:forEach>
									</tbody>							
								</table>						
							</div>
							<div class="mark_hiatusBtn">
								<button type="button" class="btn btn-primary checkOrdelete2"><span class="glyphicon glyphicon-check" aria-hidden="ture"></span>全选/取消</button>
								<!-- <input type="button" class="checkOrdelete2" value="全选/取消"/> -->
							</div>
						</div>
					</div>
					<div class="synchro">
						<div style="color: #fff;">选中确定同步的标注</div>
						<div class="mark_hiatusBtn">
							<button type="button" class="btn btn-primary commit_synchro"><span class="glyphicon glyphicon-send" aria-hidden="ture"></span>提交同步</button>
							<!-- <input type="button" class="commit_synchro" value="提交同步"/> -->
						</div>
					</div>
				</div>
				<!--成功时返回的值-->
				<div id="succShow" hidden>
				
				</div>	
			</div>
		</div>
	</div>
	
	<script type="text/html" id="reslutCon">
		<div style="font-size:16px;margin-top: 10px;" class="lineHeight">日志同步的结果如下：</div>
		<div class="blockCon">
			<div class="content3">
				<div class="leftCon">
					<p class="lineHeight">图数据库同步失败案件</p>
					<div class="mark_hiatus scroll2" >
						<table class="" >
							<thead>
								<tr>
								<th>案件号</th><th>标注状态</th><th>标注日期</th><th>标注人</th>
							</tr>	
							</thead>
							<tbody id="pic_data2">
								<!for(var i=0;i<weaver.length;i++){!>
									<tr>
										<td><!=weaver[i].caseId!></td>
										<!if(weaver[i].markStatus==10){!>
										   <td data-status="10" data-markmess="<!=weaver[i].markMess!>" >正常</td> 
										<!}else if(weaver[i].markStatus==11){!>
										   <td data-status="11" data-markmess="<!=weaver[i].markMess!>">可疑</td> 
										<!}else if(weaver[i].markStatus==12){!>
										   <td data-status="12" data-markmess="<!=weaver[i].markMess!>">欺诈</td> 
										<!}else{!>
											<td data-status="00">未处理</td> 
										<!}!>
										<td><!=weaver[i].markDate!></td><td><!=weaver[i].markUser!></td>
									</tr>
								<!}!>
								
							</tbody>							
						</table>						
					</div>
				</div>
				<div class="rightCon">
					<p class="lineHeight">MYSQL数据库同步失败案件</p>
					<div class="mark_hiatus scroll2" >
						<table>
							<thead>
								<tr>
								<th>案件号</th><th>标注状态</th><th>标注日期</th><th>标注人</th>
							</tr>	
							</thead>
							<tbody id="mysql_data2">
								<!for(var i=0;i<db.length;i++){!>
									<tr>
										<td><!=db[i].caseId!></td>
										<!if(db[i].markStatus==10){!>
										   <td data-status="10" data-markmess="<!=db[i].markMess!>" >正常</td> 
										<!}else if(db[i].markStatus==11){!>
										   <td data-status="11" data-markmess="<!=db[i].markMess!>">可疑</td> 
										<!}else if(db[i].markStatus==12){!>
										   <td data-status="12" data-markmess="<!=db[i].markMess!>">欺诈</td> 
										<!}else{!>
											<td data-status="00">未处理</td> 
										<!}!>
										<td><!=db[i].markDate!></td><td><!=db[i].markUser!></td>
									</tr>
								<!}!>
							</tbody>							
						</table>						
					</div>
				</div>
			</div>
		</div>
	</script>
	<script src="${ctx}/js/lib/core.js"></script>
	<script src="${ctx}/js/lib/perfect-scrollbar.jquery.js"></script>
	<script type="text/javascript">
		$(function () {
			$(".resultCon").perfectScrollbar();
			$(".scroll").perfectScrollbar();
			resize();
			$(window).resize(function(){
				resize();
			});
			
			//判断是全选还是取消       图数据库
			$(".checkOrdelete").click(function(){
				var n=0;
				$("#pic_data .check_box").each(function(){
					if(this.checked){
						n++;
					}
				});
				if(n==0){
					$("#pic_data .check_box").prop("checked",true);
				}else{
					$("#pic_data .check_box").prop("checked",false);
				}		
			});
			//判断是全选还是取消       mySQL据库
			$(".checkOrdelete2").click(function(){
				var n=0;
				$("#mysql_data .check_box").each(function(){
					if(this.checked){
						n++;
					}
				});
				if(n==0){
					$("#mysql_data .check_box").prop("checked",true);
				}else{
					$("#mysql_data .check_box").prop("checked",false);
				}		
			});
			//获取选中的caseId
			$(".commit_synchro").click(function(){
				var list=[],list2=[];
				$("#pic_data .check_box").each(function(){
					if(this.checked){
						list.push($(this).data("id"));
					}
				});
				
				$("#mysql_data .check_box").each(function(){
					if(this.checked){
						list2.push($(this).data("id"));
					}
				});
				list=list.join(",");
				list2=list2.join(",");
				console.log(list);console.log(list2);
				$.ajax({
					type:"POST",
					url:"${ctx}/sysLog/doCampareMark.do",
					data:{weaverError:list,dbError:list2},
					success:function(result){
						var ht = baidu.template("reslutCon",result);
						alert("执行完毕,请看结果！");
						$("#succShow").html(ht);
						$("#succShow").show();	
						$(".scroll2").perfectScrollbar();
					}
				});
			})
	    });
		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-105+"px"});
			//$(".table_list").css({"height":windowheight-40-42-100-85+"px"});
			$(".resultCon").perfectScrollbar("update");
			$(".scroll").perfectScrollbar("update");
			$(".scroll2").perfectScrollbar("update");
		}		
	</script>
<%@ include file="/include/footer.jsp"%>
</body>
</html>