<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="contextPath" value="${pageContext.request.contextPath}"></c:set>

<link rel="stylesheet" href="${contextPath}/static/assets/css/jquery.gritter.css" />
<link rel="stylesheet" href="${contextPath}/static/assets/css/bootstrap-datetimepicker.css" />
<div class="container">
<div class="row">
		开始日期：<input id="startDateM" type="text">
		结束日期：<input id="endDateM" type="text">
<SELECT NAME="module" id="module" >   
<OPTION VALUE="0">请选择 </OPTION>   
<OPTION VALUE="1">注册律师日活 </OPTION>   
<OPTION VALUE="11">律师注册数 </OPTION>   
<OPTION VALUE="12">律师申请数</OPTION>   
<OPTION VALUE="13">律师通过数 </OPTION>
<OPTION VALUE="21">ssdb查询次数(所有)</OPTION>  
<OPTION VALUE="22">ssdb查询次数（注册）</OPTION>
<OPTION VALUE="23">ssdb申请次数</OPTION>  
</SELECT>  
<a data-toggle="tab" href="javascript:void(0)" class="btn-new-mail" id="modelClickID">
	<span class="btn btn-purple no-border">
		<span class="small">重新加载</span>
	</span>
</a>
<div id="modeldaily" style="height:400px;" data-toggle="tab"></div>
</div>
</div>
<script type="text/javascript">
	var scripts = [null,"${contextPath}/static/assets/js/bootstrap-tag.js","${contextPath}/static/assets/js/jquery.hotkeys.js","${contextPath}/static/assets/js/date-time/bootstrap-datepicker.js","${contextPath}/static/assets/js/date-time/locales/bootstrap-datepicker.zh-CN.js","${contextPath}/static/assets/js/echarts/echarts.min.js",null]
			$(".page-content-area").ace_ajax("loadScripts", scripts, function() {
			jQuery(function($){
			$("#row11").click(row11);
			$("#modelClickID").click(modelClickID);
			
			$('#startDate').datepicker({
		        language: 'zh-CN',
		        pickTime: false,
		        todayBtn: true,
		        autoclose: true,
		        minView: '2',
		        forceParse: false,
		        format:"yyyy-mm-dd"
		    });
			$('#endDate').datepicker({
		        language: 'zh-CN',
		        pickTime: false,
		        todayBtn: true,
		        autoclose: true,
		        minView: '2',
		        forceParse: false,
		        format:"yyyy-mm-dd"
		    });
		    $('#startDateM').datepicker({
		        language: 'zh-CN',
		        pickTime: false,
		        todayBtn: true,
		        autoclose: true,
		        minView: '2',
		        forceParse: false,
		        format:"yyyy-mm-dd"
		    });
			$('#endDateM').datepicker({
		        language: 'zh-CN',
		        pickTime: false,
		        todayBtn: true,
		        autoclose: true,
		        minView: '2',
		        forceParse: false,
		        format:"yyyy-mm-dd"
		    });
		});	
		postModelDaily();
	});
function row11(){
		var startDate = $("#startDate").val();
		var endDate = $("#endDate").val();
		if(startDate==''){
			alert('开始日期不能为空！');
			return;
		}
		postDailyData(startDate,endDate);
}
//模块查询
function modelClickID(){
		var startDate = $("#startDateM").val();
		var endDate = $("#endDateM").val();
		var module=$("#module").val();
		var moduleShow=$("#module").find("option:selected").text();
		postModelDaily(module,startDate,endDate,moduleShow);
}
function postModelDaily(moduleName,startD,endD,moduleShow){
	if(startD){
	}else {
		startD=1;
	}
	if(endD){
	}else {
		endD=1;
	}
	if(moduleName){
	}else {
		moduleName=0;
	}
	var charDefa="注册律师日活",charName1='';
	var modeldailyChar = echarts.init(document.getElementById('modeldaily'));
	var datatime = new Array();
	var dataapp=new Array();
	var datalawyer=new Array();
	if(moduleShow){
		if(moduleName==0){
			charName1="注册律师日活";
		}else{
			charName1=moduleShow;
		}
	}else{
		charName1=charDefa;
	}
	$.post("${contextPath}/sys/staticdaily/getModelALL?dailyType='"+moduleName+"&startD='"+startD+"'&endD='"+endD+"'", {}, function(result){
			 		var data_s=JSON.parse(result);
			 		for(var x in data_s){
			 		var staticDate=data_s[x].staticDate;
			 		var num=data_s[x].num;
			 		datatime.push(staticDate);
			 		dataapp.push(num);
			 		}
			 		modeldailyoption = {
					    title : {
					        text: '统计报表',
					        subtext: ''
					    },
					    tooltip : {
					        trigger: 'axis'
					    },
					    legend: {
					        data:["多问"]
					    },
					    
					    toolbox: {
					        show : true,
					        feature : {
					            mark : {show: true},
					            dataView : {show: true, readOnly: false},
					            magicType : {show: true, type: ['line', 'bar']},
					            restore : {show: true},
					            saveAsImage : {show: true}
					        }
					    },
					    calculable : true,
					    xAxis : [
					        {
					            type : 'category',
					            boundaryGap : false,
					            data :datatime
					        }
					    ],
					    yAxis : [
					        {
						            type : 'value',
						        }
						    ],
						  itemStyle:{
						   normal:
						   {
						      show:true, //显示数据值
						      position:'outer' //显示在外侧
						   }, label:{
							     show:true
							}
						},
					    series : [
					        {
					            name:charName1,
					            type:'line',
					            data:dataapp
					        }
					    ]
					};
					modeldailyChar.setOption(modeldailyoption);
			 		});
	}
</script>
