|
@@ -0,0 +1,219 @@
|
|
|
+ //时间
|
|
|
+ var timer = null;
|
|
|
+ function setTime(){
|
|
|
+ if(timer !== null){
|
|
|
+ clearTimeout(timer);
|
|
|
+ }
|
|
|
+ setTimeout(function () {
|
|
|
+ $("#date").text(getTime()[0]);
|
|
|
+ $("#time").text(getTime()[1] +" "+ getTime()[2]);
|
|
|
+ setTime();
|
|
|
+ },1000);
|
|
|
+ }
|
|
|
+ setTime();
|
|
|
+
|
|
|
+ //legend 生成图例
|
|
|
+ function createLegend() {
|
|
|
+ var html = '';
|
|
|
+ html += '<div class="legend-content" onmouseover="$(this).css(\'cursor\',\'pointer\');showCityOpt();" onmouseout="hideCityOpt();"><span><img src="icon/legend.png"/>运维区域</span></div>';
|
|
|
+ html += '<div class="legend-content">';
|
|
|
+ html += '<span><input type="checkbox" id="pets_distribute" /><label for="pets_distribute" style="font-size: 14px;">宠物分布</label></span>';
|
|
|
+ html += '<span><input type="checkbox" id="pets_hospital" /><label for="pets_hospital" style="font-size: 14px;">宠物医院</label></span>';
|
|
|
+ html += '<span><input type="checkbox" id="pets_vaccine" /><label for="pets_vaccine" style="font-size: 14px;">疫苗注射点</label></span>';
|
|
|
+ html += '<span><input type="checkbox" id="pets_service" /><label for="pets_service" style="font-size: 14px;">上牌服务点</label></span>';
|
|
|
+ html += '</div>';
|
|
|
+ // 选择城市
|
|
|
+ html += '<div id="cityOpt" onmouseover="showCityOpt()" onmouseout="hideCityOpt()">';
|
|
|
+ cityData.map(function(e){
|
|
|
+ html += "<ul class='city-item'><li>";
|
|
|
+ // 地市级
|
|
|
+ html += "<a href='javascript:void(0)' class='city-choose city' data-city-id='"+e.code+"'>"+ e.name +"</a>";
|
|
|
+ e.areas.map(function(el){
|
|
|
+ // 县区
|
|
|
+ html += "<a href='javascript:void(0)' class='city-choose county' data-city-id='"+el.code+"'>"+ el.name +"</a>";
|
|
|
+ })
|
|
|
+ html += "</li></ul>";
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ html += '</div>';
|
|
|
+ $("body #position_top").append(html);
|
|
|
+
|
|
|
+ initStyle();
|
|
|
+ }
|
|
|
+
|
|
|
+ createLegend();
|
|
|
+
|
|
|
+ // 设置悬浮图标Css
|
|
|
+ function initStyle() {
|
|
|
+ var window_w = $(window).width();
|
|
|
+ var position_left_w = $('#position_left').width();
|
|
|
+ var position_right_w = $('#position_right').width();
|
|
|
+
|
|
|
+ if ( window_w < 1200 + 40 ) {
|
|
|
+ $('#position_top').css({left:"10px",width:"99%"});
|
|
|
+ $('#position_left').css({top:"150px"});
|
|
|
+ $('#position_right').css({top:"150px"});
|
|
|
+ } else {
|
|
|
+ $('#position_top').css({left: (position_left_w + 20) +"px",width: (window_w - position_left_w - position_right_w - 40) +"px"});
|
|
|
+ $('#position_left').css({top:"90px"});
|
|
|
+ $('#position_right').css({top:"90px"});
|
|
|
+ }
|
|
|
+ $('#cityOpt').css({left:(position_left_w + 20) +"px"});
|
|
|
+ }
|
|
|
+
|
|
|
+ // 窗口尺寸改变
|
|
|
+ $(window).resize(function(e){
|
|
|
+ initStyle();
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ //生成卡片
|
|
|
+ // 数据统计
|
|
|
+ var zhzb =
|
|
|
+ '<ul>' +
|
|
|
+ '<li><span class="zhzb-li-name">已备案宠物<span class="typeStyle">(只)</span></span><span class="zhzb-li-num">653212</span></li>' +
|
|
|
+ '<li><span class="zhzb-li-name">宠物医院<span class="typeStyle">(所)</span></span><span class="zhzb-li-num">' + hospitalData.length + '</span></li>' +
|
|
|
+ '<li><span class="zhzb-li-name">疫苗注射点<span class="typeStyle">(个)</span></span><span class="zhzb-li-num">4213</span></li>' +
|
|
|
+ '<li><span class="zhzb-li-name">上牌服务点<span class="typeStyle">(个)</span></span><span class="zhzb-li-num">108</span></li>' +
|
|
|
+ '</ul>';
|
|
|
+
|
|
|
+ var zzb = new CreateTip({
|
|
|
+ parentId: "position_left",
|
|
|
+ id:"zongzhibiao",
|
|
|
+ titleName:"数据统计",
|
|
|
+ icon:"icon/statistics.png",
|
|
|
+ width: "100%",
|
|
|
+// html:zhzb
|
|
|
+ });
|
|
|
+ zzb.setData(zhzb);
|
|
|
+
|
|
|
+// 犬种统计图
|
|
|
+var species = '<div id="specie_pie"></div>';
|
|
|
+var specieObj = new CreateTip({
|
|
|
+ parentId: "position_left",
|
|
|
+ id: "species",
|
|
|
+ titleName: "犬种统计图",
|
|
|
+ icon: "icon/pie.png",
|
|
|
+ width: "100%",
|
|
|
+});
|
|
|
+specieObj.setData(species);
|
|
|
+
|
|
|
+var specie_pie = echarts.init(document.getElementById('specie_pie'));
|
|
|
+var specie_pie_option = {
|
|
|
+ textStyle: {
|
|
|
+ color: "#fff",
|
|
|
+ },
|
|
|
+ title: {
|
|
|
+ // text: '某站点用户访问来源',
|
|
|
+ // subtext: '纯属虚构',
|
|
|
+ left: 'center'
|
|
|
+ },
|
|
|
+ tooltip: {
|
|
|
+ trigger: 'item',
|
|
|
+ formatter: '{a} <br/>{b} : {c} ({d}%)'
|
|
|
+ },
|
|
|
+ legend: {
|
|
|
+ // orient: 'vertical',
|
|
|
+ left: 'left',
|
|
|
+ data: ['直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎'],
|
|
|
+ textStyle: {
|
|
|
+ color: "#fff",
|
|
|
+ }
|
|
|
+ },
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ name: '访问来源',
|
|
|
+ type: 'pie',
|
|
|
+ radius: '55%',
|
|
|
+ center: ['50%', '60%'],
|
|
|
+ data: [
|
|
|
+ {value: 335, name: '直接访问'},
|
|
|
+ {value: 310, name: '邮件营销'},
|
|
|
+ {value: 234, name: '联盟广告'},
|
|
|
+ {value: 135, name: '视频广告'},
|
|
|
+ {value: 1548, name: '搜索引擎'}
|
|
|
+ ],
|
|
|
+ emphasis: {
|
|
|
+ itemStyle: {
|
|
|
+ shadowBlur: 10,
|
|
|
+ shadowOffsetX: 0,
|
|
|
+ shadowColor: 'rgba(0, 0, 0, 0.5)'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+};
|
|
|
+specie_pie.setOption(specie_pie_option);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //详细指标
|
|
|
+ var xxzb = '<div id="qybxspm"></div>';
|
|
|
+ var xzb = new CreateTip({
|
|
|
+ parentId: "position_right",
|
|
|
+ id:"xxzb",
|
|
|
+ titleName:"上牌排行榜",
|
|
|
+ icon:"icon/statistics.png",
|
|
|
+ width:"100%",
|
|
|
+// html:xxzb
|
|
|
+ });
|
|
|
+ xzb.setData(xxzb);
|
|
|
+
|
|
|
+ var qybxspm = new CreateSpeed({
|
|
|
+ id:"qybxspm",
|
|
|
+ icon:"icon/fix.png",
|
|
|
+ // title:"上牌排行",
|
|
|
+ max:1300
|
|
|
+ });
|
|
|
+ qybxspm.setData([
|
|
|
+ {"name":"中部","data":1123,"color":"#55DAED"},
|
|
|
+ {"name":"东部","data":904,"color":"#55B6ED"},
|
|
|
+ {"name":"西部","data":845,"color":"#3F80D2"},
|
|
|
+ {"name":"北部","data":756,"color":"#2B5DB8"},
|
|
|
+ {"name":"南部","data":684,"color":"#1864E3"}
|
|
|
+ ]);
|
|
|
+
|
|
|
+// 寻宠轮播
|
|
|
+var search_pets = "";
|
|
|
+if (searchPetsData.length == 0) {
|
|
|
+ search_pets += '<p style="color: #fff; text-align: center;">暂无数据</p>';
|
|
|
+} else {
|
|
|
+
|
|
|
+ searchPetsData.forEach(function(item, index){
|
|
|
+ let text = item.decribe || '';
|
|
|
+ if (text.length > 96) {
|
|
|
+ text = text.slice(0,96) + '...';
|
|
|
+ }
|
|
|
+ search_pets += "<div class='pets-carousel-item' " + ((searchPetsIndex != index) ? "style='display:none'" : '') + ">";
|
|
|
+ search_pets += "<div class='pets-search-info'>";
|
|
|
+ search_pets += "<img src='"+item.photo+"' alt='宠物图片' width='120px' height='120px' />";
|
|
|
+ search_pets += "<div class='pets-info'>"
|
|
|
+ + "<span>宠物名称:" +item.name + "</span>"
|
|
|
+ + "<span>设备编号:" +item.deviceNumber+ "</span>"
|
|
|
+ + "<span>发布人:" +item.userName + "</span>"
|
|
|
+ + "<span>联系电话:" +item.phone+ "</span>"
|
|
|
+ + "<span>丢失地点:" +item.address+ "</span></div>";
|
|
|
+ search_pets += "</div>";
|
|
|
+ search_pets += "<div class='pets-describe'>"+text+"</div>";
|
|
|
+ search_pets += "</div>";
|
|
|
+ });
|
|
|
+
|
|
|
+}
|
|
|
+var xcObj = new CreateTip({
|
|
|
+ parentId: "position_right",
|
|
|
+ id: "search_pets",
|
|
|
+ titleName: "寻宠信息",
|
|
|
+ icon: "icon/alarm.png",
|
|
|
+ width: "100%"
|
|
|
+});
|
|
|
+xcObj.setData(search_pets);
|
|
|
+
|
|
|
+// 显示/隐藏城市
|
|
|
+function showCityOpt() {
|
|
|
+ $('#cityOpt').show();
|
|
|
+}
|
|
|
+function hideCityOpt() {
|
|
|
+ $('#cityOpt').hide();
|
|
|
+}
|