From 1dfc2c2708fba01b771a2edd24c83363ee7c84d0 Mon Sep 17 00:00:00 2001 From: ZhuDongming <773644075@qq.com> Date: Thu, 09 Apr 2020 14:32:09 +0800 Subject: [PATCH] update设备跳转到实时界面 --- src/main/webapp/js/moralmap.js | 94 +++++++++++++------------------ src/main/webapp/view/map.jsp | 37 +++++------ src/main/webapp/img/list.png | 0 3 files changed, 57 insertions(+), 74 deletions(-) diff --git a/src/main/webapp/img/list.png b/src/main/webapp/img/list.png new file mode 100644 index 0000000..cc35d33 --- /dev/null +++ b/src/main/webapp/img/list.png Binary files differ diff --git a/src/main/webapp/js/moralmap.js b/src/main/webapp/js/moralmap.js index a37ce33..0ad00e8 100644 --- a/src/main/webapp/js/moralmap.js +++ b/src/main/webapp/js/moralmap.js @@ -315,26 +315,25 @@ return; } var equ = { - methodName: 'chart' == select ? 'showChart' : 'showDeviceMonitor', + methodName: 'showVoc' == select ? 'showVoc' : 'showDeviceMonitor', name: row['name'], mac: (row['mac']).toLowerCase(), longitude: row['longitude'], latitude: row['latitude'], monitorPointId: row['monitorPointId'], - version: row['deviceVersion']['version'] + version: row['deviceVersion']['version'], + provinceCode: row['monitorPoint']['provinceCode'] }; !!select ? equ['monitorPointId'] = row["monitorPointId"] : null; var equStr = JSON.stringify(equ); if (window["console"] != undefined) { - console.log(equStr); + // console.log(equStr); } if (!!window['external'] && !!window['external']['callWin']) { window['external'].callWin(equStr); } else { - if (!!select && select === 'chart' && !!window['external'] && !!window['external']['showChartInfo']) { + if (!!select && select === 'showVoc' && !!window['external'] && !!window['external']['showVocInfo']) { window['external'].showChartInfo(equStr); - } else if (!!window['external'] && !!window['external']['showMonitorInfo']) { - window['external'].showMonitorInfo(equStr); } else { alert(equStr); } @@ -431,7 +430,7 @@ var url = option['url']; url += "&pageNo=" + pageNo; url += "&pageSize=" + pageSize; - console.log(url); + // console.log(url); $.ajax({ type: "get", cache: false, @@ -452,6 +451,15 @@ var state = 'state01'; var stateName = ''; var s = e['state'] == undefined ? 0 : e['state']; + if (deviceStates) { + for (var j in deviceStates) { + var deviceState = deviceStates[j]; + if (deviceState.mac == e['mac']) { + s = deviceState.state; + break; + } + } + } var stateObj = _getStateMap(s); state = stateObj["state"]; stateName = stateObj["stateName"]; @@ -471,9 +479,9 @@ } name = name.substring(0, stop1) + "..." + name.substring(stop2, name.length); } - var li = "<li id='listview_item_" + e['mac'] + "'><span class='list-chart-span' onclick=moralMap.onItermClick(\"" + i + "\",'chart')><img src='/img/chart.png'></span>" + var li = "<li id='listview_item_" + e['mac'] + "'><span class='list-chart-span' onclick=moralMap.onItermClick(\"" + i + "\",'showVoc')><img src='/img/list.png' width='20px'></span>" + "<span id='listview_state_" + e['mac'] + "'class='" + state + "'>" + stateName + "</span>" + - "<div style='cursor: pointer;' onclick=moralMap.onItermClick(\"" + i + "\")>" + name + "</div></li>"; + "<div>" + name + "</div></li>"; outHtml += li; } outHtml += "</ul>"; @@ -577,56 +585,35 @@ var moralMarker = new moralMap.MoralMarker(option); // var mark =new BMap.Marker(pointObj,{icon:iconObj}); //==================infoWindow-start============================ - var infoWindow = (function () { - //��������������� - var winOpts = { - width: 110, // ������������������ - height: 80, // ������������������ - title: getTitleOutHtml(), // ������������������ - offset: new BMap.Size(-8, -5) //��������������������� - } - - function getTitleOutHtml() { - //title���������������... - var title = (option["name"] == null) ? "" : option["name"]; - if (title.length > 13) { - title = title.slice(0, 13) + "..."; - } - var titleOutHtml = ""; - titleOutHtml += "<p style='width:210px;font:bold 14px/16px arial,sans-serif;margin:0;color:#cc5522;white-space:nowrap;overflow:hidden'" - titleOutHtml += "title='" + option["name"] + "'>"; - titleOutHtml += title + "</p>"; - return titleOutHtml; - } - - function getAdressOutHtml() { - var address = (option["address"] == null) ? "" : option["address"]; - if (address.length > 18) { - address = address.slice(0, 18) + "..."; - } - var adressOutHtml = ""; - adressOutHtml += "<div onmouseover='moralMap.clearCloseInfoWindow()'"; - adressOutHtml += "onmouseout='moralMap.closeInfoWindow()'"; - adressOutHtml += " style='font:12px arial,sans-serif;margin-top:12px'><table cellspacing='0' style='overflow:hidden;table-layout:fixed;width:100%;font:12px arial,sans-serif'>"; - adressOutHtml += "<tbody><tr><td style='vertical-align:top;width:38px;white-space:nowrap;word-break:keep-all'>��������� </td><td style='line-height:16px'>"; - adressOutHtml += address + " "; - adressOutHtml += "</td></tr>"; - //adressOutHtml += "<tr><td style='width:98%;padding-top:10px;'colspan='2'><a href='javascript:void(0);' style='display:block;position: relative;float: right;' onclick='moralMap.showPointMonitor("+option.id+")'>������������>></a></td></tr>"; - adressOutHtml += "</tbody></table></div>"; - return adressOutHtml; - } - - return new BMap.InfoWindow(getAdressOutHtml(), winOpts); - })(); + var infoWindow; if (moralMarker["infoWindow"] == undefined) { moralMarker["infoWindow"] = infoWindow; } + //��������������������� - moralMarker.addEventListener("mouseover", function () { + moralMarker.addEventListener("click", function () { + var winOpts = { + width: 250, // ������������������ + height: 160, // ������������������ + // title: getTitleOutHtml(), // ������������������ + offset: new BMap.Size(-8, -5) //��������������������� + } + var winfowText = "<div style='width:250px'>"; + var title = (option["name"] == null) ? "" : option["name"]; + if (title.length > 13) { + title = title.slice(0, 13) + "..."; + } + winfowText += "<p style='width:210px;font:bold 14px/16px arial,sans-serif;margin:0;color:#cc5522;white-space:nowrap;overflow:hidden'" + winfowText += "title='" + option["name"] + "'>"; + winfowText += title + "</p>"; + var listText = '<div id="equ_list" class="listview" style="min-height:50px;overflow:auto;max-height:140px;" ></div>'; + winfowText = winfowText + listText + "</div>"; + var infoWindow = new BMap.InfoWindow(winfowText, winOpts); moralMap.openInfoWindow(infoWindow, this._point); //������������������ }); + moralMarker.addEventListener("mouseout", function () { - moralMap.closeInfoWindow(); + // moralMap.closeInfoWindow(); }); //==================infoWindow-end============================ //��������������� @@ -655,7 +642,6 @@ } } - //���������mac���key������ //��������������� ������MoralMark������ moralMap.Equipment = function (option) { @@ -1095,4 +1081,4 @@ } window.moralMap = moralMap; -})(jQuery, BMap, window); \ No newline at end of file +})(jQuery, BMap, window); diff --git a/src/main/webapp/view/map.jsp b/src/main/webapp/view/map.jsp index 8eeac9e..2e3442b 100644 --- a/src/main/webapp/view/map.jsp +++ b/src/main/webapp/view/map.jsp @@ -81,7 +81,7 @@ display: none; } - .listview { + /*.listview { overflow-x: hidden; overflow-y: auto; margin: 0; @@ -90,7 +90,7 @@ height: 390px; width: 92%; position: absolute; - } + }*/ .search_box { @@ -139,11 +139,10 @@ } .list li { - padding: 10px 0; border-bottom: 1px dotted #eee; - line-height: 40px; - height: 40px; - font-size: 20px; + line-height: 25px; + height: 25px; + font-size: 12px; /*cursor: pointer;*/ } @@ -154,14 +153,13 @@ border-radius: 4px; width: 40px; text-align: center; - height: 24px; - line-height: 24px; - font-size: 14px; + height: 20px; + line-height: 20px; + font-size: 12px; font-weight: bolder; - color: white; - margin: 10px 0; - padding: 2px 0; + color: lightgrey; margin-right: 8px; + margin-top: 2.5px; } .list .state00 { @@ -170,11 +168,9 @@ .list .state01 { background-color: #FF9; - color: #ff7f00; } .list .state02 { - background-color: #F93; } @@ -183,8 +179,6 @@ } .list .state04 { - /*background-color: #eee;*/ - /*color: #777 ;*/ background-color: #738d99; } @@ -351,10 +345,10 @@ <div class="charts_btn"> </div> </div> - <!-- <div class="search_box"> - <button id="searchBtn" type="button">������</button> - <textarea style="width: 200px;height:200px;" id="searchParam"></textarea> - </div>--> + <%-- <div class="search_box"> + <button id="searchBtn" type="button">������</button> + <textarea style="width: 200px;height:200px;" id="searchParam"></textarea> + </div>--%> <!-- <div id="popup_box"> <div id="equ_list" class="listview"> </div> @@ -373,6 +367,8 @@ var moralMap = window.moralMap; var params = $.parseJSON($("#mapParams").html()); moralMap['params'] = params; + var regionCode = params["regionCode"]; + var provinceCode = regionCode.toString().substring(0, 2) + "0000"; var mapType = getUrlParam("mapType"); var mapOption = {}; if (!!mapType && !!eval(mapType)) { @@ -751,6 +747,7 @@ function callJS(jsonData) { var jsonData = JSON.parse(jsonData); var methodName = jsonData.methodName; + // $("#searchParam").val(JSON.stringify(jsonData)); if ("JumpBaiduMap" == methodName) { moralMap.callJS(jsonData); } else if ("RefreshState" == methodName) { -- Gitblit v1.8.0