123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358 |
- var baseRootPath = getBaseRootPath();
- var prefix = baseRootPath + ctx + "ksh";
- $(document).ready(function () {
- var navList = $(".nav-a");
- for (var i = 0; i < navList.length; i++) {
- if (jdId == $(navList[i]).attr("deptId")) {
- onNavClick(jdId);//街道登录初始化导航
- }
- }
- // 导航选中
- $(".nav-con a").on('click', function() {
- isNavChange = true;
- $(this).addClass('onthis');
- $(this).siblings().removeClass('onthis');
- });
- // 矢量图 影像图 选中
- $(".s1 span").on('click', function() {
- $(this).addClass('on');
- $(this).siblings().removeClass('on');
- });
- // 人房户 事件 选中
- $(".s2 span").on('click', function() {
- //$(this).toggleClass('on')
- $(this).addClass('on');
- $(this).siblings().removeClass('on');
- });
- // 后台管理
- $('#goHtgl').on('click', function () {
- location.href = ctx;
- });
- // 可视化
- $('#goKsh').on('click', function () {
- location.href = ctx + "ksh"
- });
- // 辅助决策
- $('#goFzjc').on('click', function () {
- location.href = ctx + "fzjc"
- });
- // 街道信息
- /*$('#kshJd').on('click', function () {
- location.href = prefix + "/kshJd"
- });*/
- // // 事件信息
- // $('#goEventDetail').on('click', function () {
- // $.modal.open("事件信息", prefix + "/eventDetail", 1200 , 630);
- // });
- // // 人房户单选
- // $('#rfhSingle').on('click', function () {
- // $.modal.open("人房户单选", prefix + "/rfhSingle",1200, 750);
- // });
- // // 人房户多选前
- // $('#rfhMultiBefore').on('click', function () {
- // $.modal.open("人房户多选前", prefix + "/rfhMultiBefore/n/n",1400, 720);
- // });
- // // 人房户多选后
- // $('#rfhMultiAfter').on('click', function () {
- // $.modal.open("人房户多选后", prefix + "/rfhMultiAfter",1400, 720);
- // });
- })
- //全屏
- function fullScreen() {
- var year = $("#year").val();
- var jdId = $("#jdId").val();
- var sqId = $("#sqId").val();
- var url = prefix + "/fullScreen/" + year + "/" + jdId + "/" + sqId + "/" + isYxt + "/" + isRfh;
- $.modal.openDetailFull("汽开区智慧社区数据孪生平台", url, 1200);
- }
- //全区、街道、社区切换
- function map_quanqu() {
- isYxt = true;
- // 点击全区后切换影像图 人房户、事件不切换 事件打点
- $("#yxt").addClass('on');
- $("#slt").removeClass('on');
- if(perFlag=="jd"){
- //$('#sqId').val(-1);
- //reloadData();
- onNavClick($('#jdId').val());
- // $.modal.alertWarning("仅限查看本街道数据");
- return;
- }
- // $('#jdId').val(-1);
- onNavClick(-1);
- /*jieDaoChangeBefore();
- if(!isRfh){
- $.eventPoint.init({
- deptId: 0,
- year:$("#year").val()
- });
- }*/
- }
- //点击下拉框
- function map_jiedao_click() {
- if(perFlag=="jd"){
- $('#jdId').val(jdId);
- $.modal.alertWarning("仅限查看本街道数据");
- return;
- }
- }
- function jieDaoChangeBefore() {//下拉切换街道
- if(perFlag=="jd" && false){
- $.modal.alertWarning("仅限查看本街道数据");
- return;
- }
- isJdChange = true;
- var jdId = $('#jdId').val();
- onNavClick(jdId);
- }
- function jieDaoChangeByFullScreen() {//下拉切换街道
- isJdChange = true;
- var jdId = $('#jdId').val();
- onNavClick(jdId);
- }
- var isNavChange = false;
- var isJdChange = false;
- var isSqChange = false;
- function jieDaoChange() {
- var obj = new Object();
- obj.jdIds = "" + $('#jdId').val()==-1?"":$('#jdId').val();
- if($('#jdId').val()==-1){
- $("#sqId").html("<option value='-1'>所有社区</option>");
- $('#jdIds').val($('#jdId').val()==-1?"":$('#jdId').val());
- $('#sqIds').val($('#sqId').val()==-1?"":$('#sqId').val());
- }
- $.ajax({
- url : ctx + "zhcx/zhcx" + "/getSheQuList",
- method : 'get',
- data : obj,
- success : function (e) {
- $("#sqId").html("<option value='-1'>所有社区</option>");
- if($('#jdId').val()!=-1){
- for(var i=0; i<e.sheQuList.length; i++){
- var option = $("<option></option>").text(e.sheQuList[i].deptName);
- option.attr("value",e.sheQuList[i].deptId);
- option.attr("class","sqId");
- $("#sqId").append(option);
- }
- }
- $('#jdIds').val($('#jdId').val()==-1?"":$('#jdId').val());
- $('#sqIds').val($('#sqId').val()==-1?"":$('#sqId').val());
- map_jiedao();
- if(!isRfh){//有轮廓图的是人房户不打点
- $.eventPoint.init({
- deptId: $('#sqId').val()==-1?$('#jdId').val()==-1?0:$('#jdId').val():$('#sqId').val(),
- year:$("#year").val()
- });
- }
- }
- });
- }
- function sheQuChange() {
- if(isJdChange == false){
- isSqChange = true;
- }
- $('#sqIds').val($('#sqId').val()==-1?"":$('#sqId').val());
- map_shequ();
- if(isJdChange || isNavChange){//切换街道、导航栏联动社区
- }else {//单独切换社区
- if(!isRfh){//有轮廓图的是人房户不打点
- $.eventPoint.init({
- deptId: $('#sqId').val()==-1?$('#jdId').val()==-1?0:$('#jdId').val():$('#sqId').val(),
- year:$("#year").val()
- });
- }
- }
- }
- var map_jiedaoList;
- function map_jiedao() {
- var obj = new Object();
- if($('#jdId').val()==-1){//全区查询有
- var jdIds = [];
- var jieDaoList = $(".jdId");
- for(var i = 0; i < jieDaoList.length; i++){
- jdIds.push($(jieDaoList[i]).val());
- }
- obj.deptIds = jdIds+"";
- }else {
- obj.deptIds = $('#jdIds').val();
- }
- $.ajax({
- url : prefix + "/map_info",
- method : 'post',
- data : obj,
- success : function (e) {
- map_jiedaoList = e.map_info;
- sheQuChange();
- }
- });
- }
- var map_shequList;
- function map_shequ() {
- var obj = new Object();
- if($('#sqId').val()==-1){//全区查询有
- var sqIds = [];
- var sheQuList = $(".sqId");
- for(var i = 0; i < sheQuList.length; i++){
- sqIds.push($(sheQuList[i]).val());
- }
- obj.deptIds = sqIds+"";
- }else {
- obj.deptIds = $('#sqIds').val();
- }
- $.ajax({
- url : prefix + "/map_info",
- method : 'post',
- data : obj,
- success : function (e) {
- map_shequList = e.map_info;
- map_reload();
- }
- });
- }
- var datasource_datasetNames;//加载数据源和数据集
- function map_reload() {
- if ($("#jdId").val() == "-1") {
- map.remove();
- layersList = [];
- initAllMap();
- } else {
- datasource_datasetNames = [];
- map.remove();//移除地图对象,
- var jdsqmap_layersList = [];//配置需要加载的图层
- jdsqmap_layersList.push(map_jilinShiLiang);
- if(isYxt){//加载影像图、轮廓
- jdsqmap_layersList.push(map_qikaiYingXiang);
- for (var i = 0; i < map_jiedaoList.length; i++) {
- jdsqmap_layersList.push(L.supermap.tiledMapLayer(workspace_jdsq + '/' + map_jiedaoList[i].layerId, {noWrap: true}));//加载本街道范围轮廓图
- }
- for (var i = 0; i < map_shequList.length; i++) {//选择具体街道时加载街道下所有社区数据
- if (map_shequList[i].layerId != null && map_shequList[i].layerId != "") {
- if(isRfh){//加载建筑物
- jdsqmap_layersList.push(L.supermap.tiledMapLayer(workspace_jdsq + '/' + map_shequList[i].layerId, {noWrap: true}));//加载本街道下所有社区建筑图
- datasource_datasetNames.push(map_shequList[i].datasourceName + ":" + map_shequList[i].datasetName);//["building:东风创业","building:东风创业","building:东风创业"],
- }
- }
- }
- }
- console.log(datasource_datasetNames)
- var jdsqmap_mapPoint;
- var jdsqmap_zoom;
- if (isSqChange && map_shequList[0].centerpointLat != null && map_shequList[0].centerpointLat != "" && map_shequList[0].centerpointLon != null && map_shequList[0].centerpointLon != "") {
- jdsqmap_zoom = 16;
- jdsqmap_mapPoint = getSuperMapCenterPoint(map_shequList[0].centerpointLat + "," + map_shequList[0].centerpointLon);//本社区中心点
- } else {
- jdsqmap_zoom = 14;
- jdsqmap_mapPoint = getSuperMapCenterPoint(map_jiedaoList[0].centerpointLat + "," + map_jiedaoList[0].centerpointLon);//本街道中心点
- /*if($('#sqId').val()==-1){
- for(var i=0;i<map_shequList.length;i++){//未选择具体街道时加载所有社区数据
- if(map_shequList[i].layerId !=null && map_shequList[i].layerId!=""){
- //jdsqmap_layersList.push(L.supermap.tiledMapLayer( workspace_jdsq+'/'+map_shequList[i].layerId, { noWrap: true }));//加载本街道下所有社区建筑图
- datasource_datasetNames.push(map_shequList[i].datasourceName + ":" + map_shequList[i].datasetName);//["building:东风创业","building:东风创业","building:东风创业"],
- }
- }
- }*/
- }
- isNavChange = false;
- isJdChange = false;
- isSqChange = false;
- mapPoint = jdsqmap_mapPoint;
- layersList = jdsqmap_layersList;
- initMap(jdsqmap_mapPoint, jdsqmap_layersList, jdsqmap_zoom);//重新初始化地图对象
- }
- }
- function map_reload() {
- reloadData();
- isNavChange = false;
- isJdChange = false;
- isSqChange = false;
- }
- /**
- * 人房户矢量图 只有矢量图 没有影像、轮廓、建筑、事件落点
- * 人房户影像图 只有矢量图、影像、轮廓、建筑 没有事件落点
- * 事件矢量图 只有矢量图、事件落点 没有影像、轮廓、建筑
- * 事件影像图 有矢量图、影像、轮廓、建筑、事件落点
- */
- function reloadData() {
- map.remove();//移除地图对象,
- layersList=[];
- datasource_datasetNames=[];
- /**
- * 矢量图
- */
- layersList.push(map_jilinShiLiang);//吉林矢量
- /**
- * 影像图
- */
- if(isYxt){//影像图
- layersList.push(map_qikaiYingXiang);//汽开影像
- }
- /**
- * 轮廓图
- */
- if(isYxt){
- if($("#jdId").val() == -1){//汽开全区轮廓图
- layersList.push(L.supermap.tiledMapLayer( workspace_jdsq+'/qikaiquanqu', { noWrap: true }));//汽开全区
- }else {//选中具体街道、社区轮廓图
- for (var i = 0; i < map_jiedaoList.length; i++) {
- layersList.push(L.supermap.tiledMapLayer(workspace_jdsq + '/' + map_jiedaoList[i].layerId, {noWrap: true}));//加载本街道范围轮廓图
- }
- }
- }
- /**
- * 建筑物
- */
- if(isYxt && isRfh && $("#jdId").val() != -1){
- for (var i = 0; i < map_shequList.length; i++) {//选择具体街道时加载街道下所有社区数据
- if (map_shequList[i].layerId != null && map_shequList[i].layerId != "") {
- layersList.push(L.supermap.tiledMapLayer(workspace_jdsq + '/' + map_shequList[i].layerId, {noWrap: true}));//加载本街道下所有社区建筑图
- datasource_datasetNames.push(map_shequList[i].datasourceName + ":" + map_shequList[i].datasetName);//["building:东风创业","building:东风创业","building:东风创业"],
- }
- }
- }
- /**
- * 事件落点
- */
- if(!isRfh){
- $.eventPoint.init({
- deptId: $('#sqId').val()==-1?$('#jdId').val()==-1?0:$('#jdId').val():$('#sqId').val(),
- year:$("#year").val()
- });
- }
- /**
- * 中心点、zoom
- */
- if($("#jdId").val() == -1 && $("#sqId").val() == -1){
- zoom=12;
- mapPoint=iServerqiKaiQuMapCenterPoint;//全区中心点
- }else if ($("#jdId").val() != -1 && $("#sqId").val() == -1 && map_jiedaoList[0].centerpointLat != null && map_jiedaoList[0].centerpointLat != "" && map_jiedaoList[0].centerpointLon != null && map_jiedaoList[0].centerpointLon != "") {
- zoom = 14;
- mapPoint = getSuperMapCenterPoint(map_jiedaoList[0].centerpointLat + "," + map_jiedaoList[0].centerpointLon);//本街道中心点
- } else if($("#sqId").val() != -1 && $("#sqId").val() != -1&& map_shequList[0].centerpointLat != null && map_shequList[0].centerpointLat != "" && map_shequList[0].centerpointLon != null && map_shequList[0].centerpointLon != ""){
- zoom = 16;
- mapPoint = getSuperMapCenterPoint(map_shequList[0].centerpointLat + "," + map_shequList[0].centerpointLon);//本社区中心点
- }else {
- zoom=12;
- mapPoint=iServerqiKaiQuMapCenterPoint;//全区中心点
- }
- initMap(mapPoint,layersList,zoom);//重新初始化地图对象
- }
|