diff --git a/src/components/CMap/base/mixins/common.js b/src/components/CMap/base/mixins/common.js index ce9d836..c634e47 100644 --- a/src/components/CMap/base/mixins/common.js +++ b/src/components/CMap/base/mixins/common.js @@ -57,7 +57,9 @@ default: mapLayers[types[prop.type].unload](originInstance) } - } catch (e) {} + } catch (e) { + console.log(e) + } } } this.computed = { diff --git a/src/components/CMap/base/mixins/common.js b/src/components/CMap/base/mixins/common.js index ce9d836..c634e47 100644 --- a/src/components/CMap/base/mixins/common.js +++ b/src/components/CMap/base/mixins/common.js @@ -57,7 +57,9 @@ default: mapLayers[types[prop.type].unload](originInstance) } - } catch (e) {} + } catch (e) { + console.log(e) + } } } this.computed = { diff --git a/src/components/CMap/components/cmap.vue b/src/components/CMap/components/cmap.vue index 9bfc2dd..4494f00 100644 --- a/src/components/CMap/components/cmap.vue +++ b/src/components/CMap/components/cmap.vue @@ -88,19 +88,19 @@ }, watch: { center(val, oldVal) { - const { mapLayers, zoom } = this + const { mapLayers } = this if (mapLayers != null && val !== oldVal) { mapLayers.setCenter(new CLatLng(val.lat, val.lng)) } }, 'center.lng'(val, oldVal) { - const { mapLayers, zoom, center } = this + const { mapLayers, center } = this if (mapLayers != null && val !== oldVal) { mapLayers.setCenter(new CLatLng(center.lat, val)) } }, 'center.lat'(val, oldVal) { - const { mapLayers, zoom, center } = this + const { mapLayers, center } = this if (mapLayers != null && val !== oldVal) { mapLayers.setCenter(new CLatLng(val, center.lng)) } @@ -135,33 +135,39 @@ return } const $el = this.$refs.map - // 影像和矢量地图 - // const sateLayer = new CTileLayer(2, 18, 'sate', null, null)// 影像 - // const sateLabelLayer = new CTileLayer(2, 18, 'satelabel', null, null)// 影像注记 - // const mapLayer = new CTileLayer(2, 18, 'map', null, null)// 矢量 - // const mapLabelLayer = new CTileLayer(2, 18, 'maplabel', null, null)// 矢量注记 + /* 默认影像和矢量地图,此处无用 + const sateLayer = new CTileLayer(2, 18, 'sate', null, null)// 影像 + const sateLabelLayer = new CTileLayer(2, 18, 'satelabel', null, null)// 影像注记 + const mapLayer = new CTileLayer(2, 18, 'map', null, null)// 矢量 + const mapLabelLayer = new CTileLayer(2, 18, 'maplabel', null, null)// 矢量注记 + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') + const SATEMAP = new CMapType([sateLayer, sateLabelLayer], '影像')*/ - var tianditusateLayer = new CTileLayer({ - zbound: [2, 18], - tileName: 'sate', - subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], - url: 'http://t{s}.tianditu.com/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' - }) - - var tianditusateLabelLayer = new CTileLayer({ - zbound: [2, 18], - tileName: 'satelabel', - subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], - url: 'http://t{s}.tianditu.com/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' - }) - - var tianditumapLayer = new CTileLayer({ + /** + * 天地图影像和资源 + */ + // 天地图卫星影像资源,此处无用 + // const tianditusateLayer = new CTileLayer({ + // zbound: [2, 18], + // tileName: 'sate', + // subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], + // url: 'http://t{s}.tianditu.com/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' + // }) + // 天地图卫星影像资源备注资源,此处无用 + // const tianditusateLabelLayer = new CTileLayer({ + // zbound: [2, 18], + // tileName: 'satelabel', + // subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], + // url: 'http://t{s}.tianditu.com/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' + // }) + // 天地图矢量地图 + const tianditumapLayer = new CTileLayer({ zbound: [2, 18], tileName: 'map', subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], url: 'http://t{s}.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) - + // 天地图矢量地图标注 const tianditumapLabelLayer = new CTileLayer({ zbound: [2, 18], tileName: 'maplabel', @@ -169,14 +175,8 @@ url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) - const TianDiTuBASEMAP = new CMapType([tianditumapLayer], '矢量') - const TianDiTuVECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') - const TianDiTuSATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') - const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') - // const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') - // const SATEMAP = new CMapType([sateLayer, sateLabelLayer], '影像') + // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') const { getCenterPoint, zoom } = this // 初始化配置 @@ -233,7 +233,7 @@ // overlay.openPopup() // 添加点击事件 console.log('添加点击事件') - const clickEvent = CEvent.addListener(overlay, 'click', function(e) { + CEvent.addListener(overlay, 'click', function(e) { console.log('click overlay') getWellAlarms(e.target.options.wellId).then(response => { if (response.code === 200) { @@ -269,6 +269,7 @@ }, // 清除报警图层 clearAlarmMarkers() { + const { mapLayers } = this // 清除报警标注图层 for (const overlay of this.overlays) { mapLayers.clearOverlay(overlay) // 清除地图上所有的overlay @@ -402,7 +403,7 @@ }, drawFeature(id, list, bounds) { console.log('drawFeature') - const { mapLayers, layerInfoManager, featureLayerManager, layerId, overlayManager } = this + const { mapLayers, featureLayerManager, layerId } = this if (list == null) return if (featureLayerManager[layerId] == null) { const featuresLayer = new CFeatureGroup() @@ -460,7 +461,7 @@ }) }, addMarker(id, data, icons) { - const { mapLayers, layerInfoManager, featureLayerManager, overlayManager } = this + const { layerInfoManager, featureLayerManager } = this var style = '' if (data.style != null) { style = data.style @@ -503,7 +504,7 @@ }, // 打开弹窗 openAlarmInfoWindow(wellId) { - const { mapLayers, position, size, anchor, popupAnchor, alarmMarkers, overlays } = this + const { mapLayers } = this for (const overlay of this.overlays) { if (overlay.options.wellId === wellId) { getWellAlarms(wellId).then(response => { @@ -543,7 +544,7 @@ }, // 打开井信息弹窗 openInfoWindow(wellId, e) { - const { mapLayers, position, size, anchor, popupAnchor, alarmMarkers, overlays } = this + const { mapLayers } = this getWellInfo(wellId).then(response => { if (response.code === 200) { const wellInfo = response.data diff --git a/src/components/CMap/base/mixins/common.js b/src/components/CMap/base/mixins/common.js index ce9d836..c634e47 100644 --- a/src/components/CMap/base/mixins/common.js +++ b/src/components/CMap/base/mixins/common.js @@ -57,7 +57,9 @@ default: mapLayers[types[prop.type].unload](originInstance) } - } catch (e) {} + } catch (e) { + console.log(e) + } } } this.computed = { diff --git a/src/components/CMap/components/cmap.vue b/src/components/CMap/components/cmap.vue index 9bfc2dd..4494f00 100644 --- a/src/components/CMap/components/cmap.vue +++ b/src/components/CMap/components/cmap.vue @@ -88,19 +88,19 @@ }, watch: { center(val, oldVal) { - const { mapLayers, zoom } = this + const { mapLayers } = this if (mapLayers != null && val !== oldVal) { mapLayers.setCenter(new CLatLng(val.lat, val.lng)) } }, 'center.lng'(val, oldVal) { - const { mapLayers, zoom, center } = this + const { mapLayers, center } = this if (mapLayers != null && val !== oldVal) { mapLayers.setCenter(new CLatLng(center.lat, val)) } }, 'center.lat'(val, oldVal) { - const { mapLayers, zoom, center } = this + const { mapLayers, center } = this if (mapLayers != null && val !== oldVal) { mapLayers.setCenter(new CLatLng(val, center.lng)) } @@ -135,33 +135,39 @@ return } const $el = this.$refs.map - // 影像和矢量地图 - // const sateLayer = new CTileLayer(2, 18, 'sate', null, null)// 影像 - // const sateLabelLayer = new CTileLayer(2, 18, 'satelabel', null, null)// 影像注记 - // const mapLayer = new CTileLayer(2, 18, 'map', null, null)// 矢量 - // const mapLabelLayer = new CTileLayer(2, 18, 'maplabel', null, null)// 矢量注记 + /* 默认影像和矢量地图,此处无用 + const sateLayer = new CTileLayer(2, 18, 'sate', null, null)// 影像 + const sateLabelLayer = new CTileLayer(2, 18, 'satelabel', null, null)// 影像注记 + const mapLayer = new CTileLayer(2, 18, 'map', null, null)// 矢量 + const mapLabelLayer = new CTileLayer(2, 18, 'maplabel', null, null)// 矢量注记 + const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') + const SATEMAP = new CMapType([sateLayer, sateLabelLayer], '影像')*/ - var tianditusateLayer = new CTileLayer({ - zbound: [2, 18], - tileName: 'sate', - subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], - url: 'http://t{s}.tianditu.com/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' - }) - - var tianditusateLabelLayer = new CTileLayer({ - zbound: [2, 18], - tileName: 'satelabel', - subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], - url: 'http://t{s}.tianditu.com/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' - }) - - var tianditumapLayer = new CTileLayer({ + /** + * 天地图影像和资源 + */ + // 天地图卫星影像资源,此处无用 + // const tianditusateLayer = new CTileLayer({ + // zbound: [2, 18], + // tileName: 'sate', + // subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], + // url: 'http://t{s}.tianditu.com/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' + // }) + // 天地图卫星影像资源备注资源,此处无用 + // const tianditusateLabelLayer = new CTileLayer({ + // zbound: [2, 18], + // tileName: 'satelabel', + // subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], + // url: 'http://t{s}.tianditu.com/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' + // }) + // 天地图矢量地图 + const tianditumapLayer = new CTileLayer({ zbound: [2, 18], tileName: 'map', subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'], url: 'http://t{s}.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) - + // 天地图矢量地图标注 const tianditumapLabelLayer = new CTileLayer({ zbound: [2, 18], tileName: 'maplabel', @@ -169,14 +175,8 @@ url: 'http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=80310778300778a15b36e70a6da5af00' }) - const TianDiTuBASEMAP = new CMapType([tianditumapLayer], '矢量') - const TianDiTuVECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') - const TianDiTuSATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') - const VECTORMAP = new CMapType([tianditumapLayer, tianditumapLabelLayer], '矢量') - const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') - // const VECTORMAP = new CMapType([mapLayer, mapLabelLayer], '矢量') - // const SATEMAP = new CMapType([sateLayer, sateLabelLayer], '影像') + // const SATEMAP = new CMapType([tianditusateLayer, tianditusateLabelLayer], '影像') const { getCenterPoint, zoom } = this // 初始化配置 @@ -233,7 +233,7 @@ // overlay.openPopup() // 添加点击事件 console.log('添加点击事件') - const clickEvent = CEvent.addListener(overlay, 'click', function(e) { + CEvent.addListener(overlay, 'click', function(e) { console.log('click overlay') getWellAlarms(e.target.options.wellId).then(response => { if (response.code === 200) { @@ -269,6 +269,7 @@ }, // 清除报警图层 clearAlarmMarkers() { + const { mapLayers } = this // 清除报警标注图层 for (const overlay of this.overlays) { mapLayers.clearOverlay(overlay) // 清除地图上所有的overlay @@ -402,7 +403,7 @@ }, drawFeature(id, list, bounds) { console.log('drawFeature') - const { mapLayers, layerInfoManager, featureLayerManager, layerId, overlayManager } = this + const { mapLayers, featureLayerManager, layerId } = this if (list == null) return if (featureLayerManager[layerId] == null) { const featuresLayer = new CFeatureGroup() @@ -460,7 +461,7 @@ }) }, addMarker(id, data, icons) { - const { mapLayers, layerInfoManager, featureLayerManager, overlayManager } = this + const { layerInfoManager, featureLayerManager } = this var style = '' if (data.style != null) { style = data.style @@ -503,7 +504,7 @@ }, // 打开弹窗 openAlarmInfoWindow(wellId) { - const { mapLayers, position, size, anchor, popupAnchor, alarmMarkers, overlays } = this + const { mapLayers } = this for (const overlay of this.overlays) { if (overlay.options.wellId === wellId) { getWellAlarms(wellId).then(response => { @@ -543,7 +544,7 @@ }, // 打开井信息弹窗 openInfoWindow(wellId, e) { - const { mapLayers, position, size, anchor, popupAnchor, alarmMarkers, overlays } = this + const { mapLayers } = this getWellInfo(wellId).then(response => { if (response.code === 200) { const wellInfo = response.data diff --git a/src/components/CMap/components/cmapMarker.vue b/src/components/CMap/components/cmapMarker.vue index 3218153..f2b4289 100644 --- a/src/components/CMap/components/cmapMarker.vue +++ b/src/components/CMap/components/cmapMarker.vue @@ -5,7 +5,6 @@