From e9dbaf20d3f26e565f796ed489553a81d43e4f9f Mon Sep 17 00:00:00 2001
From: wr1207 <wyun001@163.com>
Date: 星期四, 14 九月 2023 15:04:42 +0800
Subject: [PATCH] 修复移动端查询和bug

---
 mobile/js/widget_search_view.js |   81 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 79 insertions(+), 2 deletions(-)

diff --git a/mobile/js/widget_search_view.js b/mobile/js/widget_search_view.js
index 80216a1..13a994d 100644
--- a/mobile/js/widget_search_view.js
+++ b/mobile/js/widget_search_view.js
@@ -26,6 +26,7 @@
     //寮�濮嬫煡璇㈡暟鎹�
     changeQindexSelection();
 }
+updateRegionSelect()
 monitortype();
 reloadData(1);
 
@@ -35,6 +36,7 @@
     current_selected_monitor_type=$("#querySelect").val(); //鑾峰彇Select閫夋嫨鐨刅alue
     // var checkIndex=$("#select_id ").get(0).selectedIndex; //鑾峰彇Select閫夋嫨鐨勭储寮曞��
     // var maxIndex=$("#select_id option:last").attr("index"); //鑾峰彇Select鏈�澶х殑绱㈠紩鍊�
+    updateRegionSelect()
     monitortype();
     reloadData(1);
 
@@ -44,8 +46,6 @@
 $("#regionSelect").change(function(){
     //code...
     current_selected_monitor_street=$("#regionSelect").val(); //鑾峰彇Select閫夋嫨鐨刅alue
-    // var checkIndex=$("#select_id ").get(0).selectedIndex; //鑾峰彇Select閫夋嫨鐨勭储寮曞��
-    // var maxIndex=$("#select_id option:last").attr("index"); //鑾峰彇Select鏈�澶х殑绱㈠紩鍊�
     monitortype();
     reloadData(1);
 }); //涓篠elect娣诲姞浜嬩欢锛屽綋閫夋嫨鍏朵腑涓�椤规椂瑙﹀彂
@@ -98,6 +98,13 @@
         current_selected_monitor_qindex = "tsp";
     } else {
         options = Object.keys(qindex_range_list_1004_and_other);
+    }
+    if(current_selected_monitor_type == 1005 || current_selected_monitor_type ==100500) {
+        $("#newname_a").empty();
+        $("#newname_a").html('鍚嶇О-灞炴��');
+    } else {
+        $("#newname_a").empty();
+        $("#newname_a").html('鍚嶇О');
     }
     options.forEach(element => $("#qindex_selection").append("<option value='" + element + "'>" + element + "</option>"));
 }
@@ -231,4 +238,74 @@
         html += '<li><a href="javascript:reloadData(' + (currpage < pageNum ? currpage + 1 : pageNum ) + ')" rel="external nofollow" >&gt;</a></li>';
     }
     return html;
