﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/include/header2.jsp"%>
<!-- 
<link type="text/css" rel="stylesheet" href="${ctx}/css/baseFrame.css" />
<link type="text/css" rel="stylesheet" href="${ctx}/css/index.css" /> -->
<link rel="stylesheet"  type="text/css" href="${ctx}/css/indexNew/jquery-ui.min.css" />
<link type="text/css" rel="stylesheet" href="${ctx}/css/zTreeStyle.css" />
<link rel="stylesheet" type="text/css" href="${ctx}/css/newCss/dialog.css">
<script src="${ctx}/component/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<title>查询系统任务列表</title>
<style>
	.c_table td.t_tit {
		width: 7%;	
	}
	#queryDiv div span {
		margin-right: 0px;
		display: inline-block;
		float: left;
	}
	#queryDiv div {
		height: 30px;
		line-height: 30px;
		text-indent: 25px; 
	}
	.deliveryBtn{
		background-color: #00b591;
		padding: 5px 15px;
		border-radius: 5px;
		color: #fff;
		margin-right: 7px;
		cursor: pointer;
	}
	#typeValue {
		width: 50%;
		float: left;
		padding-top: 10px;
	}
	#typeValue .typeNum{
	    padding-top:10px;
	}
	.nowAllNum {
		font-size: 16px;
		font-family: initial;
		color:  #F4DBCC;
		font-weight: 700;
	}
	#typeValue .nowAllNum b {
		color: #e77e3b;
		font-size: 35px;
		
		margin: 0 5px;
	}
	#typeValue .typeNum li {
		float: left;
		width: 180px;
		line-height:25px;
	}
	#typeValue b {
		color: #eee;
		font-size: 16px;
	}
	/*弹出框的样式*/
	.detailAlert{
		width: 60%;
        height: auto;
	    background: #0A1531;
	    box-shadow: 3px 4px 10px #999;
	    border-radius: 5px;
	    padding: 20px;
	    position: relative;
	    margin: 7% auto;
	}
	.detailAlert table th,.detailAlert table td{
		line-height: 35px;
	}
	.alertTabCon {
	    /*margin-top: 10px;*/
	    margin-right: 20px;
	}
	.scrollTbody{
		display: inline-block;
		position: relative;
		height: 245px;
		margin-left: 20px;
	}
	/*.detailAlert span {
	    padding-left: 6px;
	 }*/
	.r_left{
		float: left;
		width: 45%;
		border-right: 1px solid #384356;
	}
	.alertRight{
		float: left;
		margin: 0px 0px 0px 20px;
		width: 50%;
	}
	.taskNum input {
	    width: 50px;
	    border: none;
	    line-height: 25px;
	    padding-left: 6px;
	    border-radius: 3px;
	}
	.taskType {
	    margin-top: 10px;
	}
	.taskType_title{
		line-height: 30px;
	    font-size: 16px;
	    border-bottom: 1px solid #7a8baa;
	    white-space: nowrap;
	    overflow: hidden;
	    text-overflow: ellipsis;
	}
	.white {
		white-space: pre-line;
	}
	.taskType_tabCon tr td{
	    border:1px solid #364C73;
		padding: 2px 8px;
		line-height: 2;
	}
	/*点击导出时的样式*/
	#timeFilterAlert {
	    position: absolute;
	    top: 170px;
	    background-color: rgb(7, 28, 90);
	    width: 250px;
	    padding: 12px 16px;
	    border-radius: 5px;
	    cursor: default;
	    color: #fff;
	    right: 27px;
	    border: 1px solid #3399cc;
	}
	#timeFilterAlert:before {
	    content: "";
	    position: absolute;
	    top: -7px;
	    left: 100px;
	    width: 0px;
	    height: 0px;
	    display: block;
	    border-right: 10px solid transparent;
	    border-bottom: 10px solid rgb(7, 28, 90);
	    border-left: 10px solid transparent;
	}
	/*.taskType_tabCon tr td input{
		height: 14px;
		border: 1px solid #ddd;
		padding: 0px 2px;
		border-radius: 3px;
		margin: 0 4px;
	}*/
	.ztree li a {
		color: #fff;
	}
	.ztree li span.button{
		height:0px;
	}
	.ztree li span.button.switch {
	    width: 22px;
	}
	.ztree li span.button.chk {
	    width: 14px;
	}
