| ÎļþÃû´Ó fzzy-igdss-web/src/main/resources/static/group/gis-index.js ÐÞ¸Ä |
| | |
| | | var colors = {}; |
| | | var map; |
| | | var disProvince;//è¡æ¿åºé¢è²æ¸²æ |
| | | var deptAreasMap = {}; |
| | | var allDeptMap = {}; |
| | | var deptListMap = {}; |
| | | var allAreaMap = {}; |
| | | var markers = [];//ç¹æ è®° |
| | | var type = "0"; |
| | | var county = "all"; |
| | |
| | | //var switch2AreaNode2; |
| | | |
| | | $(function () { |
| | | if (deptAreas) { |
| | | for (var i = 0; i < deptAreas.length; i++) { |
| | | deptAreasMap[deptAreas[i].id] = deptAreas[i]; |
| | | //ææåºåº |
| | | if (deptList) { |
| | | for (var i = 0; i < deptList.length; i++) { |
| | | deptListMap[deptList[i].id] = deptList[i]; |
| | | } |
| | | } |
| | | if (allDept) { |
| | | for (var i = 0; i < allDept.length; i++) { |
| | | allDeptMap[allDept[i].id] = allDept[i]; |
| | | //ææçå¸ |
| | | if (allArea) { |
| | | for (var i = 0; i < allArea.length; i++) { |
| | | allAreaMap[allArea[i].code] = allArea[i]; |
| | | } |
| | | } |
| | | |
| | | //åå§åæ¶é´ |
| | | //initTime(); |
| | | initTime(); |
| | | |
| | | //åå§åå°å¾ |
| | | initMap(); |
| | |
| | | ); |
| | | |
| | | //渲æé¨é¨ |
| | | //renderDepts(); |
| | | renderList(); |
| | | |
| | | //大屿 è¯ |
| | | //initDicSlogan(); |
| | | |
| | | //renderAreas(654000); |
| | | setTimeout(function () { |
| | | renderAreas(654000); |
| | | renderAreas(650000); |
| | | }, 2000); |
| | | |
| | | $('.sup-menu-title').click(function(){ |
| | | var kai = $(this).parent(".sup-menu-group") |
| | | if (kai.hasClass('menu-group')) { |
| | | kai.removeClass('menu-group') |
| | | } else{ |
| | | kai.addClass('menu-group') |
| | | } |
| | | |
| | | }); |
| | | $('.sup-menu-h').click(function(){ |
| | | var kai2 = $(this).parents(".sup-menu-ul") |
| | | if (kai2.hasClass('menu-h')) { |
| | | kai2.removeClass('menu-h') |
| | | } else{ |
| | | kai2.addClass('menu-h') |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | // å·æ°æ¶é´ |
| | |
| | | |
| | | function initMap() { |
| | | map = new AMap.Map('map_container', { |
| | | center: [81.323691, 43.917106], |
| | | zoom: 9, |
| | | center: [83.721646, 40.627714], |
| | | zoom: 5.6, |
| | | mapStyle: 'amap://styles/41f8248740d3659ddc65dc363078592c', |
| | | // rotateEnable:true, |
| | | // pitchEnable:true, |
| | |
| | | new AMap.DistrictSearch({ |
| | | extensions: 'all', |
| | | subdistrict: 0 |
| | | }).search('ä¼çåè¨å
èªæ²»å·', function (status, result) { |
| | | }).search('æ°çç»´å¾å°èªæ²»åº', function (status, result) { |
| | | // å¤å¤è¾¹å½¢åæ æ°ç»åå
å¤è¾¹å½¢åæ æ°ç» |
| | | var outer = [ |
| | | new AMap.LngLat(-360, 90, true), |
| | |
| | | |
| | | |
| | | //é»è®¤è¡æ¿åºåç¼ç |
| | | renderColor(defaultAreaCode); |
| | | } |
| | | |
| | | //socketä¿¡æ¯è¿åèç |
| | | function socketOnMessage(pocket) { |
| | | |
| | | if (pocket.userId == "slogan") { |
| | | var data = pocket.data; |
| | | dicSlogan = data; |
| | | initDicSlogan(); |
| | | } |
| | | // renderColor(defaultAreaCode); |
| | | } |
| | | |
| | | /** |
| | | * åå§æ è¯æ°æ® |
| | | * è·åå¸å·ä¸åºåºä¿¡æ¯ |
| | | */ |
| | | function initDicSlogan() { |
| | | if (dicSlogan) { |
| | | if (dicSlogan.color == "red") { |
| | | $("#sloganText").css({ |
| | | color: "#DE2910" |
| | | }); |
| | | } else { |
| | | $("#sloganText").css({ |
| | | color: "#7ddfff" |
| | | }); |
| | | } |
| | | $("#sloganText").text(dicSlogan.content); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åºå¿è·ååºåº |
| | | */ |
| | | function getDeptArea(city, county) { |
| | | function getDeptArea(province, county) { |
| | | var list = []; |
| | | if (deptAreas) { |
| | | for (var i = 0; i < deptAreas.length; i++) { |
| | | if (city == deptAreas[i].deptCity) { |
| | | list.push(deptAreas[i]); |
| | | if (deptList) { |
| | | if (province && province.length > 0) { |
| | | var str1 = province.substring(0, 2); |
| | | for (var i = 0; i < deptList.length; i++){ |
| | | if(deptList[i].xzqhdm.startsWith(str1)){ |
| | | list.push(deptList[i]); |
| | | } |
| | | } |
| | | if (county == deptAreas[i].deptCounty) { |
| | | list.push(deptAreas[i]); |
| | | |
| | | } |
| | | if (county && county.length > 0) { |
| | | var str2 = county.substring(0, 4); |
| | | for (var i = 0; i < deptList.length; i++) { |
| | | if(deptList[i].xzqhdm.startsWith(str2)){ |
| | | list.push(deptList[i]); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | |
| | | * ç¨æ·ç¹å»å叿è
å¿çº§åºçº§æ¸²æåºåºç¹ä½ |
| | | */ |
| | | function renderAreas(deptId) { |
| | | var d = allDeptMap[deptId]; |
| | | var d = allAreaMap[deptId]; |
| | | if (d) { |
| | | closeInfoWindow(); |
| | | removeColor(); |
| | |
| | | //map.setCity(deptId); |
| | | renderColor(deptId); |
| | | var a = []; |
| | | if ("10" == d.type) { |
| | | if ("1" == d.type) { |
| | | a = getDeptArea(deptId, "") |
| | | } |
| | | if ("11" == d.type) { |
| | | if ("2" == d.type) { |
| | | a = getDeptArea("", deptId) |
| | | } |
| | | if (a && a.length > 0) { |
| | |
| | | } |
| | | //å·æ°æ°æ® |
| | | county = deptId; |
| | | // ajaxFoodNum(); |
| | | // ajaxFoodNum(); |
| | | } else { |
| | | console.log("没æè·åå°è¯¥è¡æ¿åºå:" + deptId); |
| | | } |
| | | //é西 |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param deptAreaId |
| | | */ |
| | | function showAreaInfo(deptAreaId) { |
| | | var d = deptAreasMap[deptAreaId]; |
| | | var d = deptListMap[deptAreaId]; |
| | | if (d) { |
| | | closeInfoWindow(); |
| | | removeColor(); |
| | |
| | | /** |
| | | * 渲æåºåºå表 |
| | | */ |
| | | function renderDepts() { |
| | | if (depts) { |
| | | function renderList() { |
| | | if (areaList) { |
| | | var html = ""; |
| | | var childs = []; |
| | | var areas = []; |
| | | for (var i = 0; i < depts.length; i++) { |
| | | for (var i = 0; i < areaList.length; i++) { |
| | | html += "<div style=\"width: 305px; overflow: hidden\">" + |
| | | "<div class=\"sup-menu-group menu-group\">" + |
| | | "<div class=\"sup-menu-title\">" + |
| | | "<i class=\"i-icon fl\"><img src=\"/static/images/visual/icon-sj.png\"/></i>" + |
| | | "<a href=\"###\" onclick=\"renderAreas('" + depts[i].id + "')\">" + |
| | | "<span class=\"i-icon32 fl\"><img src=\"/static/images/visual/c-i2.png\"/></span>" + |
| | | (depts[i].name ? depts[i].name : "") + |
| | | "<i class=\"i-icon fl\"><img src=\"/img/web/group/icon-sj.png\"/></i>" + |
| | | "<a href=\"###\" onclick=\"renderAreas('" + areaList[i].code + "')\">" + |
| | | "<span class=\"i-icon32 fl\"><img src=\"/img/web/group/c-i2.png\"/></span>" + |
| | | (areaList[i].name ? areaList[i].name : "") + |
| | | "</a>" + |
| | | "</div>"; |
| | | if (depts[i].children && depts[i].children.length > 0) { |
| | | childs = depts[i].children; |
| | | 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\">" + |
| | | "<li>" + |
| | | "<div class=\"sup-menu-h\">" + |
| | | "<i class=\"i-icon fl\"><img src=\"/static/images/visual/icon-sj.png\"/></i>" + |
| | | "<a href=\"###\" onclick=\"renderAreas('" + childs[j].id + "')\">" + |
| | | "<span class=\"i-icon32 fl\"><img src=\"/static/images/visual/c-i2.png\"/></span>" + |
| | | "<i class=\"i-icon fl\"><img src=\"/img/web/group/icon-sj.png\"/></i>" + |
| | | "<a href=\"###\" onclick=\"renderAreas('" + childs[j].code + "')\">" + |
| | | "<span class=\"i-icon32 fl\"><img src=\"/img/web/group/c-i2.png\"/></span>" + |
| | | (childs[j].name ? childs[j].name : "") + |
| | | "</a>" + |
| | | "</div>"; |
| | | areas = getDeptArea("", childs[j].id); |
| | | 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=\"/static/images/visual/icon-kuqu.png\"/></span>" + |
| | | "<a href=\"#\" onclick=\"showAreaInfo('" + areas[k].id + "')\">" + areas[k].name + "</a>" + |
| | | "<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>"; |
| | | } |
| | |
| | | } |
| | | } else { |
| | | //没æåèç¹ï¼ç´æ¥å°±æ¯åºçº§å« |
| | | areas = getDeptArea("", depts[i].id); |
| | | 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=\"/static/images/visual/icon-sj.png\"/></i>" + |
| | | "<a href=\"###\" onclick=\"renderAreas('" + areas[k].id + "')\">" + |
| | | "<span class=\"i-icon32 fl\"><img src=\"/static/images/visual/icon-kuqu.png\"/></span>" + |
| | | "<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>"; |
| | |
| | | // " <p>å¤©åºæ°åº</p>" + |
| | | " <span class=\"map-round\"></span>" + |
| | | " </div>"; |
| | | var position = [deptArea.lon, deptArea.lat]; |
| | | var position = [deptArea.jd, deptArea.wd]; |
| | | var marker = new AMap.Marker({ |
| | | position: position, |
| | | // å° html ä¼ ç» content |
| | |
| | | "<div class=\"BMap_bubble_center\" style=\"z-index: 3; position: relative; height: 324px; width: 376px;\">" + |
| | | "<div class=\"BMap_bubble_content\" style=\"font-size: 14px; line-height: 24px; position: absolute; top: 2px; color: rgb(85, 85, 85); width: 364px; height: 324px; overflow: auto;\">" + |
| | | '<div style=\"height:100%;box-sizing:border-box;\">' + |
| | | '<div style="height: 34px;">'+ |
| | | '<div style="height: 34px;">' + |
| | | '<div style="width: 320px;float: left;">'; |
| | | if (deptArea.name.length>17) { |
| | | content += '<h3 style="margin:0 0 10px 0;line-height:24px;font-size:14px;color:#fff;">' + (deptArea.name ? deptArea.name : "没æè·åå°åºåºä¿¡æ¯") + '</h3>' ; |
| | | }else{ |
| | | content += '<h3 style="margin:0 0 10px 0;line-height:24px;font-size:18px;color:#fff;">' + (deptArea.name ? deptArea.name : "没æè·åå°åºåºä¿¡æ¯") + '</h3>' ; |
| | | if (deptArea.kqmc.length > 17) { |
| | | content += '<h3 style="margin:0 0 10px 0;line-height:24px;font-size:14px;color:#fff;">' + (deptArea.kqmc ? deptArea.kqmc : "没æè·åå°åºåºä¿¡æ¯") + '</h3>'; |
| | | } else { |
| | | content += '<h3 style="margin:0 0 10px 0;line-height:24px;font-size:18px;color:#fff;">' + (deptArea.kqmc ? deptArea.kqmc : "没æè·åå°åºåºä¿¡æ¯") + '</h3>'; |
| | | } |
| | | content += '</div>'+ |
| | | content += '</div>' + |
| | | '<div style="width: 40px;float: left;">' + |
| | | '<img style="height: 20px;" src="../../static/images/visual/icon_close.png" onclick="closeInfoWindow()"></img>' + |
| | | '</div>'+ |
| | | '</div>'+ |
| | | '<img style="height: 20px;" src="/img/web/group/icon_close.png" onclick="closeInfoWindow()"></img>' + |
| | | '</div>' + |
| | | '</div>' + |
| | | |
| | | '<p style="line-height:24px;font-size:12px;color:#fff;margin-right: 15px;"><img src="../../static/images/visual/icon-address.png" alt="" style="float:left;width: 16px;height: 16px;margin-right:3px;margin-top: 5px;"/>' + (deptArea.address ? deptArea.address + "(" + deptArea.lon + "," + deptArea.lat + ")" : "没æè·åå°åºåºä¿¡æ¯") + '</P>' + |
| | | '<p style="line-height:24px;font-size:12px;color:#fff;margin-right: 15px;"><img src="/img/web/group/icon-address.png" alt="" style="float:left;width: 16px;height: 16px;margin-right:3px;margin-top: 5px;"/>' + (deptArea.kqdz ? deptArea.kqdz + "(" + deptArea.jd + "," + deptArea.wd + ")" : "没æè·åå°åºåºä¿¡æ¯") + '</P>' + |
| | | '<div class="right-topInfo-kd " style="height: 80px;width: 270px;margin: 5px auto 10px auto;">' + |
| | | '<div class="right-topInfo-kd-item">' + |
| | | '<h3>ç²®ä»ä¸ªæ°(个)</h3>' + |
| | | '<p>' + (deptArea.depotNum ? deptArea.depotNum : 0) + '</p>' + |
| | | '<p>' + (deptArea.cfs ? deptArea.cfs : 0) + '</p>' + |
| | | '</div>' + |
| | | '<div class="right-topInfo-kd-item">' + |
| | | '<h3>æ²¹ç½ä¸ªæ°(个)</h3>' + |
| | | '<p>' + (deptArea.depotOilNum ? deptArea.depotOilNum : 0) + '</p>' + |
| | | '<p>' + (deptArea.cfs ? deptArea.cfs : 0) + '</p>' + |
| | | '</div>' + |
| | | '</div>' + |
| | | '<ul class="right-topInfo-kd-list right-topInfo-jg sup-topInfo-list">' + |
| | | '<li>'; |
| | | if (deptArea.storage && (deptArea.storage + "").length > 4) { |
| | | content += '<p style="font-size: 22px">' + (deptArea.storage ? deptArea.storage.toFixed(3) : 0) + '</p>'; |
| | | if (deptArea.cfs && (deptArea.cfs + "").length > 4) { |
| | | content += '<p style="font-size: 22px">' + (deptArea.cfs ? deptArea.cfs.toFixed(3) : 0) + '</p>'; |
| | | } else { |
| | | content += '<p style="font-size: 22px">' + (deptArea.storage ? deptArea.storage.toFixed(3) : 0) + '</p>'; |
| | | content += '<p style="font-size: 22px">' + (deptArea.cfs ? deptArea.cfs.toFixed(3) : 0) + '</p>'; |
| | | |
| | | } |
| | | content += '<h3>ç²®é£å¨é(å¨)</h3>'+ |
| | | content += '<h3>ç²®é£å¨é(å¨)</h3>' + |
| | | '</li>' + |
| | | '<li>'; |
| | | if (deptArea.storage && (deptArea.oilStorage + "").length > 4) { |
| | | content += '<p style="font-size: 22px">' + (deptArea.oilStorage ? deptArea.oilStorage.toFixed(3) : 0) + '</p>'; |
| | | if (deptArea.cfs && (deptArea.cfs + "").length > 4) { |
| | | content += '<p style="font-size: 22px">' + (deptArea.cfs ? deptArea.cfs.toFixed(3) : 0) + '</p>'; |
| | | } else { |
| | | content += '<p style="font-size: 22px">' + (deptArea.oilStorage ? deptArea.oilStorage.toFixed(3) : 0) + '</p>'; |
| | | content += '<p style="font-size: 22px">' + (deptArea.cfs ? deptArea.cfs.toFixed(3) : 0) + '</p>'; |
| | | } |
| | | content += '<h3>æ¤ç©æ²¹å¨é(å¨)</h3>' + |
| | | '</li>' + |
| | | '<li>' + |
| | | '<p style="font-size: 22px" >' + (deptArea.area ? deptArea.area : 0) + '</p>' + |
| | | '<p style="font-size: 22px" >' + (deptArea.zdmj ? deptArea.zdmj : 0) + '</p>' + |
| | | '<h3>å å°é¢ç§¯ï¼ã¡ï¼</h3>' + |
| | | '</li>' + |
| | | '</ul>' + |
| | | '<a href="javaScript:;" onclick="toHomeDetail(\'' + deptAreaId + '\')" class="sup-deatil-link"><img src="../../static/images/visual/spu-detail-btn.png" alt="" style="width:100%;height:100%;"/></a>' + |
| | | '<a href="javaScript:;" onclick="toHomeDetail(\'' + deptAreaId + '\')" class="sup-deatil-link"><img src="/img/web/group/spu-detail-btn.png" alt="" style="width:100%;height:100%;"/></a>' + |
| | | '</div>' + |
| | | "</div></div><div class=\"BMap_bubble_bottom\" style=\"display: block; z-index: 2; position: absolute; width: 376px;\">" + |
| | | "</div><img style=\"z-index: 1; position: absolute; width: 58px; height: 31px; left: 159px; bottom: -30px; top: 356px;\" src=\"http://webmap0.bdimg.com/image/api/iw_tail.png\"></div>"; |
| | |
| | | * @param id |
| | | */ |
| | | function toHomeDetail(id) { |
| | | var url = "../home?t=grain&deptAreaId=" + id; |
| | | var url = "/index?deptId=" + id; |
| | | window.parent.open(url, "_self"); |
| | | }; |
| | | |
| | |
| | | * @param adcode |
| | | */ |
| | | function renderColor(adcode) { |
| | | // disProvince = new AMap.DistrictLayer.Province({ |
| | | // zIndex: 12, |
| | | // adcode: adcode, |
| | | // depth: 2, |
| | | // opacity: 0.6, |
| | | // styles: { |
| | | // 'fill': function (properties) { |
| | | // var adcode = properties.adcode; |
| | | // return getColorByAdcode(adcode); |
| | | // }, |
| | | // 'province-stroke': 'cornflowerblue', |
| | | // 'city-stroke': 'white',//ä¸å½å°çº§å¸è¾¹ç |
| | | // 'county-stroke': 'rgba(255,255,255,0.5)'//ä¸å½åºå¿è¾¹ç |
| | | // } |
| | | // }); |
| | | // disProvince.setMap(map); |
| | | //window.switch2AreaNode2(adcode); |
| | | switch2AreaNode(adcode); |
| | | } |
| | | |