Commit ed0cd486d8903df3a88c1230b927b7fc4b2c7d75

Authored by 潘钊
1 parent 9142c5ae

实时监控页面布局

src/main/resources/static/pages/mapmonitor/real/css/real.css
... ... @@ -9,6 +9,10 @@
9 9 user-select:none;
10 10 }
11 11  
  12 +.z-depth-1{
  13 + box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);
  14 +}
  15 +
12 16 .z-depth-2 {
13 17 box-shadow: 0 8px 17px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
14 18 }
... ... @@ -39,6 +43,7 @@
39 43 right: 10px;
40 44 background-color: #3B3F51;
41 45 top: 98px;
  46 + padding-top: 15px;
42 47  
43 48 transition: all .5s ease;
44 49  
... ... @@ -58,6 +63,35 @@
58 63 height: calc(100% - 110px);
59 64 }
60 65  
  66 +.mapRightWrap.search{
  67 + height: 47px;
  68 + padding-top: 0;
  69 +}
  70 +
  71 +.mapRightWrap.search .input-group .input-group-btn button{
  72 + color: #FFFFFF;
  73 + background-color: #1BBC9B;
  74 + border-color: #1BBC9B;
  75 +}
  76 +
  77 +.mapRightWrap.search .input-group .input-group-btn button:hover{
  78 + background-color: #158f76;
  79 + border-color: #13866f;
  80 +}
  81 +
  82 +.mapRightWrap.search .input-group input{
  83 + height: 48px;
  84 + background-color: #626775;
  85 + border: 1px solid #626775;
  86 + color: white;
  87 +}
  88 +
  89 +.mapRightWrap.search .input-group-btn button{
  90 + height: 48px;
  91 + width: 80px;
  92 + font-size: 15px;
  93 +}
  94 +
61 95 .rotate0{
62 96 transform:rotateY(0deg) !important;
63 97 }
... ... @@ -274,7 +308,131 @@ html{
274 308 -webkit-transform: translate(-50%, -50%);
275 309 }
276 310  
277   -/* gaode style */
  311 +.mapRightWrap.vehicle p.head{
  312 + color: #C0BDBD;
  313 + font-size: 21px;
  314 + border-bottom: 1px solid gray;
  315 + padding-left: 15px;
  316 + position: relative;
  317 +}
  318 +
  319 +/* .mapRightWrap.vehicle p.head:hover{
  320 + box-shadow: 0 8px 17px 0 rgba(128, 123, 123, 0.2),0 6px 20px 0 rgba(86, 67, 67, 0.19);
  321 +}
  322 + */
  323 +.mapRightWrap.vehicle p.head>span.icon>a{
  324 + position: absolute;
  325 + right: 15px;
  326 + top: -2px;
  327 + font-size: 24px;
  328 + color: #B9B9B9;
  329 +
  330 + transition: all .5s ease;
  331 +
  332 +}
  333 +
  334 +.mapRightWrap.vehicle p.head>span.icon>a.rotate{
  335 + transform:rotate(180deg);
  336 +}
  337 +
  338 +
  339 +.mapRightWrap.vehicle p.head>span.icon>a:hover{
  340 + color: #D8D5D5;
  341 +}
  342 +
  343 +.mapRightWrap.vehicle .vehicle-item{
  344 + position: relative;
  345 + color: #C7C7C7;
  346 + padding-left: 8px;
  347 + background: rgb(88, 94, 121);
  348 + padding-top: 7px;
  349 + width: 90%;
  350 + margin: auto;
  351 + margin-top: 9px;
  352 +}
  353 +
  354 +.mapRightWrap.vehicle .vehicle-item div.text{
  355 + padding: 5px 0 11px 5px;
  356 + color: #B2B2B2;
  357 + -webkit-user-select: initial;
  358 +}
  359 +
  360 +.mapRightWrap.vehicle .vehicle-item div.text span{
  361 + padding: 5px 7px;
  362 + color: #eee;
  363 + cursor: pointer;
  364 +}
  365 +
  366 +.mapRightWrap.vehicle .vehicle-item div.text span:hover{
  367 + color: #C8C8C8;
  368 +}
  369 +
  370 +.mapRightWrap.vehicle .vehicle-item div.text span i{
  371 + font-size: 12px;
  372 +}
  373 +
  374 +.mapRightWrap.vehicle .vehicle-item.online div.text span i{
  375 + color: #45D245;
  376 +}
  377 +
  378 +/* off line */
  379 +.mapRightWrap.vehicle .vehicle-item.offline div.text span i,
  380 +.mapRightWrap.vehicle .vehicle-item.offline div.text span,
  381 +.mapRightWrap.vehicle .vehicle-item.offline div.text{
  382 + color: #FF737C;
  383 +}
  384 +
  385 +.mapRightWrap.vehicle .vehicle-item div.icon{
  386 + position: absolute;
  387 + right: 15px;
  388 + top: 10px;
  389 + cursor: pointer;
  390 +}
  391 +
  392 +.mapRightWrap.vehicle .vehicle-item div.icon:hover{
  393 + color: #fafafa;
  394 +}
  395 +
  396 +
  397 +.mapRightWrap .search_result{
  398 + position: absolute;
  399 + background: rgba(98, 103, 117, 0.91);
  400 + width: 100%;
  401 + top: 60px;
  402 + color: #e5e5e5;
  403 +}
  404 +
  405 +.mapRightWrap .search_result .result_item{
  406 + padding-left: 10px;
  407 + margin: 0;
  408 + padding: 10px;
  409 + cursor: pointer;
  410 +}
  411 +
  412 +.mapRightWrap .search_result .result_item:hover{
  413 + background: #60A798;
  414 + color: #fff;
  415 +}
  416 +
  417 +.mapRightWrap .search_result .result_item:hover span.sub_text{
  418 + color: #eee;
  419 +}
  420 +
  421 +.mapRightWrap .search_result .result_item span.sub_text{
  422 + color: #BBBABA;
  423 + margin-left: 5px;
  424 +}
  425 +
  426 +.mapRightWrap .search_result .item_vehicle_list{
  427 + margin-bottom: 20px;
  428 + border-bottom: 1px solid #F3F5F5;
  429 +}
  430 +
  431 +.mapRightWrap .search_result .item_vehicle{
  432 + color: #fafcfb;
  433 +}
  434 +
  435 +/* GaoDe style start------- */
