From 153144cbee10bb4999242bc62358ffe63ca9ceb9 Mon Sep 17 00:00:00 2001 From: jinpengyong <jpy123456> Date: Tue, 07 Jul 2020 09:30:04 +0800 Subject: [PATCH] update --- src/main/webapp/view/pollutionsource.jsp | 152 +++++++++++++++++++++++++++++++++----------------- 1 files changed, 100 insertions(+), 52 deletions(-) diff --git a/src/main/webapp/view/pollutionsource.jsp b/src/main/webapp/view/pollutionsource.jsp index 6671e9b..927aa8c 100644 --- a/src/main/webapp/view/pollutionsource.jsp +++ b/src/main/webapp/view/pollutionsource.jsp @@ -104,7 +104,7 @@ top: 30px; right: 50px; display: inline-block; - width: 80px; + width: 100px; height: 40px; border-width: 0px; border-radius: 3px; @@ -122,8 +122,8 @@ <body> <div class="main_body"> - <input type="button" id="show" value="������"/> - <div id="cpm">������������������</div> + <input type="button" id="show" value="������������"/> + <div id="cpm"></div> <div id="mapCanvas"></div> <!-- ������������ --> <!-- ���sensorInfo,regionCode,regionName,monitorPoint,device--> <div id="pollutionSourceParams" style="display: none;"> @@ -162,7 +162,9 @@ var marker = new BMap.Marker(point, {icon: icon, offset: new BMap.Size(0, -20)}); map.addOverlay(marker); map.centerAndZoom(point, 16); - if (!$.isEmptyObject(dirPoint) && !$.isEmptyObject(getPollutionSourceData) && typeof (getPollutionSourceData["e6"]) != "undefined" && typeof (getPollutionSourceData["e7"]) != "undefined" && typeof (getPollutionSourceData["e18"]) != "undefined" && typeof (getPollutionSourceData["e23"]) != "undefined" && getPollutionSourceData["e18"] > 0.03) { + var humidity = 0; + var temperature = 0; + if (!$.isEmptyObject(dirPoint) && !$.isEmptyObject(getPollutionSourceData) && typeof (getPollutionSourceData["e18"]) != "undefined" && typeof (getPollutionSourceData["e23"]) != "undefined" && getPollutionSourceData["e18"] != 0) { var windSpeed = parseFloat(getPollutionSourceData["e18"]); var windDir = parseFloat(getPollutionSourceData["e23"]); var distance = windSpeed * 3600; @@ -192,16 +194,20 @@ $("#show").one('click', function () { setTimeout(function () { - if ($.isEmptyObject(dirPoint) || $.isEmptyObject(getPollutionSourceData) || typeof (getPollutionSourceData["e6"]) == "undefined" || typeof (getPollutionSourceData["e7"]) == "undefined" || typeof (getPollutionSourceData["e18"]) == "undefined" || typeof (getPollutionSourceData["e23"]) == "undefined" || getPollutionSourceData["e18"] <= 0.03) { + if ($.isEmptyObject(dirPoint) || $.isEmptyObject(getPollutionSourceData) || typeof (getPollutionSourceData["e18"]) == "undefined" || typeof (getPollutionSourceData["e23"]) == "undefined" || getPollutionSourceData["e18"] === 0) { showNoData(); } else { - var humidity = parseFloat(getPollutionSourceData["e6"]); - var temperature = parseFloat(getPollutionSourceData["e7"]); + if (typeof (getPollutionSourceData["e6"]) != "undefined") { + humidity = parseFloat(getPollutionSourceData["e6"]); + } + if (typeof (getPollutionSourceData["e7"]) != "undefined") { + temperature = parseFloat(getPollutionSourceData["e7"]); + } var windSpeed = parseFloat(getPollutionSourceData["e18"]); var windDir = parseFloat(getPollutionSourceData["e23"]); var selectSensorKey = getPollutionSourceData["selectSensorKey"]; var markerDir = new BMap.Marker(dirPoint); - lab = new BMap.Label("���������������������������</br>" + selectSensorKey + "������������", { + lab = new BMap.Label("���������������������������������������������</br>" + selectSensorKey + "������", { position: dirPoint, offset: new BMap.Size(20, -40) }); @@ -314,49 +320,54 @@ map.addOverlay(oval); }, 500); - var winfowTextCause = "<p style='height: 44px;line-height: 22px'>���������������������������������������������������������������������������������������������������������������������</p>"; + var winfowTextCause = "<p style='height: 22px;line-height: 22px'>������������������������������������������������������������������</p>"; var winfowTextSource; var supplement; - if (month == 12 || month == 1 || month == 2) { - if (windSpeed >= 3.4) { - supplement = "���������������������������������������������������������������������������"; + if (selectSensorKey == "������") { + winfowTextCause = "<p style='height: 44px;line-height: 22px'>���������������������������������������������������������������������������������������������������������������������������������������������</p>"; + winfowTextSource = "<p style='height: 22px;line-height: 22px'>NOx������VOCs������������</p>"; + } else { + if (month == 12 || month == 1 || month == 2) { + if (windSpeed >= 3.4) { + supplement = "���������������������������������������������������������������������������"; + } + if (humidity >= 90.0) { + supplement = "������������������������������������������������������������������������"; + } else { + supplement = ""; + } + winfowTextSource = "<p style='height: 22px;line-height: 22px'>���������������������������������������������������������������������������������" + supplement + "</p>"; + } else if (month == 3 || month == 4 || month == 5) { + if (windSpeed >= 3.4) { + supplement = "���������������������������������������������������������������������������"; + } + if (humidity >= 90.0) { + supplement = "������������������������������������������������������������������������"; + } else { + supplement = ""; + } + winfowTextSource = "<p style='height: 22px;line-height: 22px'>���������������������������������������������������������������" + supplement + "</p>"; + } else if (month == 6 || month == 7) { + if (windSpeed >= 3.4) { + supplement = "������������������������������������"; + } + if (humidity >= 90.0) { + supplement = "���������������������������������������������������������������������������"; + } else { + supplement = ""; + } + winfowTextSource = "<p style='height: 22px;line-height: 22px'>���������������������������������������,���������������������" + supplement + "</p>"; + } else if (month == 8 || month == 9 || month == 10 || month == 11) { + if (windSpeed >= 3.4) { + supplement = "������������������������������������������"; + } + if (humidity >= 90.0) { + supplement = "������������������������������������������������������������������������"; + } else { + supplement = ""; + } + winfowTextSource = "<p style='height: 22px;line-height: 22px'>������������������������������������������������������������������������������������������������������" + supplement + "</p>"; } - if (humidity >= 90.0) { - supplement = "������������������������������������������������������������������������"; - } else { - supplement = ""; - } - winfowTextSource = "<p style='height: 22px;line-height: 22px'>���������������������������������������������������������������������������������" + supplement + "</p>"; - } else if (month == 3 || month == 4 || month == 5) { - if (windSpeed >= 3.4) { - supplement = "���������������������������������������������������������������������������"; - } - if (humidity >= 90.0) { - supplement = "������������������������������������������������������������������������"; - } else { - supplement = ""; - } - winfowTextSource = "<p style='height: 22px;line-height: 22px'>���������������������������������������������������������������" + supplement + "</p>"; - } else if (month == 6 || month == 7) { - if (windSpeed >= 3.4) { - supplement = "������������������������������������"; - } - if (humidity >= 90.0) { - supplement = "���������������������������������������������������������������������������"; - } else { - supplement = ""; - } - winfowTextSource = "<p style='height: 22px;line-height: 22px'>���������������������������������������,���������������������" + supplement + "</p>"; - } else if (month == 8 || month == 9 || month == 10 || month == 11) { - if (windSpeed >= 3.4) { - supplement = "������������������������������������������"; - } - if (humidity >= 90.0) { - supplement = "������������������������������������������������������������������������"; - } else { - supplement = ""; - } - winfowTextSource = "<p style='height: 22px;line-height: 22px'>������������������������������������������������������������������������������������������������������" + supplement + "</p>"; } var winfowText = '<div style="height:150px;" >'; @@ -470,10 +481,27 @@ } else if (windDir > 270 && windDir < 360) { windDirection = "���������"; } - lab = new BMap.Label("<P>������:" + temperature + "���</p><P>������:" + humidity + "%</p><P>������:" + windSpeed + "m/s</p><P>������:" + windDirection + "</p>", { - position: pointMiddle, - offset: new BMap.Size(-50, -40) - }); + if (temperature != 0 && humidity != 0) { + lab = new BMap.Label("<P>������:" + temperature + "���</p><P>������:" + humidity + "%</p><P>������:" + windSpeed + "m/s</p><P>������:" + windDirection + "</p>", { + position: pointMiddle, + offset: new BMap.Size(-50, -40) + }); + } else if (temperature == 0 && humidity != 0) { + lab = new BMap.Label("<P>������:" + humidity + "%</p><P>������:" + windSpeed + "m/s</p><P>������:" + windDirection + "</p>", { + position: pointMiddle, + offset: new BMap.Size(-50, -40) + }); + } else if (temperature != 0 && humidity == 0) { + lab = new BMap.Label("<P>������:" + temperature + "���</p><P>������:" + windSpeed + "m/s</p><P>������:" + windDirection + "</p>", { + position: pointMiddle, + offset: new BMap.Size(-50, -40) + }); + } else { + lab = new BMap.Label("<P>������:" + windSpeed + "m/s</p><P>������:" + windDirection + "</p>", { + position: pointMiddle, + offset: new BMap.Size(-50, -40) + }); + } lab.setStyle({ color: "#EE3B3B", fontSize: "16px", @@ -488,6 +516,26 @@ function showNoData() { map.centerAndZoom(point, 17); setTimeout(function () { + if (JSON.stringify(getPollutionSourceData) == JSON.stringify({})) { + document.getElementById("cpm").innerText = "���������������������������"; + } else { + if (getPollutionSourceData["e18"] === 0) { + document.getElementById("cpm").style.width = '380px'; + document.getElementById("cpm").innerText = "���������0���������������������"; + } + if (typeof (getPollutionSourceData["e18"]) == "undefined") { + document.getElementById("cpm").style.width = '400px'; + document.getElementById("cpm").innerText = "������������������������������������"; + } + if (typeof (getPollutionSourceData["e23"]) == "undefined") { + document.getElementById("cpm").style.width = '400px'; + document.getElementById("cpm").innerText = "������������������������������������"; + } + if (typeof (getPollutionSourceData["e18"]) == "undefined" && typeof (getPollutionSourceData["e23"]) == "undefined") { + document.getElementById("cpm").style.width = '500px'; + document.getElementById("cpm").innerText = "������������������������������������������������"; + } + } document.getElementById("cpm").style.display = 'block'; }, 250); }; -- Gitblit v1.8.0