diff --git a/src/components/site/previewOfSiteStatus.vue b/src/components/site/previewOfSiteStatus.vue index 1d24bac..054d181 100644 --- a/src/components/site/previewOfSiteStatus.vue +++ b/src/components/site/previewOfSiteStatus.vue @@ -793,19 +793,20 @@ "http://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetPurplishBlue/MapServer" ); _this.map.addLayer(Main_Map); - _this.map.on("zoom-end", function() { + /* _this.map.on("zoom-end", function() { console.log(_this.map.getLevel()); }); _this.map.on("click", function(e) { console.log(webMercatorUtils.webMercatorToGeographic(e.mapPoint)); - }); + }); */ _this.map.on("load", function() { _this.$http .post(_this.nozzle.listStationBase, { data: {} }) .then(response => { + console.log(response); if (response.data.code === 200) { console.log(response); let photoInfo = {}; @@ -826,8 +827,18 @@ let webMercator = webMercatorUtils.geographicToWebMercator( latlng ); + /* for (let item in p.data) { + //console.log(p.data[item]); + let Record = ""; + for(let key in p.data[item]){ + //console.log(p.data[item][key]) + Record+=p.data[item][key]; + } + console.log(Record) + } */ let attributes = { - stName: p.stName + stName: p.stName, + stCode: p.stCode }; return { x: webMercator.x, @@ -836,6 +847,7 @@ }; } ); + let popupTemplate = new PopupTemplate({ title: "", fieldInfos: [ @@ -843,6 +855,11 @@ fieldName: "stName", label: "名称:", visible: true + }, + { + fieldName: "stCode", + label: "编号:", + visible: true } ] }); @@ -885,6 +902,50 @@ clusterLayer.setRenderer(renderer); _this.map.addLayer(clusterLayer); + clusterLayer.on("click", function(res) { + /* console.log( + res.graphic._graphicsLayer._singles[0].attributes.stCode + ); */ + if (res.graphic._graphicsLayer._singles.length == 0) { + return; + } + let d = res; + console.log(res); + _this.$http + .post(_this.nozzle.getTempData, { + data: { + stCode: + d.graphic._graphicsLayer._singles[0].attributes + .stCode + } + }) + .then(resP => { + //console.log(resP); + let textContent = + ""; + for (let item in resP.data.data) { + textContent += ""; + for (let arr in resP.data.data[item]) { + //console.log(resP.data.data[item][arr]); + textContent += + ""; + } + textContent += ""; + } + //d.graphic._graphicsLayer._singles[0].attributes.stCode 站点编号 + textContent += "
名称" + + d.graphic._graphicsLayer._singles[0].attributes + .stName + + "
" + resP.data.data[item][arr] + "
历时数据
"; + console.log(textContent); + _this.map.infoWindow.setTitle("详细信息"); + _this.map.infoWindow.setContent(textContent); + _this.map.infoWindow.show( + d.mapPoint, + esri.dijit.InfoWindow.ANCHOR_UPPERRIGHT + ); + }); + }); } else { message(response); } @@ -1379,7 +1440,7 @@ } .esriPopup a { - color: #fff !important; + color: #fff; } .actionList { display: none; diff --git a/src/components/site/previewOfSiteStatus.vue b/src/components/site/previewOfSiteStatus.vue index 1d24bac..054d181 100644 --- a/src/components/site/previewOfSiteStatus.vue +++ b/src/components/site/previewOfSiteStatus.vue @@ -793,19 +793,20 @@ "http://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetPurplishBlue/MapServer" ); _this.map.addLayer(Main_Map); - _this.map.on("zoom-end", function() { + /* _this.map.on("zoom-end", function() { console.log(_this.map.getLevel()); }); _this.map.on("click", function(e) { console.log(webMercatorUtils.webMercatorToGeographic(e.mapPoint)); - }); + }); */ _this.map.on("load", function() { _this.$http .post(_this.nozzle.listStationBase, { data: {} }) .then(response => { + console.log(response); if (response.data.code === 200) { console.log(response); let photoInfo = {}; @@ -826,8 +827,18 @@ let webMercator = webMercatorUtils.geographicToWebMercator( latlng ); + /* for (let item in p.data) { + //console.log(p.data[item]); + let Record = ""; + for(let key in p.data[item]){ + //console.log(p.data[item][key]) + Record+=p.data[item][key]; + } + console.log(Record) + } */ let attributes = { - stName: p.stName + stName: p.stName, + stCode: p.stCode }; return { x: webMercator.x, @@ -836,6 +847,7 @@ }; } ); + let popupTemplate = new PopupTemplate({ title: "", fieldInfos: [ @@ -843,6 +855,11 @@ fieldName: "stName", label: "名称:", visible: true + }, + { + fieldName: "stCode", + label: "编号:", + visible: true } ] }); @@ -885,6 +902,50 @@ clusterLayer.setRenderer(renderer); _this.map.addLayer(clusterLayer); + clusterLayer.on("click", function(res) { + /* console.log( + res.graphic._graphicsLayer._singles[0].attributes.stCode + ); */ + if (res.graphic._graphicsLayer._singles.length == 0) { + return; + } + let d = res; + console.log(res); + _this.$http + .post(_this.nozzle.getTempData, { + data: { + stCode: + d.graphic._graphicsLayer._singles[0].attributes + .stCode + } + }) + .then(resP => { + //console.log(resP); + let textContent = + ""; + for (let item in resP.data.data) { + textContent += ""; + for (let arr in resP.data.data[item]) { + //console.log(resP.data.data[item][arr]); + textContent += + ""; + } + textContent += ""; + } + //d.graphic._graphicsLayer._singles[0].attributes.stCode 站点编号 + textContent += "
名称" + + d.graphic._graphicsLayer._singles[0].attributes + .stName + + "
" + resP.data.data[item][arr] + "
历时数据
"; + console.log(textContent); + _this.map.infoWindow.setTitle("详细信息"); + _this.map.infoWindow.setContent(textContent); + _this.map.infoWindow.show( + d.mapPoint, + esri.dijit.InfoWindow.ANCHOR_UPPERRIGHT + ); + }); + }); } else { message(response); } @@ -1379,7 +1440,7 @@ } .esriPopup a { - color: #fff !important; + color: #fff; } .actionList { display: none; diff --git a/src/util/project.js b/src/util/project.js index 8038fef..2cdc03c 100644 --- a/src/util/project.js +++ b/src/util/project.js @@ -13,6 +13,7 @@ "sysPlatformGetSiteStateStatistics":"/sys/platform/getSiteStateStatistics",//站点状况预览图-----平台近七日站点状态统计 "warnLogGetWarnLogOfPlatform":"/warn/log/getWarnLogOfPlatform",//站点状况预览图-----查询该平台各站点各因子最新的报警数据 "listStationBase":"sys/site/listStationBase",//所有站点 + "getTempData":"sys/site/getTempData",//单个站点 }; for (let item in nozzle) {