From 013f480082d982b7542bfd812edb0913882ecbe4 Mon Sep 17 00:00:00 2001
From: ZhuDongming <773644075@qq.com>
Date: Wed, 04 Dec 2019 17:21:33 +0800
Subject: [PATCH] update

---
 src/main/webapp/js/moralmap.js |   71 ++++++++++++++++-------------------
 1 files changed, 32 insertions(+), 39 deletions(-)

diff --git a/src/main/webapp/js/moralmap.js b/src/main/webapp/js/moralmap.js
index f4b025b..6031fd8 100644
--- a/src/main/webapp/js/moralmap.js
+++ b/src/main/webapp/js/moralmap.js
@@ -654,23 +654,15 @@
     //���������mac���key������
     //��������������� ������MoralMark������
     moralMap.Equipment = function (option) {
-        var sensorsMap;
+        var sensorsDescriptionMap;
         var sensorsUnitMap;
         $.ajax({
             url: "getSensorsMap?mac=" + option['mac'],
             type: "get",
             dataType: "json",
             success: function (data) {
-                sensorsMap = data.data;
-            }
-        });
-
-        $.ajax({
-            url: "getSensorsUnitMap?mac=" + option['mac'],
-            type: "get",
-            dataType: "json",
-            success: function (data) {
-                sensorsUnitMap = data.data;
+                sensorsDescriptionMap = data[0];
+                sensorsUnitMap = data[1];
             }
         });
 
@@ -844,39 +836,40 @@
             }
 
             moralMap.showSensors = function (jsonData) {
-                var address = (option["address"] == null) ? "" : option["address"];
-                if (address.length > 18) {
-                    address = address.slice(0, 18) + "...";
-                }
-                var adressOutHtml = '<div style="min-height:20px;overflow:auto;max-height:400px;font-size: 12px;" onmouseover="moralMap.clearCloseInfoWindow()" onmouseout="moralMap.closeInfoWindow()">';
-                var y, m, d, h, mm, s;
-                var date = new Date(jsonData['time']);
-                y = 1900 + date.getYear();
-                m = "0" + (date.getMonth() + 1);
-                d = "0" + date.getDate();
-                h = "0" + date.getHours();
-                mm = "0" + date.getMinutes();
-                s = "0" + date.getSeconds();
-                date = y + "-" + m.substring(m.length - 2, m.length) + "-" + d.substring(d.length - 2, d.length) + " " + h.substring(h.length - 2, h.length) + ":" + mm.substring(mm.length - 2, mm.length) + ":" + s.substring(s.length - 2, s.length);
-                adressOutHtml += '<p style="height: 18px;line-height: 18px">' + "���������&nbsp;" + date + "&nbsp;</p>";
-                for (var prop in jsonData) {
-                    if (jsonData.hasOwnProperty(prop) && prop != 'ver' && prop != 'methodName' && prop != 'mac' && prop != 'time') {
-                        for (var key in sensorsMap) {
-                            if (prop == key) {
-                                var sensorsDescription = sensorsMap[key];
+                if(!jsonData.hasOwnProperty('mac')){
+                    infoWindow.setContent("");
+                    infoWindow.redraw();
+                }else{
+                    var adressOutHtml = '<div style="min-height:20px;overflow:auto;max-height:400px;font-size: 12px;" onmouseover="moralMap.clearCloseInfoWindow()" onmouseout="moralMap.closeInfoWindow()">';
+                    var y, m, d, h, mm, s;
+                    var date = new Date(jsonData['time']);
+                    y = 1900 + date.getYear();
+                    m = "0" + (date.getMonth() + 1);
+                    d = "0" + date.getDate();
+                    h = "0" + date.getHours();
+                    mm = "0" + date.getMinutes();
+                    s = "0" + date.getSeconds();
+                    date = y + "-" + m.substring(m.length - 2, m.length) + "-" + d.substring(d.length - 2, d.length) + " " + h.substring(h.length - 2, h.length) + ":" + mm.substring(mm.length - 2, mm.length) + ":" + s.substring(s.length - 2, s.length);
+                    adressOutHtml += '<p style="height: 18px;line-height: 18px">' + "���������&nbsp;" + date + "&nbsp;</p>";
+                    for (var prop in jsonData) {
+                        if (jsonData.hasOwnProperty(prop) && prop != 'ver' && prop != 'methodName' && prop != 'mac' && prop != 'time') {
+                            for (var key in sensorsDescriptionMap) {
+                                if (prop == key) {
+                                    var sensorsDescription = sensorsDescriptionMap[key];
+                                }
                             }
-                        }
-                        for (var key in sensorsUnitMap) {
-                            if (prop == key) {
-                                var sensorsUnit = sensorsUnitMap[key];
+                            for (var key in sensorsUnitMap) {
+                                if (prop == key) {
+                                    var sensorsUnit = sensorsUnitMap[key];
+                                }
                             }
+                            adressOutHtml += ('<p style="height: 18px;line-height: 18px">' + sensorsDescription + "���" + jsonData[prop] + sensorsUnit + "</p>");
                         }
-                        adressOutHtml += ('<p style="height: 18px;line-height: 18px">' + sensorsDescription + "���" + jsonData[prop] + sensorsUnit + "</p>");
                     }
+                    adressOutHtml += "</div>";
+                    infoWindow.setContent(adressOutHtml);
+                    infoWindow.redraw();
                 }
-                adressOutHtml += "</div>";
-                infoWindow.setContent(adressOutHtml);
-                infoWindow.redraw();
             }
             /*   if (!$.isEmptyObject(sensorInfo)) {
                    moralMap.openInfoWindow(infoWindow, this._point); //������������������

--
Gitblit v1.8.0