From afc782bf0610a55eae2e27b7d4e0ecb4565451ea Mon Sep 17 00:00:00 2001
From: qinbo <qinbo@shsening.com>
Date: 星期二, 16 十一月 2021 20:19:12 +0800
Subject: [PATCH] bug fix

---
 data/getLayerListByUserid.json   |    2 +-
 widgetsTS/widget_detail/view.js  |   18 ++++++++++--------
 widgetsTS/widget_summary/view.js |   13 +++++--------
 widgetsTS/widget_search/view.js  |    5 +++++
 4 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/data/getLayerListByUserid.json b/data/getLayerListByUserid.json
index 576a3bf..375f110 100644
--- a/data/getLayerListByUserid.json
+++ b/data/getLayerListByUserid.json
@@ -45,7 +45,7 @@
             "style_prefix":"",
             "style_selected":"pm25",
             "styleoptions": ["pm25", "pm10", "no", "no2", "nox", "co"],
-            "show":false
+            "show":true
         },
         {
             "id": 1005,
diff --git a/widgetsTS/widget_detail/view.js b/widgetsTS/widget_detail/view.js
index 48f8c1d..9ca06cb 100644
--- a/widgetsTS/widget_detail/view.js
+++ b/widgetsTS/widget_detail/view.js
@@ -316,6 +316,11 @@
             var tableData = data.data.result;
             if (tableData != null && tableData.length > 0) {
                 var topObj = tableData[0];
+                for (var key in topObj) {
+                    if (topObj[key] == null || topObj[key] == 'null' || topObj[key] == undefined || topObj[key] == 'undefined') {
+                        topObj[key] = "/";
+                    }
+                  }
                 var _tr = "<tr  onmouseover='over(this)' onmouseout='out(this)'><td>1</td><td>code</td><td>缂栫爜</td><td>" + topObj.code + "</td><td>/</td></tr>"
                 $("#indexTb").append(_tr);
                 _tr = "<tr  onmouseover='over(this)' onmouseout='out(this)' ><td>2</td><td>name</td><td>鍚嶇О</td><td>" + topObj.name + "</td><td>/</td></tr>"
@@ -323,17 +328,9 @@
                 _tr = "<tr  onmouseover='over(this)' onmouseout='out(this)' ><td>3</td><td>datatime</td><td>鏃堕棿</td><td>" + topObj.datatime + "</td><td>/</td></tr>"
                 $("#indexTb").append(_tr);
                 _tr = "<tr  onmouseover='over(this)' onmouseout='out(this)' ><td>4</td><td>lon</td><td>缁忓害</td><td>" + topObj.lon + "</td><td>/</td></tr>"
-                if (topObj.lon == undefined){
-                    $("#indexTb").append("<tr  onmouseover='over(this)' onmouseout='out(this)' ><td>5</td><td>lat</td><td>缁忓害</td><td>" + '/' + "</td><td>/</td></tr>");
-                }else{
                     $("#indexTb").append(_tr);
-                }
                 _tr = "<tr  onmouseover='over(this)' onmouseout='out(this)' ><td>5</td><td>lat</td><td>绾害</td><td>" + topObj.lat + "</td><td>/</td></tr>"
-                if (topObj.lat == undefined){
-                    $("#indexTb").append("<tr  onmouseover='over(this)' onmouseout='out(this)' ><td>5</td><td>lat</td><td>绾害</td><td>" + '/' + "</td><td>/</td></tr>");
-                }else{
                     $("#indexTb").append(_tr);
-                }
                 var tmp_index = 6;
                 for(var p in topObj){//閬嶅巻json瀵硅薄鐨勬瘡涓猭ey/value瀵�,p涓簁ey
                     if (p!=='code' && p!=='name' && p!=='datatime' && p!=='lon' && p!=='lat'){
@@ -372,6 +369,11 @@
                 for (var i = 0; length = tableData.length, i < length; i++) {
                     var j = i + 1;
                     var topObj = tableData[i]; 
+                    for (var key in topObj) {
+                        if (topObj[key] == null || topObj[key] == 'null' || topObj[key] == undefined || topObj[key] == 'undefined') {
+                            topObj[key] = "/";
+                        }
+                      }
                     var _tr = "<tr onmouseover='over(this)' onmouseout='out(this)' ><td>" + j + "</td><td onclick='locateAndShowDetail(this)'>" + topObj.road_id + "</td><td>" + topObj.name + "</td><td>"+ topObj.pm25 + "</td><td>" + topObj.pm10 + "</td><td>" + topObj.no + "</td><td>" + topObj.nox + "</td><td>" + topObj.no2 + "</td><td>" + topObj.co +"</td></tr>"
                     $("#indexTb").append(_tr);
                 }
diff --git a/widgetsTS/widget_search/view.js b/widgetsTS/widget_search/view.js
index 8995403..211d016 100644
--- a/widgetsTS/widget_search/view.js
+++ b/widgetsTS/widget_search/view.js
@@ -126,6 +126,11 @@
             for(var i=((page-1)*10);i<(page*10)&&i<newsTotalNum;i++){
                 var j = i+1; 
                 var topObj = tableData[i];
+                for (var key in topObj) {
+                    if (topObj[key] == null || topObj[key] == 'null' || topObj[key] == undefined || topObj[key] == 'undefined') {
+                        topObj[key] = "/";
+                    }
+                  }
                 var content = "<tr _siteid='" + topObj.code + "' _lon='" + topObj.lon + "' _lat='" + topObj.lat + "' onmouseover='over(this)' onmouseout='out(this)' ><td><input type='checkbox' name='selectedItem' value='" + j + "' /></td><td>" + j + "</td><td onclick='locateAndShowDetail(this)'>" + topObj.code + "</td><td onclick='locateAndShowDetail(this)'>" + topObj.name + "</td><td><font color='" + getLayerPointColorByQindexandValue(current_selected_monitor_type, current_selected_monitor_qindex, topObj[current_selected_monitor_qindex]) + "'>" + topObj[current_selected_monitor_qindex] + "</font></td></tr>"
                 $("#searchInfo").append(content);
             }
diff --git a/widgetsTS/widget_summary/view.js b/widgetsTS/widget_summary/view.js
index 1bbd612..c2d262f 100644
--- a/widgetsTS/widget_summary/view.js
+++ b/widgetsTS/widget_summary/view.js
@@ -106,16 +106,13 @@
                 for (var i = 0; length = tmpTopListQueryResult.length, i < length; i++) {
                     var j = i + 1;
                     var topObj = tmpTopListQueryResult[i];
-                    if (topObj[current_selected_monitor_qindex] == null) {
-                        var _tr = "<tr _siteid='" + topObj.code + "' _lon='" + topObj.lon + "' _lat='" + topObj.lat + "' onmouseover='over(this)' onmouseout='out(this)' ><td><input type='checkbox' name='selectedItem' value='" + j + "' /></td><td>" + j + "</td><td onclick='locateAndShowDetail(this)'>" + topObj.code + "</td><td onclick='locateAndShowDetail(this)'>" + topObj.name + "</td><td><font color='" + getLayerPointColorByQindexandValue(current_selected_monitor_type, current_selected_monitor_qindex, topObj[current_selected_monitor_qindex]) + "'>" + "/" + "</font></td></tr>"
-                        $("#top10Tb").append(_tr);
-                    } else if (topObj.name == undefined) {
-                        var _tr = "<tr _siteid='" + topObj.code + "' _lon='" + topObj.lon + "' _lat='" + topObj.lat + "' onmouseover='over(this)' onmouseout='out(this)' ><td><input type='checkbox' name='selectedItem' value='" + j + "' /></td><td>" + j + "</td><td onclick='locateAndShowDetail(this)'>" + topObj.code + "</td><td onclick='locateAndShowDetail(this)'>" + "/" + "</td><td><font color='" + getLayerPointColorByQindexandValue(current_selected_monitor_type, current_selected_monitor_qindex, topObj[current_selected_monitor_qindex]) + "'>" + topObj[current_selected_monitor_qindex] + "</font></td></tr>"
-                        $("#top10Tb").append(_tr);
-                    } else {
+                    for (var key in topObj) {
+                        if (topObj[key] == null || topObj[key] == 'null' || topObj[key] == undefined || topObj[key] == 'undefined') {
+                            topObj[key] = "/";
+                        }
+                      }
                         var _tr = "<tr _siteid='" + topObj.code + "' _lon='" + topObj.lon + "' _lat='" + topObj.lat + "' onmouseover='over(this)' onmouseout='out(this)' ><td><input type='checkbox' name='selectedItem' value='" + j + "' /></td><td>" + j + "</td><td onclick='locateAndShowDetail(this)'>" + topObj.code + "</td><td onclick='locateAndShowDetail(this)'>" + topObj.name + "</td><td><font color='" + getLayerPointColorByQindexandValue(current_selected_monitor_type, current_selected_monitor_qindex, topObj[current_selected_monitor_qindex]) + "'>" + topObj[current_selected_monitor_qindex] + "</font></td></tr>"
                         $("#top10Tb").append(_tr);
-                    }
                 }
             } else {
                 haoutil.msg("鏌ヨ鏃犳暟鎹紝璇锋洿鎹㈡煡璇㈡潯浠讹紒");

--
Gitblit v1.9.1