| | |
| | | //设备以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]; |
| | | } |
| | | }); |
| | | |
| | |
| | | } |
| | | |
| | | 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">' + "时间: " + date + " </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">' + "时间: " + date + " </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]; |
| | | if(sensorsUnit==null){ |
| | | sensorsUnit=""; |
| | | } |
| | | } |
| | | } |
| | | 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); //开启信息窗口 |