czt
2 天以前 b1e6bf7d3ed1a1d64182127f83fdc3fad2233a7e
fzzy-igdss-web/src/main/resources/static/group/gis.js
@@ -127,9 +127,10 @@
/**
 * 获取市州下库区信息
 */
function getDeptArea(province, county) {
function getDeptArea(province, city, county) {
    var list = [];
    if (deptList) {
        //省
        if (province && province.length > 0) {
            var str1 = province.substring(0, 2);
            for (var i = 0; i < deptList.length; i++){
@@ -137,12 +138,20 @@
                    list.push(deptList[i]);
                }
            }
        }
        if (county && county.length > 0) {
            var str2 = county.substring(0, 4);
        //市州
        if (city && city.length > 0) {
            var str2 = city.substring(0, 4);
            for (var i = 0; i < deptList.length; i++) {
                if(deptList[i].xzqhdm.startsWith(str2)){
                    list.push(deptList[i]);
                }
            }
        }
        //区县
        if (county && county.length > 0) {
            for (var i = 0; i < deptList.length; i++) {
                if(deptList[i].xzqhdm === county){
                    list.push(deptList[i]);
                }
            }
@@ -155,20 +164,25 @@
/**
 * 用户点击城市或者县级区级渲染库区点位
 */
function renderAreas(deptId) {
    var d = allAreaMap[deptId];
function renderAreas(code) {
    var d = allAreaMap[code];
    if (d) {
        closeInfoWindow();
        removeColor();
        delMarker();
        //map.setCity(deptId);
        renderColor(deptId);
        renderColor(code);
        var a = [];
        //省
        if ("1" == d.type) {
            a = getDeptArea(deptId, "")
            a = getDeptArea(code, "", "");
        }
        //市州
        if ("2" == d.type) {
            a = getDeptArea("", deptId)
            a = getDeptArea("", code, "")
        }
        //区县
        if ("3" == d.type) {
            a = getDeptArea("", "", code)
        }
        if (a && a.length > 0) {
            for (var i = 0; i < a.length; i++) {
@@ -176,10 +190,10 @@
            }
        }
        //刷新数据
        county = deptId;
        county = code;
        // ajaxFoodNum();
    } else {
        console.log("没有获取到该行政区划:" + deptId);
        console.log("没有获取到该行政区划:" + code);
    }
}
@@ -209,6 +223,7 @@
    if (areaList) {
        var html = "";
        var childs = [];
        var childsItem = [];
        var areas = [];
        for (var i = 0; i < areaList.length; i++) {
            html += "<div style=\"width: 305px; overflow: hidden\">" +
@@ -220,7 +235,7 @@
                (areaList[i].name ? areaList[i].name : "") +
                "</a>" +
                "</div>";
            if (areaList[i].children && areaList[i].children.length > 0) {
            if (areaList[i].children && areaList[i].children.length > 0) {   //市州
                childs = areaList[i].children;
                for (var j = 0; j < childs.length; j++) {
                    html += "<ul class=\"sup-menu-ul  menu-h\">" +
@@ -232,23 +247,58 @@
                        (childs[j].name ? childs[j].name : "") +
                        "</a>" +
                        "</div>";
                    areas = getDeptArea("", childs[j].code);
                    if (areas && areas.length > 0) {
                        for (var k = 0; k < areas.length; k++) {
                            html += "<div class=\"sup-menu-box\">" +
                                "<p>" +
                                "<span class=\"i-icon32 fl\"><img src=\"/img/web/group/icon-kuqu.png\"/></span>" +
                                "<a href=\"#\" onclick=\"showAreaInfo('" + areas[k].id + "')\">" + areas[k].kqmc + "</a>" +
                                "</p>" +
                    if (childs[j].children && childs[j].children.length > 0) {   //市州
                        childsItem = childs[j].children;
                        for (var j = 0; j < childsItem.length; j++) {
                            html += "<ul class=\"sup-menu-ul  menu-h\">" +
                                "<li>" +
                                "<div class=\"sup-menu-h\">" +
                                "<i class=\"i-icon fl\"><img src=\"/img/web/group/icon-sj.png\"/></i>" +
                                "<a href=\"###\" onclick=\"renderAreas('" + childsItem[j].code + "')\">" +
                                "<span class=\"i-icon32 fl\"><img src=\"/img/web/group/c-i2.png\"/></span>" +
                                (childsItem[j].name ? childsItem[j].name : "") +
                                "</a>" +
                                "</div>";
                            areas = getDeptArea("","", childsItem[j].code);
                            if (areas && areas.length > 0) {
                                for (var k = 0; k < areas.length; k++) {
                                    html += "<div class=\"sup-menu-box\">" +
                                        "<p>" +
                                        "<span class=\"i-icon32 fl\"><img src=\"/img/web/group/icon-kuqu.png\"/></span>" +
                                        "<a href=\"#\" onclick=\"showAreaInfo('" + areas[k].id + "')\">" + areas[k].kqmc + "</a>" +
                                        "</p>" +
                                        "</div>";
                                }
                            }
                            html += "</li>" +
                                "</ul>";
                        }
                    } else {
                        //没有子节点,直接就是库区
                        areas = getDeptArea("", "", areaList[i].code);
                        if (areas && areas.length > 0) {
                            for (var k = 0; k < areas.length; k++) {
                                html += "<ul class=\"sup-menu-ul\">" +
                                    "<li>" +
                                    "<div class=\"sup-menu-h\">" +
                                    "<i class=\"i-icon fl\"><img src=\"/img/web/group/icon-sj.png\"/></i>" +
                                    "<a href=\"###\" onclick=\"renderAreas('" + areas[k].code + "')\">" +
                                    "<span class=\"i-icon32 fl\"><img src=\"/img/web/group/icon-kuqu.png\"/></span>" +
                                    (areas[k].name ? areas[k].name : "") +
                                    "</a>" +
                                    "</div>";
                                html += "<div class=\"sup-menu-box\">" +
                                    "</div>";
                                html += "</li>" +
                                    "</ul>";
                            }
                        }
                    }
                    html += "</li>" +
                        "</ul>";
                }
            } else {
                //没有子节点,直接就是区级别
                areas = getDeptArea("", areaList[i].code);
                //没有子节点,直接就是库区
                areas = getDeptArea("", "",areaList[i].code);
                if (areas && areas.length > 0) {
                    for (var k = 0; k < areas.length; k++) {
                        html += "<ul class=\"sup-menu-ul\">" +