wr1207
2023-07-26 6f469bafb8add6aac7ffb39c4ac88fff019641ba
mobile/js/widget_search_view.js
@@ -1,9 +1,10 @@
'use script'; //开发环境建议开启严格模式
var current_selected_monitor_type = "1005";
var current_selected_monitor_name = "道路路段";
var current_selected_monitor_type = "1001";
var current_selected_monitor_name = "国控点";
var current_selected_monitor_keyword;
var current_selected_monitor_qindex = "pm25";
var current_selected_monitor_street = "";
var tableData;
@@ -23,11 +24,32 @@
//当前页面业务
function monitortype() {
    //开始查询数据
    current_selected_monitor_type = "1005";
    current_selected_monitor_name = "道路路段";
    changeQindexSelection();
}
monitortype();
$("#querySelect").change(function(){
    //code...
    current_selected_monitor_name=$("#querySelect").find("option:selected").text(); //获取Select选择的text
    current_selected_monitor_type=$("#querySelect").val(); //获取Select选择的Value
    // var checkIndex=$("#select_id ").get(0).selectedIndex; //获取Select选择的索引值
    // var maxIndex=$("#select_id option:last").attr("index"); //获取Select最大的索引值
    monitortype();
}); //为Select添加事件,当选择其中一项时触发
regionSelect
$("#regionSelect").change(function(){
    //code...
    current_selected_monitor_street=$("#regionSelect").val(); //获取Select选择的Value
    // var checkIndex=$("#select_id ").get(0).selectedIndex; //获取Select选择的索引值
    // var maxIndex=$("#select_id option:last").attr("index"); //获取Select最大的索引值
    monitortype();
    reloadData(1);
}); //为Select添加事件,当选择其中一项时触发
//加载count
function loadCountByUserid() {
@@ -81,18 +103,25 @@
}
function reloadData(page) {
    $("#pageID").append('');
    $("#page").append('');
    $("#searchInfo").empty();
    let datatime_, querytype_ ;
    let datatime_, querytype_,endtime_ ;
    if ($("#appDateHour")[0].style.display == 'none') {
        datatime_ = document.getElementById("appDate").value;
        datatime_ = document.getElementById("appDate").value + ' 00:00:00';
        querytype_ = 'day';
    } else { 
        datatime_ = document.getElementById("appDateHour").value;
        querytype_ = 'hour';
    }
    var avgnam = 50; //每页显示个数  
    var backend_url = default_system_params.nodejs_url_predix + "dataapi/Bdata?bid=get_" + current_selected_monitor_type + "_list_keyword&datatype=" + querytype_ + "&datatime=" + datatime_
        + "&qindex=" + current_selected_monitor_qindex + "&keyword=" + current_selected_monitor_keyword + "&pageno="+page+"&pagesize="+avgnam;
    var backend_url = default_system_params.nodejs_url_predix + "dataapi/Bdata?bid=mobile_get_" + current_selected_monitor_type + "_list_keyword&datatype=" + querytype_
        + "&datatime=" + datatime_
        + "&qindex=" + current_selected_monitor_qindex
        + "&keyword=" + current_selected_monitor_keyword
        + "&pageno="+page+"&pagesize="+avgnam
        + "&userid="+localStorage.getItem('user_id_')
        + "&region="+current_selected_monitor_street;
    $.ajax({
        type: "GET",
        url: backend_url,
@@ -100,15 +129,18 @@
        success: function (data) {
            tableData = data.data.result;
            if (current_selected_monitor_keyword == null) {
                haoutil.msg("请输入关键字!!!")
                // haoutil.msg("请输入关键字!!!")
                alert('请输入关键字!!!')
                return;
            }
            if (tableData == null) {
                haoutil.msg("请选择查询类别!!!")
                // haoutil.msg("请选择查询类别!!!")
                alert('请选择查询类别!!!')
                return;
            }
            if (tableData.length == 0) {
                haoutil.msg("无查询结果,请更换查询条件!")
                // haoutil.msg("无查询结果,请更换查询条件!")
                alert('无查询结果,请更换查询条件!');
                return;
            }
            var newsTotalNum = data.data.counter.counter; //记录的总条数
@@ -121,7 +153,13 @@
                        topObj[key] = "/";
                    }
                }
                var content = "<tr _siteid='" + topObj.code + "' _lon='" + topObj.lon + "' _lat='" + topObj.lat + "' onmouseover='over(this)' onmouseout='out(this)' ><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>"
                var content = "<tr _siteid='" + topObj.code + "' _lon='" + topObj.lon + "' _lat='" + topObj.lat
                    + "' onmouseover='over(this)' onmouseout='out(this)' ><td>" + j + "</td><td onclick='locateAndShowDetail(this)'>"
                    + topObj.region + "</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);
            }
            $("#pageID").empty();