From 6e0674202dc88b69a0fafc6631bc9a92889f2b3e Mon Sep 17 00:00:00 2001 From: kaiyu <404897439@qq.com> Date: Wed, 02 Dec 2020 15:11:28 +0800 Subject: [PATCH] 修改Webcontroller调用方法BUG --- src/main/webapp/view/newmap.jsp | 109 ++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 76 insertions(+), 33 deletions(-) diff --git a/src/main/webapp/view/newmap.jsp b/src/main/webapp/view/newmap.jsp index d3e7710..469610d 100644 --- a/src/main/webapp/view/newmap.jsp +++ b/src/main/webapp/view/newmap.jsp @@ -340,7 +340,8 @@ background: url(/img/charts_btn_bg_2.png) left top no-repeat; background-size: 70%; } - .wind_explain{ + + .wind_explain { position: absolute; height: 200px; width: 110px; @@ -348,21 +349,41 @@ top: 110px; z-index: 1; } - .wind_explain li{ + + .wind_explain li { height: 25px; } - .wind_explain li span{ + + .wind_explain li span { display: inline-block; height: 25px; line-height: 25px; } - .wind_explain li img{ + + .wind_explain li img { vertical-align: top; + } + #box { + overflow: auto; + width: 300px; + height: 400px; + top: 30px; + right: 30px; + position: absolute; + z-index: 1; + border: 1px solid gainsboro; + background-color: gainsboro; + opacity: 0.8; + display: none; } </style> <body> +<div> +</div> +<textarea id="close" hidden></textarea> + <div class="main_body"> - <div class="tools_box"> + <%-- <div class="tools_box"> <div class="charts_btn"> </div> </div> @@ -377,15 +398,14 @@ <li><img src="/img/icoWind07.png" width="25" height="25"><span>7������</span></li> <li><img src="/img/icoWind08.png" width="25" height="25"><span>8���������������</span></li> </ul> + </div>--%> + + <div id="box"> + <span id="tou">������������������</span> + <div id="box1" style="margin-top: 15px"></div> </div> - <%-- <div class="search_box"> - <button id="searchBtn" type="button">������</button> - <textarea style="width: 300px;height:400px;" id="searchParam"></textarea> - </div>--%> - <!-- <div id="popup_box"> - <div id="equ_list" class="listview"> - </div> - </div> --> + <div class="pp1" style="display:none;" ></div> + <div class="pp2" style="display:none;" ></div> <div id="mapCanvas"></div> <div id="mapParams" style="display: none;"> ${requestScope.mapParams} @@ -396,14 +416,17 @@ </html> <script> //��������������� + var orgId; + var regionCode; + var accountId; (function ($) { var hostAndPort = document.location.host; var moralMap = window.moralMap; var params = $.parseJSON($("#mapParams").html()); moralMap['params'] = params; - var orgId = params["orgId"]; - var regionCode = params["regionCode"]; - var accountId = params["accountId"]; + orgId = params["orgId"]; + regionCode = params["regionCode"]; + accountId = params["accountId"]; var provinceCode = regionCode.toString().substring(0, 2) + "0000"; var mapType = getUrlParam("mapType"); var mapOption = {}; @@ -416,7 +439,6 @@ //������������ var listView = moralMap.initListView({id: "#equ_list", pageSize: 12}); window["listView"] = listView; - //���������������������click������������ function showEqus(obj) { @@ -452,7 +474,6 @@ }); } }, 500); - } function loadOverlays(url, callback) { @@ -517,6 +538,19 @@ } else { alert(equStr); } + } + if ("���������" === obj["monitorPoint"]["description"]) { + var icon05 = new BMap.Icon("/img/ico05.png", new BMap.Size(50, 50)); + var mark05 = new BMap.Marker(new BMap.Point(obj["monitorPoint"]["longitude"], obj["monitorPoint"]["latitude"]), {icon: icon05}); + moralMap.addOverlay(mark05); + } else if ("���������" === obj["monitorPoint"]["description"]) { + var icon06 = new BMap.Icon("/img/ico06.png", new BMap.Size(50, 50)); + var mark06 = new BMap.Marker(new BMap.Point(obj["monitorPoint"]["longitude"], obj["monitorPoint"]["latitude"]), {icon: icon06}); + moralMap.addOverlay(mark06); + } else if ("���������" === obj["monitorPoint"]["description"]) { + var icon08 = new BMap.Icon("/img/ico08.png", new BMap.Size(50, 50)); + var mark08 = new BMap.Marker(new BMap.Point(obj["monitorPoint"]["longitude"], obj["monitorPoint"]["latitude"]), {icon: icon08}); + moralMap.addOverlay(mark08); } var moralMask = new moralMap.Equipment(obj); moralMap.addOverlay(moralMask); @@ -677,30 +711,35 @@ if (typeof (WebSocket) === "undefined") { alert("������������������������WebSocket"); } else { - ws = new WebSocket('ws://' + hostAndPort + '/screen/webSocket/' + orgId + '&' + accountId+'_'+regionCode); + ws = new WebSocket('ws://' + hostAndPort + '/screen/webSocket/' + orgId + '&' + accountId + '_' + regionCode); ws.onopen = function () { }; - //������������������ ws.onmessage = function (msg) { // $("#searchParam").val(JSON.parse(msg.data)); + // moralMap.getRoad(JSON.parse(JSON.parse(msg.data)),regionCode); moralMap.refreshWindDir(JSON.parse(JSON.parse(msg.data))); - /* if (moralMap.showSensors && typeof (moralMap.showSensors) == "function") { - moralMap.showSensors(JSON.parse(JSON.parse(msg.data))); - }*/ + /* if (moralMap.showSensors && typeof (moralMap.showSensors) == "function") { + moralMap.showSensors(JSON.parse(JSON.parse(msg.data))); + }*/ + if ($("#close").html() == "CloseMq") { + ws.close(); + } + moralMap.showSensors(JSON.parse(JSON.parse(msg.data))); }; - //������������ - ws.onclose = function () { - }; - //��������������������� - ws.onerror = function () { - }; + //������������ + ws.onclose = function () { + $("#close").html("websocket������������"); + }; + //��������������������� + ws.onerror = function () { + $("#close").html("websocket������������"); + }; } })(jQuery); var _intervalNum = -1; - function startRefreshPage() { if (_intervalNum == -1) { _intervalNum = self.setInterval(function () { @@ -752,6 +791,7 @@ cache: false, async: true, success: function (data) { + console.log(data) if (data != null && typeof data === 'object') { var resultMap = data["extData"]; if (resultMap == null) { @@ -803,6 +843,7 @@ } function callJS(jsonData) { + $("#close").html(jsonData); var jsonData = JSON.parse(jsonData); var methodName = jsonData.methodName; // $("#searchParam").val(JSON.stringify(jsonData)); @@ -810,9 +851,11 @@ moralMap.callJS(jsonData); } else if ("RefreshState" == methodName) { var states = jsonData.states; - moralMap.refreshState(states); - } else if ("DeliverSensors" == methodName) { - moralMap.showSensors(jsonData); + $(".pp1").html(JSON.stringify(states)) + moralMap.refreshState(states,orgId,regionCode,accountId); + } else if ("CloseMq" == methodName) { + $("#close").html(methodName); } } + </script> -- Gitblit v1.8.0