</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>
			<!-- <ul>
				<hna:permission privilege="sysUser.view">
				<li><a href="${ctx}/sysUser/list.do">用户管理</a></li>
				</hna:permission>
				<hna:permission privilege="sysRole.view">
				<li><a href="${ctx}/sysRole/list.do">角色管理</a></li>
				</hna:permission>
				<hna:permission privilege="sysAuthority.view">
				<li><a href="${ctx}/sysAuthority/list.do">权限管理</a></li>
				</hna:permission>
				<hna:permission privilege="sysLog.view">
				<li><a href="${ctx}/sysLog/list.do">日志查看</a></li>
				</hna:permission>
				<hna:permission privilege="sysTask.issuing">
				<li class="on"><a href="${ctx}/sysTask/list.do">任务管理</a></li>
				</hna:permission>
				<li><a href="${ctx}/sysTaskPlus/specialImport.do">模型数据导入</a></li>
			</ul> -->
		</div>

		<div class="resultCon" style="margin-left: 255px;position:relative;">
			<input type="hidden" id="CSRFToken" value="${csrfToken }"/>
			<div class="wrap">
				<div class="reSearch">
					<div class="p_bar" style="border-bottom: 1px dashed #afb4bb;">您当前的位置：任务管理</div>
				</div>
				<div class="resultTable" style="position:relative;margin:10px 0;background:rgba(0,0,0,0.3);border-radius: 5px;padding: 20px;width:99%;">
					<div style="position:absolute;right:20px;top:25px;">
						<hna:permission privilege="sysTask.quickDistribution">
							<button class="btn btn-primary deliveryBtn1"><span class="glyphicon glyphicon-flash" aria-hidden="ture"></span>快速分配</button>
						</hna:permission>
						<hna:permission privilege="sysTask.view">
							<a href="${ctx}/sysTask/listDetail.do" style="color:#fff"><button class="btn btn-primary"><span class="glyphicon glyphicon-list" aria-hidden="ture"></span>详情</button></a>
						</hna:permission>
						<hna:permission privilege="graph.downloadmark">
							<button class="btn btn-primary deliveryBtn2"><span class="glyphicon glyphicon-import" aria-hidden="ture"></span>标注导出</button>
						</hna:permission>
						<hna:permission privilege="sysTask.upload">
							<button id="upload" class="btn btn-primary"><span class="glyphicon glyphicon-export" aria-hidden="ture"></span>导入标注</button>
						</hna:permission>
					</div>
					<div style="">
						<h3 style="text-align: center;color: #fff;font-size: 18px;">案件分配情况</h3>
						<div class="" id="myPie" style="width:50%;height:210px;float:left;">
							
						</div>
						<div id="typeValue">
						    <p class="nowAllNum">
							    <span>目前任务总数：<b id="allNumber"></b>条<span>
								<span style="margin-left:20px">已完成：<b id="finishNum"></b>条</span>
							</p>
							<ul class="typeNum">
							    <li>同地多案：<b id="tdNum"></b>条</li>
								<li>同号多案：<b id="thNum"></b>条</li>
								<li>可疑时间：<b id="kytNum"></b>条</li>
								<li>可疑三者：<b id="kysNum"></b>条</li>
								<li>同车多案：<b id="tcNum"></b>条</li>
								<!--<li>复杂串联案件：<b id="fzNum"></b>条</li>-->
							</ul>
						</div>
						<div class="clear"></div>
					</div>
					<div style="">
						<h3 style="text-align: center;color: #fff;font-size: 18px;">案件分配情况</h3>
						<div class="" id="myBar" style="width:100%;height:260px;">
							
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!--弹出框的内容-->
    <div class="backg" style="display:none;" id="alertCon">
		<div class="detailAlert">
			<div style="overflow: hidden;margin-bottom: 20px;">
				<!--接受任务者-->
				<div class="receiver r_left" style="position: relative; margin-left: 10px;">
					<p class="taskType_title" style="margin-right:20px;">任务需分配名单选择</p>
					<div class="alertTabCon menuContent" id="menuContent">
						<ul class="alertTab ztree" style="position: relative;height: 280px;margin-top:0px" id="treeDemo">
						<!--	<thead>
								<tr style="border-bottom: 1px solid #7a8baa;">
									<td colspan="2"><input type="checkbox" class="check_all"><span>全选</span></td>
								</tr>
							</thead>	
							<tbody class="scrollTbody">
								<tr>
									<td><input type="checkbox" class="check_box" data-id="1"><span>名字</span></td>
									<td></td>
								</tr>
								<tr>
									<td><input type="checkbox" class="check_box" data-id="2"><span>名字</span></td>
									<td></td>
								</tr>
								<tr>
									<td><input type="checkbox" class="check_box" data-id="3"><span>名字</span></td>
									<td></td>
								</tr>
								<tr>
									<td><input type="checkbox" class="check_box" data-id="4"><span>名字</span></td>
									<td></td>
								</tr>
								<tr>
									<td><input type="checkbox" class="check_box"><span data-id="5">名字</span></td>
									<td></td>
								</tr>
								<tr>
									<td><input type="checkbox" class="check_box" data-id="6"><span>名字</span></td>
									<td></td>
								</tr>
								<tr>
									<td><input type="checkbox" class="check_box" data-id="7"><span>名字</span></td>
									<td></td>
								</tr>
								
							</tbody> -->
						</ul>						
					</div>
					<!--需分配任务的数量-->
					<div class="taskNum">
						人均串案数：<span><input type="number" class="input_txt" value="23"></span>
					</div>
				</div>
				<div class="alertRight">					
					<!--需分配任务的类型-->
					<div class="taskType">
						<p class="taskType_title">任务分配类型</p>
						<div class="taskType_tabCon" style="position:relative;height:285px;" id="taskTypeTable">
							<table style="table-layout:fixed;" border="1">
								<tr>
									<td style="width:30%;text-align:center;"><input type="checkbox" name="mytype" class="taskCheckBox" data-id="1"><span>同地多案</span></td>
									<td class="white" style="width:70%">同一“出险地点”多次报案，“出险时驾驶员”、“报案人”或“报案电话”、“牌照号码”、“估损单维修厂名称”均相同<input data-default="2" data-source="1" type="number" value="2" class="input_txt" style="width:50px;">次以上的案件清单；或“牌照号码”不同，但“出险时驾驶员”、“报案人”或“报案电话有一相同<input data-default="2" data-source="1" type="number" value="2" class="input_txt" style="width:50px;">次以上的案件</td>
								</tr>
								<tr>
									<td style="width:30%;text-align:center;"><input type="checkbox" name="mytype" class="taskCheckBox" data-id="2"><span>同号多案</span></td>
									<td class="white">同一报案电话不同车辆报案<input data-default="2" data-source="2" type="number" value="2" class="input_txt" style="width:50px;">次以上或在不同承保公司案件中报案<input data-default="2" data-source="2" type="number" value="2" class="input_txt" style="width:50px;">次以上</td>
								</tr>
								<tr>
									<td style="width:30%;text-align:center;"><input type="checkbox" name="mytype" class="taskCheckBox" data-id="8"><span>可疑时间</span></td>
									<td class="white">保单起期后<input data-default="15" data-source="8" type="number" value="15" class="input_txt" style="width:50px;">天内出险的案件及保单到期前<input data-default="7" data-source="8" type="number" value="7" class="input_txt" style="width:50px;">天内出险的案件</td>
								</tr>
								<tr>
									<td style="width:30%;text-align:center;"><input type="checkbox" name="mytype" class="taskCheckBox" data-id="16"><span>可疑三者</span></td>
									<td class="white">同一车辆作为三者出险<input data-default="2" data-source="16" type="number" value="2" class="input_txt" style="width:50px;">次以上</td>
								</tr>
								<tr>
									<td style="width:30%;text-align:center;"><input type="checkbox" name="mytype" class="taskCheckBox" data-id="4"><span>同车多案</span></td>
									<td class="white">同一“车架号”号码车辆一个“出险年度”内有<input data-default="2" data-source="4" type="number" value="2" class="input_txt" style="width:50px;">次以上的报案且报案人或驾驶员不是同一个人的案件</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>
			<div class="confirmBtn" style="text-align: center;">
				<button class="btn btn-primary confirm_btn"><span class="glyphicon glyphicon-ok" aria-hidden="ture"></span>确定</button>
				<button class="btn btn-danger delete_btn"><span class="glyphicon glyphicon-remove" aria-hidden="ture"></span>取消</button>
			</div>
		</div>
	</div>
	<div id="timeFilterAlert" style="display:none;">
		<div id="timeContainer" >
			<div id="choSet">
				<p>起始时间：<input 
								name="minY" 
								id="minY" 
								class="input_txt"  
								readonly="readonly"
								placeholder="请输入起始日期"
								onfocus="WdatePicker({isShowWeek:true,dateFmt:'yyyy-MM-dd HH:mm:ss',realDateFmt:'yyyy-MM-dd',realTimeFmt:'HH:mm:ss',minDate:'2010-01-01',maxDate:'#F{$dp.$D(\'maxY\')||\'%y-%M-%d\'}'})" 
								style="width:120px"/></p>
				<p>结束时间：<input 
								name="maxY" 
								id="maxY" 
								class="input_txt"  
								readonly="readonly" 
								placeholder="请输入结束日期"
								onfocus="WdatePicker({isShowWeek:true,dateFmt:'yyyy-MM-dd HH:mm:ss',realDateFmt:'yyyy-MM-dd',realTimeFmt:'HH:mm:ss',minDate:'#F{$dp.$D(\'minY\')||\'2010-01-01\'}',maxDate:'%y-%M-%d'})" 
								class="input_txt" 
								style="width:120px"/></p>
				<span class="btn btn-primary btn-confirm"><span class="glyphicon glyphicon-ok" aria-hidden="ture"></span>确认</span>
				<span class="btn  btn-danger btn-cancel "><span class="glyphicon glyphicon-remove" aria-hidden="ture"></span>关闭</span>

			</div>
		</div>
	</div>
		
	<script src="${ctx}/js/lib/jquery-ui.min.js"></script>
	<script src="${ctx}/js/lib/perfect-scrollbar.jquery.js"></script>
	<script src="${ctx}/js/lib/echarts3.1.10.js"></script>
	<script src="${ctx}/js/lib/jquery.ztree.core.js"></script>
	<script src="${ctx}/js/lib/jquery.ztree.excheck.js"></script>
	<script src="${ctx}/js/page/echartComp.js"></script>
	<script>
	    $(function () {
		    $(".resultCon").perfectScrollbar();
		    $(".searchCon").perfectScrollbar();
			resize();
            $(window).resize(function(){
				resize();
			});
			function resize(){
				//获取窗口高度
				var windowheight=$(window).height();
				var leftList = windowheight-40;
				$(".searchCon").css({"height":leftList+"px"});
				$(".resultCon").css({"height":leftList-10+"px"});
				//$(".tableMain").css({"height":windowheight-40-42-131+"px"});
				//$(".table_list").css({"height":windowheight-40-42-100-85+"px"});
				$(".searchCon").perfectScrollbar("update");
				$(".resultCon").perfectScrollbar("update");
				
				if(myPie!= undefined){
					myPie.resize();
				}
				if(myBar!= undefined){
					myBar.resize();
				}
			}
			
			$.post('${ctx}/sysTask/analyze.do',function(result){
			    console.log(result);
			    var bar = result.bar;
				var pie = result.pie;
				getPieData(pie);
				getBarData(bar);
				
				//给各个单独项赋值
			    $("#allNumber").html(result.info.total);
				$("#finishNum").html(result.info.complete);
				$("#tdNum").html(result.info.同地多案);
				$("#thNum").html(result.info.同号多案);
				$("#kytNum").html(result.info.可疑时间);
				$("#kysNum").html(result.info.可疑三者);
				$("#tcNum").html(result.info.同车多案);
				$("#fzNum").html(result.info.复杂串联案);
			})
			
			var myPie = echarts.init(document.getElementById("myPie"));
			myPie.showLoading();
			/*
			 * 获取饼图的数据
			 */
			function getPieData(pie){
				var pieData = pie;
				drawPie(myPie,pieData);
				myPie.hideLoading();
			}
			/*
			 * 获取柱状图的数据
			 */
			var myBar = echarts.init(document.getElementById("myBar"));
			myBar.showLoading();
			function getBarData(bar){
				var barData = bar;
				drawBar(myBar,barData);
				myBar.hideLoading();
			}
			
		});
	</script>
	<script>
		var dfdf;
		var linkTreeNodes;
		var defautlUserMap = {};
    	(function(){
			$('.taskType_tabCon').perfectScrollbar();
	        $('.taskType_tabCon').perfectScrollbar("update");
    		//筛选  全选
			
			$.post("${ctx}/sysTask/getUsersByDeptId.do",{},function(data){
				console.log(data);
				$(".alertTab").empty();
				var setting = {
			        view:{
						selectedMulti:false
					},
					check: {
						enable: true
						/*chkStyle:"checkbox"*/
						
					},
					data: {
						simpleData: {
							enable: true
						}
					},
					callback:{
						onCheck:onCheck
					}
				};
				
				var zNodes=[];
				if(data.nextUser!=undefined){
					for(var i = 0; i< data.nextUser.length;i++){
						zNodes.push({
							id:"dept"+data.nextUser[i].deptId,
							pId:null,
							name:data.nextUser[i].deptCnName,
							open:true,isParent:true
						});
						//var $tr=$("<tr style='background:#111;'><td><input type='checkbox' class='check_All' data-id='"+data.nextUser[i].deptId+"'></td><td data-id='"+data.nextUser[i].deptId+"'>"+data.nextUser[i].deptCnName+"</td></tr>");
						//$(".alertTab tbody").append($tr);
						for(var j=0;j<data.nextUser[i].sysUsers.length;j++){
							zNodes.push({
								id:data.nextUser[i].sysUsers[j].userId,
								pId:"dept"+data.nextUser[i].deptId,
								name:data.nextUser[i].sysUsers[j].userCnName+"("+data.nextUser[i].sysUsers[j].username+")",
								open:true
							});
							defautlUserMap[data.nextUser[i].sysUsers[j].userId]=data.nextUser[i].sysUsers[j].userCnName;
							//var $tr2=$("<tr style='text-indent: 20px;'><td><input type='checkbox' class='check_box' data-id='"+data.nextUser[i].sysUsers[j].userId+"'></td><td data-id='"+data.nextUser[i].sysUsers[j].userId+"'>"+data.nextUser[i].sysUsers[j].userCnName+"</td></tr>");
							//$(".alertTab tbody").append($tr2);
						}
						
						//未知$tr += $("<tr><td><input type='checkbox' class='check_box' data-id='"+data.nextUser[i].userId+"'><span>"+data.nextUser[i].userCnName+"("+data.nextUser[i].username+")"+"</span></td><td></td></tr>");
						//defautlUserMap[data.nextUser[i].userId] = data.nextUser[i].userCnName;
						//$(".alertTab tbody").append($tr);
					}
					dfdf = $.fn.zTree.init($("#treeDemo"), setting, zNodes);
				}		
				var clearFlag = false;
				function onCheck(e, treeId, treeNode) {
					count();
					if (clearFlag) {
						clearCheckedOldNodes();
					}
				}
				function clearCheckedOldNodes() {
					var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
					nodes = zTree.getChangeCheckedNodes();
					for (var i=0, l=nodes.length; i<l; i++) {
						nodes[i].checkedOld = nodes[i].checked;
					}
				}
				
				function count() {
					//var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
					//判断是否选择，把选中的数据放入nodes中
					//nodes = zTree.getCheckedNodes(true);
					//$("#treeDemo").attr("data-result",nodes);

				}
				
				function createTree() {
					
					count();
				}
			    $(document).ready(function(){
					createTree();
				});
				/*linkTreeNodes = $.fn.zTree.init($("#treeDemo"), setting, zNodes);
				var zTree = $.fn.zTree.getZTreeObj("treeDemo");
				var checkedNodes = zTree.getCheckedNodes(true);
				//console.log(checkedNodes);*/				
				
			});
			
			/*$(".check_all").click(function(){
				if(this.checked){
					$(".check_box").prop("checked",true);
				}else{
					$(".check_box").prop("checked",false);
				}		
			});
			//判断是否全选
			$(".check_box").click(function(){
				var n=0;
				$(".check_box").each(function(){
					if(this.checked){
						n++;
					}
				});
				if(n==$(".check_box").size()){
					$(".check_all").prop("checked",true);
				}else{
					$(".check_all").prop("checked",false);
				}
			});*/
			$('#treeDemo').perfectScrollbar();
	        $('#treeDemo').perfectScrollbar("update");
	        //点击快速分配
	        $(".deliveryBtn1").click(function(e){
	        	e.stopPropagation();
				$(".check_box").each(function(){
				     $(this).attr("checked",false);
				 });
				 $(".backg .check_all").attr("checked",false);
				 $(".taskNum input").val("");
				 $(".taskCheckBox").each(function(){
				     $(this).attr("checked",false);
				 });
	        	$(".backg").css({"display":"block"});
	        });
	        //点击确定时
			$("#alertCon").delegate(".confirm_btn","click",function(){
				var checkedData = dfdf.getCheckedNodes(true);
				 var taskNum = $(".taskNum input").val();
				 if(taskNum==''){
					alert("人均案件数不能为空！");
					return;
				 }
				 var checkedMan = [];
				 var checkedType = [];
				 var argMap = {};
				/* $(".check_box").each(function(){
					 if($(this).is(":checked")){
						if(checkedMan!=""){
							checkedMan+=",";
						}
						checkedMan+=$(this).data("id");
					 }
				 });*/
				 for(var i=0;i<checkedData.length;i++){
					if(checkedData[i].id.substr(0,4)!='dept'){
						if(checkedData[i].checked){
							checkedMan.push(checkedData[i].id);								
						}
					}
				 }
				 checkedMan=checkedMan.join(",");
				 console.log(checkedMan);
				 $("input[name='mytype']:checked").each(function(){
					checkedType.push($(this).data("id"));
				 });
				 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}/sysTask/randomNextTask.do",
					data:{
						taskNum:taskNum,
						checkedMan:checkedMan,
						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+"成功分配给用户【"+defautlUserMap[proname]+"】"+data.mess[proname]+"组案件\n";
							}
							alert(msg);
							top.location.replace("${ctx}/sysTask/list.do?ts="+ new Date().getTime());
						}else{
							if(data.mess!=undefined){
								alert(data.mess);
							}else{
								alert("分配失败");
							}
						}
					},
					error:function(){
						$(".ajaxloading").remove();
					}
				});
				$(".backg").css({"display":"none"});
			});
	        //点击取消时
	        $("#alertCon .delete_btn").click(function(){
				$(".backg").css({"display":"none"});
			});
			
			//导出时选择时间过滤
			//$(".Wdate").datepicker({ dateFormat: 'yy-mm-dd' });
			$(".deliveryBtn2").click(function(){
				//download();
				$("#timeFilterAlert").css("display","block");				
			});

			//判断是否是ie
			function isIE() { //ie?
		        if (!!window.ActiveXObject || "ActiveXObject" in window)
		        	return true;
		        else{
		        	 return false;
		        	}		       
		    }
			$("#timeFilterAlert .btn-confirm").click(function(){
				var start = $("#minY").val().toString();
				var end = $("#maxY").val().toString();
				var minTime = new Date(Date.parse(start.replace(/-/g,"/")));
				var maxTime = new Date(Date.parse(end.replace(/-/g,"/")));
				/*if(isIE){
					minTime = new Data(Date.parse(start.replace(/-/g,"/")));
					maxTime = new Data(Date.parse(end.replace(/-/g,"/")));

				}else{
					minTime = new Date(start);
					maxTime = new Date(end);
				}*/
				
				if(minTime.getTime()<=maxTime.getTime()){
					$("#timeFilterAlert").css("display","none");
					download(start,end);
				}else{
					alert("起始时间不能大于终止时间！");
					return false;
				}			
			});
			$("#timeFilterAlert .btn-cancel").click(function(){
				$("#minY").val('');
				$("#maxY").val('');
				$("#timeFilterAlert").css("display","none");
			});
			function download(start,end){
				var $form = $("<form style='display:none' target='downloadframe' action='${ctx}/baseInfo/downloadmark.do' method='post'>");
				var $start = $("<input name='start' value='"+start+"'>");
				var $end = $("<input name='end' value='"+end+"'>");
				var $task = $("<input name='import1' value='task'>");
				$form.append($start).append($end).append($task);
				$("body").append($form);
				$form.submit();
				$form.remove();
			}
			//导入标注
			$("#upload").click(function () {
				//$("#timeFilterAlert").css("display","block");
				window.location.href="${ctx}/sysLog/toUploadMark.do";
	        });
    	})();
    </script>
	<%@ include file="/include/footer.jsp"%>
</body>
</html>
