diff --git a/src/components/site/previewOfSiteStatus.vue b/src/components/site/previewOfSiteStatus.vue index 11f49af..be023b7 100644 --- a/src/components/site/previewOfSiteStatus.vue +++ b/src/components/site/previewOfSiteStatus.vue @@ -364,8 +364,9 @@ // 项目设备环比增长B // 站点实时报警A WaringList: [], - NoBaoJingData: true //有无报警数据,有就为false + NoBaoJingData: true, //有无报警数据,有就为false // 站点实时报警B + map: "" }; }, methods: { @@ -522,7 +523,22 @@ // 根据平台渲染站点实时报警信息 this.loadSiteBaoJing(); // 返回出项目的坐标以及缩放等级************************************************************************************************GIS调用 - console.log(item.latitude, item.longitude, item.zoomLevel); + //console.log(item.latitude, item.longitude, item.zoomLevel); + if ( + item.latitude != null && + item.longitude != null && + item.zoomLevel != null + ) { + let MapPoint = new esri.geometry.Point( + item.longitude, + item.latitude, + new esri.SpatialReference({ + wkid: 4326 + }) + ); + console.log(MapPoint); + this.map.centerAndZoom(MapPoint, item.zoomLevel); + } }, // 加载项目设备总览的ecahrts loadRegionEcharts(SheBeiLeiXing, XianYouData, DaJianData) { @@ -767,7 +783,7 @@ ClusterLayer ]) => { // create map with the given options at a DOM node w/ id 'mapNode' - let map = new Map("previewOfSiteStatusMaps", { + _this.map = new Map("previewOfSiteStatusMaps", { center: [100, 35], zoom: 5, logo: false, @@ -776,14 +792,15 @@ let Main_Map = new ArcGISTiledMapServiceLayer( "http://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetPurplishBlue/MapServer" ); - map.addLayer(Main_Map); - /* map.on("zoom-end", function() { - console.log(map.getLevel()); + _this.map.addLayer(Main_Map); + _this.map.on("zoom-end", function() { + console.log(_this.map.getLevel()); }); - map.on("click", function(e) { - console.log(e); - }); */ - map.on("load", function() { + + _this.map.on("click", function(e) { + console.log(webMercatorUtils.webMercatorToGeographic(e.mapPoint)); + }); + _this.map.on("load", function() { _this.$http .post(_this.nozzle.listStationBase, { data: {} @@ -824,7 +841,7 @@ fieldInfos: [ { fieldName: "stName", - "label": "名称:", + label: "名称:", visible: true } ] @@ -835,7 +852,7 @@ id: "clusters", labelColor: "#fff", labelOffset: 10, - resolution: map.extent.getWidth() / map.width, + resolution: _this.map.extent.getWidth() / _this.map.width, singleColor: "#888", singleTemplate: popupTemplate }); @@ -867,7 +884,7 @@ renderer.addBreak(200, 1001, red); clusterLayer.setRenderer(renderer); - map.addLayer(clusterLayer); + _this.map.addLayer(clusterLayer); } else { message(response); } @@ -1303,4 +1320,68 @@ top: 50px; } /* 站点实时报警B */ + + \ No newline at end of file