+}
+
+function updateRegionSelect() {
+    let datatime_, querytype_ ;
+    if(current_selected_monitor_type == 1005 || current_selected_monitor_type ==100500) {
+        $("#regionSelect").empty();
+        $("#regionSelect").append(`<option value="">涓婃捣甯�</option>`); //涓篠elect杩藉姞涓�涓狾ption(涓嬫媺椤�)
+        $("#regionSelect").append(`<option value="榛勬郸鍖�">榛勬郸鍖�</option>`); //涓篠elect杩藉姞涓�涓狾ption(涓嬫媺椤�)
+        $("#regionSelect").append(`<option value="娴︿笢鏂板尯">娴︿笢鏂板尯</option>`); //涓篠elect杩藉姞涓�涓狾ption(涓嬫媺椤�)
+        $("#regionSelect").append(`<option value="闈欏畨鍖�">闈欏畨鍖�</option>`); //涓篠elect杩藉姞涓�涓狾ption(涓嬫媺椤�)
+        $("#regionSelect").append(`<option value="闀垮畞鍖�">闀垮畞鍖�</option>`); //涓篠elect杩藉姞涓�涓狾ption(涓嬫媺椤�)
+        $("#regionSelect").append(`<option value="寰愭眹鍖�">寰愭眹鍖�</option>`); //涓篠elect杩藉姞涓�涓狾ption(涓嬫媺椤�)
+        $("#regionSelect").append(`<option value="闂佃鍖�">闂佃鍖�</option>`); //涓篠elect杩藉姞涓�涓狾ption(涓嬫媺椤�)
+        $("#regionSelect").append(`<option value="铏瑰彛鍖�">铏瑰彛鍖�</option>`); //涓篠elect杩藉姞涓�涓狾ption(涓嬫媺椤�)
+        $("#regionSelect").append(`<option value="鏉ㄦ郸鍖�">鏉ㄦ郸鍖�</option>`); //涓篠elect杩藉姞涓�涓狾ption(涓嬫媺椤�)
+        $("#regionSelect").append(`<option value="瀹濆北鍖�">瀹濆北鍖�</option>`); //涓篠elect杩藉姞涓�涓狾ption(涓嬫媺椤�)
+        $("#regionSelect").append(`<option value="鍢夊畾鍖�">鍢夊畾鍖�</option>`); //涓篠elect杩藉姞涓�涓狾ption(涓嬫媺椤�)
+        $("#regionSelect").append(`<option value="闈掓郸鍖�">闈掓郸鍖�</option>`); //涓篠elect杩藉姞涓�涓狾ption(涓嬫媺椤�)
+        $("#regionSelect").append(`<option value="鏉炬睙鍖�">鏉炬睙鍖�</option>`); //涓篠elect杩藉姞涓�涓狾ption(涓嬫媺椤�)
+        $("#regionSelect").append(`<option value="閲戝北鍖�">閲戝北鍖�</option>`); //涓篠elect杩藉姞涓�涓狾ption(涓嬫媺椤�)
+        $("#regionSelect").append(`<option value="濂夎搐鍖�">濂夎搐鍖�</option>`); //涓篠elect杩藉姞涓�涓狾ption(涓嬫媺椤�)
+        $("#regionSelect").append(`<option value="宕囨槑鍖�">宕囨槑鍖�</option>`); //涓篠elect杩藉姞涓�涓狾ption(涓嬫媺椤�)
+        $("#regionSelect").append(` <option value="鏅檧鍖�">鏅檧鍖�</option>`); //涓篠elect杩藉姞涓�涓狾ption(涓嬫媺椤�)
+        return;
+    }
+    if ($("#appDateHour")[0].style.display == 'none') {
+        datatime_ = document.getElementById("appDate").value + ' 00:00:00';
+        querytype_ = 'day';
+    } else { 
+        datatime_ = document.getElementById("appDateHour").value;
+        querytype_ = 'hour';
+    }
+    var backend_url = default_system_params.nodejs_url_predix + "dataapi/Bdata?bid=mobile_count_" + current_selected_monitor_type + "_by_district&datatype=" + querytype_ 
+        + "&datatime=" + datatime_ 
+        + "&userid="+localStorage.getItem('user_id_')
+        + "&pageno=1&pagesize=50";
+    console.log(`current selected:${current_selected_monitor_street}`);
+    $.ajax({
+        type: 'get',
+        dataType: 'json',
+        data: {},
+        async: false,//鍚屾
+        url: backend_url,
+        success: function (data) {
+            let regionStat = data.data.result;
+            if (regionStat != null) {
+                $("#regionSelect").empty();
+                for (var i = 0; i < regionStat.length; i++) {
+                    let obj = regionStat[i];
+                    select_strict = current_selected_monitor_street.length >0 ? current_selected_monitor_street : '涓婃捣甯�';
+                    if(obj.region == select_strict) {
+                        $("#regionSelect").prepend(`<option value='${obj.region !='' ? obj.region : ''}' selected>${obj.region}(${obj.region !='涓婃捣甯�' ? obj.num : ''})</option>`); //涓篠elect鎻掑叆涓�涓狾ption(绗竴涓綅缃�)
+                    } else {
+                        $("#regionSelect").append(`<option value='${obj.region !='涓婃捣甯�' ? obj.region : ''}'>${obj.region}(${obj.region !='涓婃捣甯�' ? obj.num : ''})</option>`); //涓篠elect杩藉姞涓�涓狾ption(涓嬫媺椤�)
+                    }
+                }
+                // $("#regionSelect").prepend("<option value='0'>璇烽�夋嫨</option>"); //涓篠elect鎻掑叆涓�涓狾ption(绗竴涓綅缃�)
+                // $("#regionSelect option:last").remove(); //鍒犻櫎Select涓储寮曞�兼渶澶ption(鏈�鍚庝竴涓�)
+                // $("#regionSelect option[index='0']").remove(); //鍒犻櫎Select涓储寮曞�间负0鐨凮ption(绗竴涓�)
+                // $("#regionSelect option[value='3']").remove(); //鍒犻櫎Select涓璙alue='3'鐨凮ptiona
+                // $("#regionSelect option[text='4']").remove(); //鍒犻櫎Select涓璗ext='4'鐨凮ptiona
+            }
+        },
+        error: function (request, textStatus) {
+        }
+    });
+    
+    
+
+
 }
\ No newline at end of file

--
Gitblit v1.9.1