278 436 .mapRightWrap.gaode{
279 437 background: #fff;
280 438 border-radius: 5px !important;
... ... @@ -290,7 +448,7 @@ html{
290 448 }
291 449  
292 450 .mapTools.gaode .item.active {
293   - color: #ddd;
  451 + color: #e1e5ec;
294 452 }
295 453  
296 454 .leftUtils.gaode{
... ... @@ -312,3 +470,74 @@ html{
312 470 content: "\f00c";
313 471 font: normal normal normal 14px/1 FontAwesome;
314 472 }
  473 +
  474 +.mapRightWrap.gaode.vehicle .vehicle-item{
  475 + background: #fdfdfd;
  476 + color: #2D2929;
  477 +}
  478 +
  479 +.mapRightWrap.gaode.vehicle .vehicle-item div.text {
  480 + color: #999;
  481 +}
  482 +
  483 +.mapRightWrap.gaode.vehicle .vehicle-item div.text span {
  484 + color: #000;
  485 +}
  486 +
  487 +.mapRightWrap.gaode.vehicle p.head{
  488 + border-bottom: 1px solid #e5e5e5;
  489 + color: #7D7777;
  490 +}
  491 +
  492 +.mapRightWrap.vehicle.gaode p.head>span.icon>a{
  493 + color: #999;
  494 +}
  495 +
  496 +.mapRightWrap.vehicle.gaode p.head>span.icon>a:hover{
  497 + color: #555555;
  498 +}
  499 +
  500 +.mapRightWrap.vehicle.gaode .vehicle-item.offline div.text span i,
  501 +.mapRightWrap.vehicle.gaode .vehicle-item.offline div.text span,
  502 +.mapRightWrap.vehicle.gaode .vehicle-item.offline div.text{
  503 + color: #e43a45;
  504 +}
  505 +
  506 +.mapRightWrap.search.gaode .input-group input{
  507 + background-color: #fafafa;
  508 + border: 1px solid #fafafa;
  509 + color: #333333;
  510 +}
  511 +
  512 +.mapRightWrap.search.gaode .input-group .input-group-btn button{
  513 + background-color: #3598dc;
  514 + border-color: #3598dc;
  515 +}
  516 +
  517 +.mapRightWrap.search.gaode .input-group .input-group-btn button:hover{
  518 + background-color: #217ebd;
  519 + border-color: #1f78b5;
  520 +}
  521 +
  522 +.mapRightWrap.gaode .search_result{
  523 + background: rgba(250, 250, 250, 0.9);
  524 + color: #333333;
  525 +}
  526 +
  527 +.mapRightWrap.gaode .search_result .item_vehicle_list{
  528 + border-bottom: 1px solid #C7C7C7;
  529 +}
  530 +
  531 +.mapRightWrap.gaode .search_result .item_vehicle{
  532 + color: #333333;
  533 +}
  534 +
  535 +.mapRightWrap.gaode .search_result .result_item span.sub_text{
  536 + color: #8E8D8D;
  537 +}
  538 +
  539 +.mapRightWrap.gaode .search_result .result_item:hover{
  540 + background: #ddd;
  541 + color: #333333;
  542 +}
  543 +/* GaoDe style end------- */
315 544 \ No newline at end of file
... ...
src/main/resources/static/pages/mapmonitor/real/js/map_platform.js
... ... @@ -14,9 +14,14 @@ var realMap = (function() {
14 14  
15 15 var storage = window.localStorage;
16 16  
  17 + var currentMap;
  18 +
  19 + var city = "上海";
  20 +
17 21 var real_map = {
18   - currentMap : {},
19   - mapName : '',
  22 + getMap: function(){
  23 + return currentMap;
  24 + },
20 25 init: function(){
21 26 var m = storage.getItem('real_map');
22 27 if(m && m == REAL_GAODE_TEXT)
... ... @@ -24,11 +29,11 @@ var realMap = (function() {
24 29 else
25 30 real_map.baidu.init();
26 31 },
  32 + //百度地图
27 33 baidu : {
  34 + //初始化
28 35 init : function() {
29   - var r = real_map;
30   -
31   - r.setText(REAL_BAIDU_TEXT);
  36 + real_map.setText(REAL_BAIDU_TEXT);
32 37  
33 38 var map = new BMap.Map(mapContainer[0]);
34 39 //中心点和缩放级别
... ... @@ -39,7 +44,7 @@ var realMap = (function() {
39 44 layer.closeAll();
40 45 storage.setItem('real_map', REAL_BAIDU_TEXT);
41 46 });
42   -
  47 +
43 48 // 路况控件
44 49 var ctrl = new BMapLib.TrafficControl();
45 50 map.addControl(ctrl);
... ... @@ -56,17 +61,63 @@ var realMap = (function() {
56 61 });
57 62  
58 63 $('#tcWrap.maplibTc').addClass('animated bounceInLeft');
59   -
60   - r.currentMap = map;
61   - r.mapName = REAL_BAIDU_TEXT;
  64 + $('.maplibTcBtn_deskTop.anchorTR').remove();
  65 +
  66 + //保存当前地图实例和名称
  67 + currentMap = {
  68 + map: map,
  69 + mapName: REAL_BAIDU_TEXT,
  70 + fName : 'baidu'
  71 + }
  72 +
62 73 },
63 74 change : function() {
  75 + if(currentMap.mapName == REAL_BAIDU_TEXT)
  76 + return;
  77 +
64 78 showMsg(REAL_BAIDU_TEXT);
65 79  
66 80 real_map.destroy();
67 81 real_map.baidu.init();
  82 + },
  83 + autocomplete: function(input, cb){
  84 + var ac = new BMap.Autocomplete({
  85 + 'location' : realMap.getMap().map,
  86 + 'input': input,
  87 + 'onSearchComplete': function(result){
  88 + //隐藏默认的提示框
  89 + ac.hide();
  90 + cb && cb({type: 'baidu', result: result.wr});
  91 + }
  92 + });
  93 +
  94 + $('#' + input).on('keyup', function(){
  95 + if(this.value == ''){
  96 + $('.search_result').html('');
  97 + return;
  98 + }
  99 + });
  100 +
  101 + },
  102 + setPlace: function(val){
  103 + var map = currentMap.map;
  104 + map.clearOverlays();
  105 + var local = new BMap.LocalSearch(map, {
  106 + onSearchComplete: function(){
  107 + var poi = local.getResults().getPoi(0);
  108 + if(!poi){
  109 + return;
  110 + }
  111 + var pp = poi.point;
  112 + map.centerAndZoom(pp, 18);
  113 + map.addOverlay(new BMap.Marker(pp));
  114 + }
  115 + });
  116 +
  117 + local.search(val);
68 118 }
69 119 },
  120 + //高德地图
70 121 gaode : {
71 122 init : function() {
72 123 var mapLoadAnim = '<div class="sk-cube-grid _center">'+
... ... @@ -83,9 +134,8 @@ var realMap = (function() {
83 134  
84 135 mapContainer.html(mapLoadAnim);
85 136  
86   - var r = real_map;
87   - r.gaode.setStyle();
88   - r.setText(REAL_GAODE_TEXT);
  137 + real_map.gaode.setStyle();
  138 + real_map.setText(REAL_GAODE_TEXT);
89 139  
90 140 var map = new AMap.Map(mapContainer[0]);
91 141 // 地图中心和缩放级别
... ... @@ -115,10 +165,18 @@ var realMap = (function() {
115 165 }
116 166 });
117 167  
118   - r.currentMap = map;
119   - r.mapName = REAL_GAODE_TEXT;
  168 + //保存当前地图实例和名称
  169 + currentMap = {
  170 + map: map,
  171 + mapName: REAL_GAODE_TEXT,
  172 + fName : 'gaode'
  173 + }
  174 +
120 175 },
121 176 change : function() {
  177 + if(currentMap.mapName == REAL_GAODE_TEXT)
  178 + return;
  179 +
122 180 showMsg(REAL_GAODE_TEXT);
123 181  
124 182 real_map.destroy();
... ... @@ -133,6 +191,38 @@ var realMap = (function() {
133 191 $('.mapRightWrap').removeClass('gaode');
134 192 $('.mapTools').removeClass('gaode');
135 193 $('.leftUtils').removeClass('gaode');
  194 + },
  195 + autocomplete: function(input, cb){
  196 +
  197 + AMap.plugin('AMap.Autocomplete',function(){
  198 + var autoOptions = {
  199 + city: city
  200 + };
  201 + autocomplete= new AMap.Autocomplete(autoOptions);
  202 +
  203 + $('#' + input).on('keyup', function(){
  204 + if(this.value == ''){
  205 + $('.search_result').html('');
  206 + return;
  207 + }
  208 + autocomplete.search(this.value, function(status, result){
  209 + cb & cb({type: 'gaode', result: result.tips});
  210 + });
  211 + });
  212 + });
  213 + },
  214 + setPlace: function(val){
  215 + var map = currentMap.map;
  216 +
  217 + AMap.plugin(['AMap.PlaceSearch'],function(){
  218 + var placeSearch = new AMap.PlaceSearch({
  219 + city:city,
  220 + map:map,
  221 + pageSize: 1
  222 + });
  223 +
  224 + placeSearch.search(val);
  225 + });
136 226 }
137 227 },
138 228 setText : function(text) {
... ... @@ -141,10 +231,12 @@ var realMap = (function() {
141 231 },
142 232 destroy : function() {
143 233 trafficBtn.unbind('click');
144   - var map = real_map.currentMap;
  234 +
  235 + //如果当前地图实例有destroy方法即执行
  236 + var map = currentMap.map;
145 237 map.destroy && map.destroy();
146 238  
147   - if (real_map.mapName == REAL_GAODE_TEXT) {
  239 + if (currentMap.mapName == REAL_GAODE_TEXT) {
148 240 // 如果前一个地图是高德,清除相关样式
149 241 real_map.gaode.clearStyle();
150 242 }
... ...
src/main/resources/static/pages/mapmonitor/real/js/real.js
1 1 !function() {
  2 + //css3动画结束事件
2 3 var animationend = 'webkitAnimationEnd animationend';
3   -
4   - var playAnimation;
5 4  
  5 + var playAnimation;
  6 + //地图右侧容器
6 7 var mrw = $('.mapRightWrap');
7   -
  8 + //加载动画
8 9 var spinnerLoad = '<div class="spinner">'
9 10 + ' <div class="rect1"></div>'
10 11 + ' <div class="rect2"></div>'
... ... @@ -12,22 +13,15 @@
12 13 + ' <div class="rect4"></div>'
13 14 + ' <div class="rect5"></div>'
14 15 + '</div>';
15   -
16 16  
17   - //加载车辆信息
18   - function jsQueryVehicle(){
19   - mrw.html(spinnerLoad);
20   - setTimeout(function() {
21   - mrw.html('').addClass('vehicle');
22   - }, 2000);
23   - }
24   -
25   - // mapRightWrap 还原
26   - function resetRotate(cb) {
  17 + // mapRightWrap 角度恢复
  18 + function resetRotate(cb, midCallback) {
27 19 mrw.one('transitionend', function() {
28 20 // 先取消transition ,将角度还原后再设置
29 21 $(this).css('transition', 'none').addClass('rotate0');
30 22  
  23 + midCallback && midCallback();
  24 +
31 25 setTimeout(function() {
32 26 mrw.css('transition', 'all .5s ease-in-out')
33 27 .removeClass('disable');
... ... @@ -53,6 +47,7 @@
53 47 $('.mapTools').addClass('disable');
54 48 $('.mapTools div.item.active').removeClass('active');
55 49 $(this).addClass('active');
  50 +
56 51 toolsEvent[$(this).data('click')]();
57 52 });
58 53  
... ... @@ -61,14 +56,13 @@
61 56 // 车辆
62 57 vehicle : function() {
63 58 toolsEvent.clearStyle();
64   - mrw.addClass('to_vehicle');
65   - resetRotate(jsQueryVehicle);
  59 + mrw.html('').addClass('to_vehicle vehicle');
  60 + resetRotate(null, vehiclePanel.showData);
66 61 },
67 62 search : function() {
68 63 toolsEvent.clearStyle();
69   - mrw.addClass('to_searchPanel');
70   -
71   - resetRotate();
  64 + mrw.html('').addClass('to_searchPanel search');
  65 + resetRotate(null, searchPanel.init);
72 66 },
73 67 notice : function() {
74 68 },
... ... @@ -76,7 +70,7 @@
76 70 },
77 71 clearStyle : function() {
78 72 mrw.removeClass(
79   - 'vehicle to_vehicle to_searchPanel rotate0');
  73 + 'vehicle search to_vehicle to_searchPanel rotate0');
80 74 }
81 75 };
82 76  
... ... @@ -92,22 +86,28 @@
92 86 // 地图容器高度
93 87 $('#mapContainer').height($(pjaxContainer).height() + 49);
94 88  
95   - jsQueryVehicle();
  89 + mrw.html(spinnerLoad);
96 90 init();
97 91  
98 92 function init(){
99   - try {
100   - realMap.init();
101   - } catch (e) {
102   - console.log('leay');
103   - setTimeout(function(){
  93 + //初始化地图
  94 + (function(){
  95 + var f = arguments.callee;
  96 + try {
104 97 realMap.init();
105   - }, 100);
106   - }
  98 + console.log('realMap');
  99 + } catch (e) {
  100 + setTimeout(f , 100);
  101 + }
  102 + })();
  103 + //初始化车辆列表
  104 + (function(){
  105 + var f = arguments.callee;
  106 + try {
  107 + vehiclePanel.showDataLazy();
  108 + } catch (e) {
  109 + setTimeout(f , 100);
  110 + }
  111 + })();
107 112 }
108   -
109   -/* setTimeout(function(){
110   - //清楚地图容器的加载动画(此时已被隐藏)
111   - $('.sk-cube-grid._center').remove();
112   - }, 3000);*/
113 113 }();
114 114 \ No newline at end of file
... ...
src/main/resources/static/pages/mapmonitor/real/real.html
... ... @@ -31,14 +31,24 @@
31 31 <div class="item" data-click="search">
32 32 <i class="fa fa-search"></i> &nbsp;搜索
33 33 </div>
34   - <div class="item" data-clikc="notice">
  34 + <div class="item" data-click="notice">
35 35 <i class="fa fa-bell-o"></i> &nbsp;通知
36 36 </div>
37 37 <div class="item" data-click="playBack">
38 38 <i class="fa fa-history"></i> &nbsp;回放
39 39 </div>
40 40 </div>
41   -<div class="mapRightWrap z-depth-3"></div>
  41 +
  42 +<div class="mapRightWrap z-depth-3 vehicle" >
  43 +</div>
  44 +
  45 +<div id="temps"></div>
42 46  
43 47 <script src="js/map_platform.js"></script>
  48 +<script src="js/vehicle.js"></script>
  49 +<script src="js/search.js"></script>
  50 +<script src="js/temp.js"></script>
44 51 <script src="js/real.js"></script>
  52 +<script>
  53 + console.log(111);
  54 +</script>
... ...