|
@@ -184,7 +184,7 @@
|
|
|
/>
|
|
|
|
|
|
<!-- 添加或修改标记物管理对话框 -->
|
|
|
- <el-dialog :title="title" :visible.sync="open" width="80%" append-to-body>
|
|
|
+ <el-dialog :title="title" :visible.sync="open" width="80%" @close="closeDialog" append-to-body>
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
|
<el-tabs v-model="activeName" @tab-click="handleClick">
|
|
|
<el-tab-pane label="基础信息" name="first">
|
|
@@ -386,7 +386,8 @@ export default {
|
|
|
baseUrl: process.env.VUE_APP_BASE_API,
|
|
|
labelList: undefined,
|
|
|
contentList: [],
|
|
|
- contentIdsList: []
|
|
|
+ contentIdsList: [],
|
|
|
+ positionList: []
|
|
|
|
|
|
};
|
|
|
},
|
|
@@ -559,6 +560,7 @@ export default {
|
|
|
},
|
|
|
/**初始化地图 */
|
|
|
initMap () {
|
|
|
+ this.positionList = []
|
|
|
this.TMap().then(_tmap => {
|
|
|
this.tmap = _tmap
|
|
|
console.log(this.$refs.containerRef)
|
|
@@ -605,12 +607,22 @@ export default {
|
|
|
|
|
|
}
|
|
|
|
|
|
- var centerMarker = new _tmap.LatLng(this.form.lat, this.form.lng)
|
|
|
- console.log(center)
|
|
|
- var geometrie = {
|
|
|
- position: centerMarker
|
|
|
- }
|
|
|
- this.marker.setGeometries([geometrie])
|
|
|
+ // var centerMarker = new _tmap.LatLng(this.form.lat, this.form.lng)
|
|
|
+ // console.log(center)
|
|
|
+ // var geometrie = {
|
|
|
+ // position: centerMarker
|
|
|
+ // }
|
|
|
+ var locationSet = JSON.parse(this.form.locationSet)
|
|
|
+ var geometries = []
|
|
|
+ locationSet.forEach((item,index) => {
|
|
|
+ this.positionList.push(item)
|
|
|
+ var position = {
|
|
|
+ "position": new TMap.LatLng(item.lat, item.lng)
|
|
|
+ }
|
|
|
+ geometries.push(position)
|
|
|
+ });
|
|
|
+ console.log(geometries)
|
|
|
+ this.marker.setGeometries(geometries)
|
|
|
} else if (this.form.shapeType == "polyline" && this.form.lat && this.form.lng) {
|
|
|
//线
|
|
|
// var centerPolyline = new _tmap.LatLng(this.form.lat, this.form.lng)
|
|
@@ -687,11 +699,13 @@ export default {
|
|
|
console.log(geometry)
|
|
|
var position = undefined;
|
|
|
var geometries = [geometry]
|
|
|
+
|
|
|
if (this.form.shapeType === "marker") {
|
|
|
position = geometry.position
|
|
|
-
|
|
|
- this.form.locationSet = JSON.stringify(geometry.position);
|
|
|
- this.marker.setGeometries(geometries)
|
|
|
+ this.positionList.push(position);
|
|
|
+ this.form.locationSet = JSON.stringify(this.positionList);
|
|
|
+ console.log(this.form.locationSet)
|
|
|
+ //this.marker.setGeometries(geometries)
|
|
|
} else if (this.form.shapeType === "polyline") {
|
|
|
position = geometry.paths[0]
|
|
|
this.form.locationSet = JSON.stringify(geometry.paths);
|
|
@@ -720,7 +734,6 @@ export default {
|
|
|
if (this.activeName = "second") {
|
|
|
|
|
|
if (!this.map) {
|
|
|
-
|
|
|
setTimeout(() => {
|
|
|
this.initMap()
|
|
|
}, 500);
|
|
@@ -747,7 +760,16 @@ export default {
|
|
|
// selectLabel(this.form.markerType).then(res=>{
|
|
|
// console.log(res);
|
|
|
// })
|
|
|
+ },
|
|
|
+ closeDialog(){
|
|
|
+ this.open = false;
|
|
|
+ if (this.map) {
|
|
|
+ this.map.destroy()
|
|
|
+ this.map = null
|
|
|
+ }
|
|
|
+ this.getList();
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
};
|
|
|
</script>
|