From 2bcbf240bd4419d01232967915295df61a8e1d84 Mon Sep 17 00:00:00 2001
From: kaiyu <404897439@qq.com>
Date: Mon, 19 Oct 2020 13:20:34 +0800
Subject: [PATCH] 删除测试websocket

---
 src/main/webapp/view/newmap.jsp |   84 ++++++++++++++++++++++++++++++++++++-----
 1 files changed, 73 insertions(+), 11 deletions(-)

diff --git a/src/main/webapp/view/newmap.jsp b/src/main/webapp/view/newmap.jsp
index 01abedf..4302057 100644
--- a/src/main/webapp/view/newmap.jsp
+++ b/src/main/webapp/view/newmap.jsp
@@ -317,8 +317,8 @@
 
     .tools_box {
         position: absolute;
-        height: 120px;
-        width: 400px;
+        height: 90px;
+        width: 90px;
         right: 1px;
         top: 20px;
         z-index: 1;
@@ -340,12 +340,51 @@
         background: url(/img/charts_btn_bg_2.png) left top no-repeat;
         background-size: 70%;
     }
+
+    .wind_explain {
+        position: absolute;
+        height: 200px;
+        width: 110px;
+        right: 1px;
+        top: 110px;
+        z-index: 1;
+    }
+
+    .wind_explain li {
+        height: 25px;
+    }
+
+    .wind_explain li span {
+        display: inline-block;
+        height: 25px;
+        line-height: 25px;
+    }
+
+    .wind_explain li img {
+        vertical-align: top;
+    }
 </style>
 <body>
+<div>
+</div>
+<textarea id="close" hidden></textarea>
+
 <div class="main_body">
     <div class="tools_box">
         <div class="charts_btn">
         </div>
+    </div>
+    <div class="wind_explain">
+        <ul>
+            <li><img src="/img/icoWind01.png" width="25" height="25"><span>1������</span></li>
+            <li><img src="/img/icoWind02.png" width="25" height="25"><span>2������</span></li>
+            <li><img src="/img/icoWind03.png" width="25" height="25"><span>3������</span></li>
+            <li><img src="/img/icoWind04.png" width="25" height="25"><span>4������</span></li>
+            <li><img src="/img/icoWind05.png" width="25" height="25"><span>5������</span></li>
+            <li><img src="/img/icoWind06.png" width="25" height="25"><span>6������</span></li>
+            <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 class="search_box">
          <button id="searchBtn" type="button">������</button>
@@ -367,12 +406,12 @@
     //���������������
     (function ($) {
         var hostAndPort = document.location.host;
-        var hostAddress = hostAndPort.substr(0, hostAndPort.length - 4);
         var moralMap = window.moralMap;
         var params = $.parseJSON($("#mapParams").html());
         moralMap['params'] = params;
         var orgId = params["orgId"];
         var regionCode = params["regionCode"];
+        var accountId = params["accountId"];
         var provinceCode = regionCode.toString().substring(0, 2) + "0000";
         var mapType = getUrlParam("mapType");
         var mapOption = {};
@@ -487,10 +526,25 @@
                                 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);
-                        var moralDeviceWind = new moralMap.Device(obj);
                         moralMap.addOverlay(moralMask);
-                        moralMap.addOverlay(moralDeviceWind);
+                        if (obj['hasWindInfo'] && obj['state'] != 4) {
+                            var moralDeviceWind = new moralMap.Device(obj);
+                            moralMap.addOverlay(moralDeviceWind);
+                        }
                     }
                 }
             }
@@ -644,24 +698,30 @@
         if (typeof (WebSocket) === "undefined") {
             alert("������������������������WebSocket");
         } else {
-            ws = new WebSocket('ws://' + hostAddress + '8080/screen/webSocket/' + orgId + '&' + 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 () {
+                $("#close").html("websocket������������");
             };
             //���������������������
             ws.onerror = function () {
+                $("#close").html("websocket������������");
             };
         }
 
@@ -770,6 +830,7 @@
     }
 
     function callJS(jsonData) {
+        $("#close").html(jsonData);
         var jsonData = JSON.parse(jsonData);
         var methodName = jsonData.methodName;
         // $("#searchParam").val(JSON.stringify(jsonData));
@@ -778,8 +839,9 @@
         } else if ("RefreshState" == methodName) {
             var states = jsonData.states;
             moralMap.refreshState(states);
-        } else if ("DeliverSensors" == methodName) {
-            // moralMap.showSensors(jsonData);
+        } else if ("CloseMq" == methodName) {
+            $("#close").html(methodName);
         }
     }
+
 </script>

--
Gitblit v1.8.0