From d1f1b489eea7730bb1cb78cdae24c626db835298 Mon Sep 17 00:00:00 2001
From: jinpengyong <jpy123456>
Date: Thu, 30 Apr 2020 11:24:16 +0800
Subject: [PATCH] update
---
src/main/webapp/js/moralmap.js | 128 ++++++++++++++++++++----------------------
1 files changed, 61 insertions(+), 67 deletions(-)
diff --git a/src/main/webapp/js/moralmap.js b/src/main/webapp/js/moralmap.js
index 6031fd8..b0ed81a 100644
--- a/src/main/webapp/js/moralmap.js
+++ b/src/main/webapp/js/moralmap.js
@@ -46,7 +46,8 @@
moralMap.mapInit = function () {
var defaultParam = {
minZoom: 12,
- maxZoom: 20
+ maxZoom: 20,
+ enableMapClick: false
};
if (!!arguments[1]) {
$.extend(defaultParam, arguments[1]);
@@ -70,6 +71,11 @@
var myGeo = new BMap.Geocoder();
myGeo.getPoint(address, function (point) {
if (point) {
+ if ("���������" == cityName) {
+ var longitude = 113.30640743;
+ var latitude = 40.08256467;
+ var point = new BMap.Point(longitude, latitude);
+ }
map.centerAndZoom(point, showZoom);
} else {
alert("������������������������������������!");
@@ -310,26 +316,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);
}
@@ -410,7 +415,7 @@
break;
case 4:
state = 'state04';
- stateName = '������';
+ stateName = '������';
break;
}
return {
@@ -426,7 +431,7 @@
var url = option['url'];
url += "&pageNo=" + pageNo;
url += "&pageSize=" + pageSize;
- console.log(url);
+ // console.log(url);
$.ajax({
type: "get",
cache: false,
@@ -447,6 +452,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"];
@@ -466,9 +480,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>";
@@ -572,56 +586,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============================
//���������������
@@ -650,7 +643,6 @@
}
}
-
//���������mac���key������
//��������������� ������MoralMark������
moralMap.Equipment = function (option) {
@@ -836,10 +828,10 @@
}
moralMap.showSensors = function (jsonData) {
- if(!jsonData.hasOwnProperty('mac')){
+ if (!jsonData.hasOwnProperty('mac')) {
infoWindow.setContent("");
infoWindow.redraw();
- }else{
+ } 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']);
@@ -861,6 +853,9 @@
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>");
@@ -1058,17 +1053,16 @@
var deviceStates;
var monitorPointStates;
moralMap.refreshState = function (states) {
- if (!monitorPointStates) {
- monitorPointStates = states;
- deviceStates = [];
- for (var i in states) {
- var state = states[i];
- for (var j in state.devices) {
- var device = state.devices[j];
- deviceStates.push(device);
- }
+ monitorPointStates = states;
+ deviceStates = [];
+ for (var i in states) {
+ var state = states[i];
+ for (var j in state.devices) {
+ var device = state.devices[j];
+ deviceStates.push(device);
}
}
+ listView.refreshState(deviceStates);
for (var i in states) {
var state = states[i];
var mpoint = moralMap.getMpoint(state.id);
@@ -1087,4 +1081,4 @@
}
window.moralMap = moralMap;
-})(jQuery, BMap, window);
\ No newline at end of file
+})(jQuery, BMap, window);
--
Gitblit v1.8.0