<!-- include 'header' -->

<script src="<?= WEB_SITE_GLOBAL ?>js/echarts.min.js"></script>

	
<body>
	<div class="mainLayout">
		<div class="mainMenu">
			<div class="menuItem">
				<a href="#" class="mLogo">CLD</a>
				<ul>
					<!-- include 'menu' -->
				</ul>
			</div>
		</div>
		<div class="warpContent">
	  		<div class="infoCenter">
	  			<div class="centerPanel">
					<div class="bigAddup" data-placement="bottom" data-toggle="ctooltip" data-original-title="客户总数">客户：{{sum}}</div>
					<ul class="sortAddup" data-placement="right" data-toggle="ctooltip" data-original-title="创建客户数">
						<!-- if !empty({{max}}) -->
						<li>
						<!-- if isset({{max.0}}) -->
						<span>{{max.0.1}}：</span>{{max.0.0}}
						<!-- endif -->
						</li>
						<li>
						<!-- if isset({{max.1}}) -->
						<span>{{max.1.1}}：</span>{{max.1.0}}
						<!-- endif -->
						</li>
						<li>
						<!-- if isset({{max.2}}) -->
						<span>{{max.2.1}}：</span>{{max.2.0}}
						<!-- endif -->
						</li>
						<!-- endif -->
						<dl class="hide sec use">
							<!-- loop max2 -->
							<dd><span>{{max2' value.1}}：</span>{{max2' value.0}}</dd>
							<!-- endloop -->
						</dl>
					</ul>
					<div class="bigAddup" data-placement="bottom" data-toggle="ctooltip" data-original-title="锁总数（使用率）">锁：{{Rsum}}({{Ssum}})</div>
					<ul class="sortAddup" data-placement="right" data-toggle="ctooltip" data-original-title="锁使用率">
						<li>
						<!-- if isset({{useL.0}}) -->
						<span>{{useL.0.1}}：</span>{{useL.0.0}}
						<!-- endif -->
						</li>
						<li>
						<!-- if isset({{useL.1}}) -->
						<span>{{useL.1.1}}：</span>{{useL.1.0}}
						<!-- endif -->
						</li>
						<li>
						<!-- if isset({{useL.2}}) -->
						<span>{{useL.2.1}}：</span>{{useL.2.0}}
						<!-- endif -->
						</li>
						<dl class="hide sec">
							<!-- loop useL2 -->
							<dd><span>{{useL2' value.1}}：</span>{{useL2' value.0}}</dd>
							<!-- endloop -->
						</dl>
					</ul>
	  			</div>
	  			<div class="centerRecord">
	  				<div class="sideBar">
	  					<div class="mostTab"></div>
	  					<div class="mostList autoHeightI1" data-placement="top" data-toggle="ctooltip" data-original-title="滚动条隐藏了，用鼠标滚轮下拉吧">
	  						<ul class="item">
                                <li class="select <!-- if empty({{sid}}) -->now<!-- endif -->">
                                    <select id="cateselect">
                                        <!-- loop categorylist2 -->
                                        
                                        <!-- if isset({{categorylist2' value.did}}) -->
                                        <option value="{{categorylist2' value.cid}}-{{categorylist2' value.did}}" <!-- if {{categorylist2' value.cid}} == {{cid}} &&{{categorylist2' value.did}} == {{did}} -->selected<!-- endif -->>{{categorylist2' value.title}}-{{categorylist2' value.departmentName}}</option>
                                       	<!-- else -->
                                       	<option value="{{categorylist2' value.cid}}" <!-- if {{categorylist2' value.cid}} == {{cid}} -->selected<!-- endif -->>{{categorylist2' value.title}}</option>
                                       	<!-- endif -->
                                        
                                        
                                        
                                        <!-- endloop -->
                                    </select>
                                </li>
	  							<!-- loop staffList -->
	  							<li <!-- if {{staffList' value.sid}}=={{sid}} -->class="now" <!-- endif -->>
	  								
	  								
	  								<!-- if !empty({{staffList' value.departmentID}}) -->
	  								<a href="/longleStatistics?cid={{staffList' value.cid}}-{{staffList' value.departmentID}}&sid={{staffList' value.sid}}"><div class="avtra"><img src="{{staffList' value.avatar}}_2.jpg"></div>
	  								<h2>{{staffList' value.username}}<p>{{staffList' value.category}}</p></h2>
	  								</a>
	  								<!-- else -->
	  								<a href="/longleStatistics?cid={{staffList' value.cid}}&sid={{staffList' value.sid}}"><div class="avtra"><img src="{{staffList' value.avatar}}_2.jpg"></div>
	  								<h2>{{staffList' value.username}}<p>{{staffList' value.category}}</p></h2>
	  								</a>
	  								<!-- endif -->
	  								
	  							</li>
	  							<!-- endloop -->
	  						</ul>
	  					</div>
	  				</div>
	  				<div class="dateRecord">
						<div class="dateTab"><a href="/logStatistics" class="now">统计</a><a href="/index">记录</a></div>
						<div class="dateList autoHeightI1">
						<div class="chartTab"><ul class="tButton"><li  >
						<!-- if empty({{did}}) -->
						<a href="/logStatistics?cid={{cid}}">通信录</a>
						<!-- else -->
						<a href="/logStatistics?cid={{cid}}-{{did}}">通信录</a>
						<!-- endif -->
						</li><li class="now"><a  >锁</a></li></ul></div>
						
							<div class="warpCharts">
			        <!--图表1-->
			        <div id="chartContainer1" style="height: 300px; width: 100%;">
			        </div>
			        <!--图表1-->
			        <div class="clearfix">
			        
			        
			        <form action="/longleStatistics" id="LST" method="post">
			        
			        <div style="text-align:center">
			        <!-- if !empty({{sid}}) -->
			        	<select name="district" onchange="longleDi()">
			        		<!-- loop districtHtml -->
			        		<option <!-- if {{districtHtml' value.id}}=={{districtH}} --> selected <!-- endif --> value="{{districtHtml' value.id}}">{{districtHtml' value.name}}</option>
			        		<!-- endloop -->
			        		
			        	</select>
			        	 & 
			        	 <input type="hidden" name="sid" value="{{sid}}">
			        <!-- endif -->
				        <select  name="status" onchange="longleSt()">
					        <option <!-- if {{status}}==4 --> selected <!-- endif --> value="4">借出</option>
					        <option <!-- if {{status}}==5 --> selected <!-- endif --> value="5">销售</option>
					        <option <!-- if {{status}}==6 --> selected <!-- endif --> value="6">赠送</option>
				        </select>
			        </div>
			        <!--图表2-->
			        <div class="fL" id="chartContainer2" style="height: 300px; width: 50%;">
			        </div>
			        <!--图表2-->
			        <!--图表3-->
			        <div  class="fR"  id="chartContainer3" style="height: 300px; width: 50%;">
			        </div>
			        <!--图表3-->
			        </form>
			        
			        </div>
			        </div>
				  		</div>
	  				</div>
	  			</div>
	  		</div>
		</div>
	</div>
	
	
<script type="text/javascript">autoFlashHeight();</script>
<script type="text/javascript">
//         // 路径配置
//         require.config({
//             paths:{ 
//                 'echarts' : 'http://echarts.baidu.com/build/echarts'
//             }
//         });
        
//         // 使用
//         require(
//             [
//                 'echarts',
//                 'echarts/chart/pie', // 使用柱状图就加载bar模块，按需加载
//                 'echarts/chart/bar'
//             ],
//             function(ec) {
                //1 最近30天客户数量与记录趋势//
                // 基于准备好的dom，初始化echarts图表
                var myChart = echarts.init(document.getElementById('chartContainer1'));
                //var myChart = ec.init(document.getElementById('chartContainer1'));   
                var option = {
                          color:['#e9af68','#57b7b6','#e4575a','#959eac','#ffa500',
                          '#d38b70','#8fb7cf','#cd5c5c','#5c616b','#40e0d0',
                          '#1e90ff','#ff6347','#7b68ee','#00fa9a','#ffd700',
                          '#6699FF','#ff6666','#3cb371','#b8860b','#30e0e0'],
                          tooltip : {
                              trigger: 'axis',
                              formatter: "{b} <br/>{a}：{c} 位<br/>{a1}：{c1} 条"
                          },
                          legend: {
                              data:['借出','销售','赠送']
                          },
                          toolbox: {
                              show : true,
                              feature : {
                                  magicType : {show: true, type: ['line', 'bar']}
                              }
                          },
                          calculable : true,
                          xAxis : [
                              {
                                  type : 'category',
                                  boundaryGap : false,
                                  data : {{statisticsDay}}
                              }
                          ],
                          yAxis : [
                              {		color:'#000',
                                  type : 'value',
                                  axisLabel : {
                                      formatter: '{value}'
                                  },
                                  itemStyle: {
                                      normal: {
                                          lineStyle: {
                                              color:'#000000'
                                          }
                                      }
                                  },
                                  splitArea : {show : true}
                              }
                          ],
                          series : [
                              {
                                  name:'借出',
                                  type:'line',
                                  data:{{statisticsClient}},
											            markPoint : {
											                data : [
											                    {type : 'max', name: '最大值'},
											                    {type : 'min', name: '最小值'}
											                ]
											            },
                              },
                              {
                                  name:'销售',
                                  type:'line',
                                  data:{{statisticsLongle}},
                                  markPoint : {
											                data : [
											                    {type : 'max', name: '最大值'},
											                    {type : 'min', name: '最小值'}
											                ]
											            },
                              },
                              {
                                  name:'赠送',
                                  type:'line',
                                  data:{{statisticsGet}},
                                  markPoint : {
											                data : [
											                    {type : 'max', name: '最大值'},
											                    {type : 'min', name: '最小值'}
											                ]
											            },
                              },
                          ]
                      };
                    
                // 为echarts对象加载数据 
                myChart.setOption(option); 
                //1 最近30天客户数量与记录趋势//
                //2 最近30天客户数量地域//
                // 基于准备好的dom，初始化echarts图表
                 var myChart = echarts.init(document.getElementById('chartContainer2'));
               // var myChart = ec.init(document.getElementById('chartContainer2'));   
                var option = {                          
                	color:['#e9af68','#57b7b6','#e4575a','#959eac','#ffa500',
                          '#d38b70','#8fb7cf','#cd5c5c','#5c616b','#40e0d0',
                          '#1e90ff','#ff6347','#7b68ee','#00fa9a','#ffd700',
                          '#6699FF','#ff6666','#3cb371','#b8860b','#30e0e0'],
                          title : {
                              text: '30天锁地区分布',
                              textAlign:"left",
                              textStyle:{
																fontSize: 12, 
																color:"#666",
																fontWeight:"normal"
																}
                          },

    tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    toolbox: {
        show : true,
        feature : {
            dataView : {show: true, readOnly:true},
        }
    },      
    series : [
        {
            name:'锁所在地区',
            type:'pie',
            radius : '80%',
            center: ['50%', '50%'],
            data:{{statisticsLend}}
        }
    ]
};
                // 为echarts对象加载数据 
                myChart.setOption(option); 
                    
                //2 客户地区分布//
                //3 最近30天客户数量地域//
                // 基于准备好的dom，初始化echarts图表
                var myChart = ec.init(document.getElementById('chartContainer3'));   
                var option = {
                          title : {
                              text: '30天锁单位分布',
                              textAlign:"left",
                              textStyle:{
																fontSize: 12, 
																color:"#666",
																fontWeight:"normal"
																}
                          },
    tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    toolbox: {
        show : true,
        feature : {
            dataView : {show: true, readOnly:true},
        }
    },      
    series : [
       
        {
            name:'锁所在单位',
            type:'pie',
            radius : '80%',
            center: ['50%', '50%'],
            data:{{statisticsNature}}
        }
    ]
};
var ecConfig = require('echarts/config');
myChart.on(ecConfig.EVENT.PIE_SELECTED, function (param){
    var selected = param.selected;
    var serie;
    var str = '当前选择： ';
    for (var idx in selected) {
        serie = option.series[idx];
        for (var i = 0, l = serie.data.length; i < l; i++) {
            if (selected[idx][i]) {
                str += '【系列' + idx + '】' + serie.name + ' : ' + 
                       '【数据' + i + '】' + serie.data[i].name + ' ';
            }
        }
    }
    document.getElementById('wrong-message').innerHTML = str;
})
                    
                // 为echarts对象加载数据 
                myChart.setOption(option); 
                    
                //3 单位地区分布//                
//             }
//         );
        
        function longleSt(){
        	 var form = $('#LST'); 
        	// $('#districtLv').val(2);
        	 form.submit();  
        }
        
        function longleDi(){
        	 var form = $('#LST'); 
         	
         	 form.submit();  
        }
        
    </script>

<script>
    $('#cateselect').change(function(){
        window.location.href = "/longleStatistics?cid="+$(this).val();
    })
</script>
</body>