|
@@ -136,7 +136,7 @@
|
|
|
</div>
|
|
|
<div class="bottom-left">
|
|
|
<div class="currStatus">
|
|
|
- <div id="map" ref="mapContainer" style="width:800px;height:800px;"></div>
|
|
|
+ <div id="map" ref="mapContainer" style="width:800px;height:600px;"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -168,14 +168,15 @@ export default {
|
|
|
content: '处置时间',
|
|
|
timestamp: '2018-04-11'
|
|
|
}],
|
|
|
- longitude: "",
|
|
|
- latitude: "",
|
|
|
+ longitude: 116.404177,
|
|
|
+ latitude: 39.909652,
|
|
|
markerLayer: [],
|
|
|
map: null,
|
|
|
listQuery: {
|
|
|
sn: ''
|
|
|
},
|
|
|
- detail: {}
|
|
|
+ detail: {},
|
|
|
+ isMaker: false
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -187,7 +188,7 @@ export default {
|
|
|
mounted() {
|
|
|
let that = this
|
|
|
// this.markerLayer = new TMap.MultiMarker({});
|
|
|
- that.init()
|
|
|
+ // that.init()
|
|
|
|
|
|
},
|
|
|
// destroyed () {
|
|
@@ -204,11 +205,19 @@ export default {
|
|
|
init() {
|
|
|
// 定义地图中心点坐标
|
|
|
let that = this
|
|
|
- let center = new window.qq.maps.LatLng(39.916527, 116.397128)
|
|
|
+ let lat = that.latitude
|
|
|
+ let lng = that.longitude
|
|
|
+ let center = new window.qq.maps.LatLng(lat, lng)
|
|
|
+ let zoom = 0
|
|
|
+ if(that.isMaker) {
|
|
|
+ zoom = 9
|
|
|
+ } else {
|
|
|
+ zoom = 4
|
|
|
+ }
|
|
|
// 定义map变量,调用 TMap.Map() 构造函数创建地图
|
|
|
let map = new window.qq.maps.Map(that.$refs.mapContainer, {
|
|
|
center: center, // 设置地图中心点坐标
|
|
|
- zoom: 5, // 设置地图缩放级别
|
|
|
+ zoom: zoom, // 设置地图缩放级别
|
|
|
// minZoom:8,
|
|
|
pitch: 43.5, // 设置俯仰角
|
|
|
rotation: 45, // 设置地图旋转角度
|
|
@@ -217,12 +226,19 @@ export default {
|
|
|
position: new window.qq.maps.LatLng(that.detail.lat || 0, that.detail.long || 0),
|
|
|
map: map
|
|
|
})
|
|
|
- this.markerLayer.push(marker)
|
|
|
+ this.markerLayer.push(marker)
|
|
|
+
|
|
|
this.map = map
|
|
|
},
|
|
|
getdetailData() {
|
|
|
workDetail(this.listQuery).then(res => {
|
|
|
this.detail = res.data[0]
|
|
|
+ if(res.data[0].lat > 0) {
|
|
|
+ this.latitude = res.data[0].lat
|
|
|
+ this.longitude = res.data[0].long
|
|
|
+ this.isMaker = true
|
|
|
+ }
|
|
|
+ this.init()
|
|
|
})
|
|
|
}
|
|
|
},
|