diff --git a/src/components/index.vue b/src/components/index.vue index c1eb29b..235f42c 100644 --- a/src/components/index.vue +++ b/src/components/index.vue @@ -334,7 +334,7 @@ }, ChangeBGC() { // 给予gis的方法调用demo A - // this.$refs.PathView; + if(this.$refs["PathView"].hasOwnProperty('REFSFunctionToGis')) this.$refs["PathView"].REFSFunctionToGis(this.flag); // 给予gis的方法调用demo E diff --git a/src/components/index.vue b/src/components/index.vue index c1eb29b..235f42c 100644 --- a/src/components/index.vue +++ b/src/components/index.vue @@ -334,7 +334,7 @@ }, ChangeBGC() { // 给予gis的方法调用demo A - // this.$refs.PathView; + if(this.$refs["PathView"].hasOwnProperty('REFSFunctionToGis')) this.$refs["PathView"].REFSFunctionToGis(this.flag); // 给予gis的方法调用demo E diff --git a/src/components/site/previewOfSiteStatus.vue b/src/components/site/previewOfSiteStatus.vue index 5423802..00afbdd 100644 --- a/src/components/site/previewOfSiteStatus.vue +++ b/src/components/site/previewOfSiteStatus.vue @@ -380,8 +380,17 @@ export default { name: "previewOfSiteStatus", components: { countTo }, //加载数字滚动插件 - data: function() { + props: { + flag: { + type: Boolean, + default () { + return false + } + } + }, + data: function () { return { + switchStatusData: this.flag, // 重新定义数据 timer: {}, //定时器 // 顶部中间汇总A TopData1: "1866", @@ -1007,12 +1016,14 @@ //"http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" "http://cache1.arcgisonline.cn/arcgis/rest/services/ChinaOnlineCommunity_Mobile/MapServer" ); - _this.map.addLayer(this.arcgiswhiteMap); - this.arcgiswhiteMap.hide(); - this.arcgisMap = new ArcGISTiledMapServiceLayer( + _this.map.addLayer(this.arcgiswhiteMap); + /* this.arcgiswhiteMap.hide() */ + this.arcgisMap = new ArcGISTiledMapServiceLayer( "http://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetPurplishBlue/MapServer" ); _this.map.addLayer(this.arcgisMap); + console.log("zzzzzzzzzzz " + this.switchStatusData) + this.REFSFunctionToGis(!this.switchStatusData) /* _this.map.on("zoom-end", function() { }); @@ -1161,6 +1172,7 @@ // console.error(err); }); }, + // 给与gis的方法调动dome REFSFunctionToGis(type) { if (!type) { @@ -1169,12 +1181,17 @@ this.arcgisMap.show(); } else { //加载蓝色底图 - this.arcgisMap.hide(); - this.arcgiswhiteMap.show(); + this.arcgisMap.hide() + this.arcgiswhiteMap.show() } } }, - mounted: function() { + computed: { + switchStatus: function () { + return this.flag // 直接监听props里的status状态 + } + }, + mounted: function () { // 根据平台渲染站点数量统计及状态统计 this.loadSiteNumForOroject(); // 根据平台渲染项目设备总览