|
@@ -1,5 +1,11 @@
|
|
|
<template>
|
|
|
<div class="mapItems">
|
|
|
+ <div class="mapMasp" v-if="loadding">
|
|
|
+ <div class="el-loading-spinner">
|
|
|
+ <i class="el-icon-loading"></i>
|
|
|
+ <div class="el-loading-text">地图加载中</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<div class="topSelect">
|
|
|
<div></div>
|
|
|
</div>
|
|
@@ -15,56 +21,22 @@ export default {
|
|
|
marker: '',
|
|
|
addressName: '', //地址查询名称
|
|
|
poisArray: [],
|
|
|
- thisMapPot: {}
|
|
|
+ thisMapPot: {},
|
|
|
+ loadding: true
|
|
|
};
|
|
|
},
|
|
|
mounted() {},
|
|
|
computed: {},
|
|
|
methods: {
|
|
|
init() {
|
|
|
- let _this = this;
|
|
|
this.map = new AMap.Map('mapInit', {
|
|
|
- // center: this.params.communityLoc.length == 2 ? this.params.communityLoc : '',
|
|
|
resizeEnable: true, //是否监控地图容器尺寸变化
|
|
|
zoom: 16, //初始化地图层级
|
|
|
mapStyle: 'amap://styles/darkblue'
|
|
|
});
|
|
|
- // this.map.on('complete', () => {
|
|
|
- // if (!!_this.params.location) {
|
|
|
- // let arr = this.params.location.split(',');
|
|
|
- // this.addIcon({ lng: arr[0], lat: arr[1] });
|
|
|
- // }
|
|
|
- // });
|
|
|
-
|
|
|
- // this.map.on('click', this.mapClick);
|
|
|
- // this.placeSearch = new AMap.PlaceSearch({
|
|
|
- // map: _this.map,
|
|
|
- // city: '广东', //020
|
|
|
- // citylimit: true, //定点范围
|
|
|
- // autoFitView: true
|
|
|
- // });
|
|
|
- // AMap.event.addListener(this.placeSearch, 'markerClick', (e) => {
|
|
|
- // this.thisMapPot = e.event.lnglat;
|
|
|
- // this.$message.success('选择成功');
|
|
|
- // });
|
|
|
- },
|
|
|
- addIcon(e) {
|
|
|
- if (!!this.marker) {
|
|
|
- this.map.remove(this.marker);
|
|
|
- this.marker = '';
|
|
|
- }
|
|
|
- this.thisMapPot = e;
|
|
|
- let loc = [e.lng, e.lat];
|
|
|
- this.marker = new AMap.Marker({
|
|
|
- icon: 'https://webapi.amap.com/theme/v1.3/markers/n/mark_b.png',
|
|
|
- position: loc,
|
|
|
- map: this.map
|
|
|
+ this.map.on('complete', () => {
|
|
|
+ this.loadding = false;
|
|
|
});
|
|
|
- this.marker.setLabel({
|
|
|
- offset: new AMap.Pixel(-50, 35),
|
|
|
- content: !!this.params.data.pointName ? `巡更名称:${this.params.data.pointName}` : `巡更经纬度:${e.lng},${e.lat}`
|
|
|
- });
|
|
|
- this.map.setFitView();
|
|
|
}
|
|
|
},
|
|
|
destroyed() {
|
|
@@ -72,14 +44,26 @@ export default {
|
|
|
this.marker = '';
|
|
|
},
|
|
|
created() {
|
|
|
- this.$nextTick(() => {
|
|
|
+ setTimeout(() => {
|
|
|
this.init();
|
|
|
- });
|
|
|
+ }, 100);
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
<style scoped lang="scss">
|
|
|
@import '@assets/css/public-style.scss';
|
|
|
+.mapMasp {
|
|
|
+ position: absolute;
|
|
|
+ z-index: 2000;
|
|
|
+ background-color: rgba(0, 0, 0, 1);
|
|
|
+ margin: 0;
|
|
|
+ top: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+ left: 0;
|
|
|
+ -webkit-transition: opacity 0.3s;
|
|
|
+ transition: opacity 0.3s;
|
|
|
+}
|
|
|
.mapItems {
|
|
|
height: 100%;
|
|
|
position: relative;
|
|
@@ -96,7 +80,6 @@ export default {
|
|
|
height: 100%;
|
|
|
/deep/ .amap-marker-label {
|
|
|
border: 0 none;
|
|
|
- background-color: #fff;
|
|
|
white-space: nowrap;
|
|
|
box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.3);
|
|
|
border-radius: 5px;
|