Commit c9f92deb authored by youjie's avatar youjie

no message

parent 4a450458
......@@ -67,8 +67,7 @@
<span class="MapImgButtom CancelMapImg" @click="Cancel">取消</span>
</div>
<div style="margin-left: 20px;">
<!-- setLoading=true, -->
<span class="MapImgButtom setMapImg" @click="getResultImg">生成图片</span>
<span class="MapImgButtom setMapImg" @click="setLoading=true,getResultImg">生成图片</span>
</div>
</div>
</div>
......@@ -122,11 +121,12 @@ export default {
watch: {
citiesData: {
handler(val, oldVal) {
this.TripMapList.forEach(x => {
this.TripMapList.length>0&&this.TripMapList.forEach(x => {
x.CityList.forEach(y=>{
this.citiesData.forEach(z=>{
if(y.MName==z.name&&y.PositionStr.Left){
z.PositionStr = JSON.parse(JSON.stringify(y.PositionStr))
if(y.MName==z.name&&y.Lng){
z.Lng = y.Lng
z.Lat = y.Lat
}
})
})
......@@ -160,6 +160,8 @@ export default {
MapLevel: 0,
MapUrl: "",
ParentId: 0,
Lng: "",
Lat: "",
PositionStr: {
Bottom: 0,
Left: 0,
......@@ -232,13 +234,13 @@ export default {
x.CityList.forEach(y=>{
this.citiesData.forEach(z=>{
if(y.MName==z.name){
y.PositionStr = JSON.parse(JSON.stringify(z.PositionStr))
y.Lng = z.Lng
y.Lat = z.Lat
}
})
})
})
this.dataAll.TripMapList = JSON.parse(JSON.stringify(this.TripMapList))
// this.$forceUpdate()
},
// 导出地图片
getResultImg() {
......@@ -262,25 +264,14 @@ export default {
let allPath = that.domainManager().ViittoFileUrl + x.data.FilePath;
that.dataAll.Mapurl = allPath
that.$emit('Success',allPath)
}else{
that.setLoading = false
}
})
return
image.download = "map.png";
image.click();
that.setLoading = false
that.deviceMarkers.forEach((x,index)=>{
var currentMarkerLngLat = x.getLngLat();
this.citiesData.forEach(y=>{
if(y.longitude!=currentMarkerLngLat.lng||y.latitude!=currentMarkerLngLat.lat){
y.PositionStr.Left = currentMarkerLngLat.lng
y.PositionStr.Right = currentMarkerLngLat.lat
}else{
y.PositionStr.Top = currentMarkerLngLat.lng
y.PositionStr.Bottom = currentMarkerLngLat.lat
}
})
})
});
},
Cancel(){
......@@ -335,8 +326,9 @@ export default {
this.TripMapList.forEach(x => {
x.CityList.forEach(y=>{
this.citiesData.forEach(z=>{
if(y.MName==z.name&&y.PositionStr.Left!=0){
z.PositionStr = JSON.parse(JSON.stringify(y.PositionStr))
if(y.MName==z.name&&y.Lng){
z.Lng = y.Lng
z.Lat = y.Lat
}
})
})
......@@ -393,6 +385,8 @@ export default {
MapLevel: 0,
MapUrl: "",
ParentId: null,
Lng: "",
Lat: "",
PositionStr: {
Bottom: 0,
Left: 0,
......@@ -434,6 +428,8 @@ export default {
MapLevel: 0,
MapUrl: "",
ParentId: x.MId,
Lng: "",
Lat: "",
PositionStr: {
Bottom: 0,
Left: 0,
......@@ -526,8 +522,8 @@ export default {
var marker = new mapboxgl.Marker({ color: "#d73b33", scale: 0.5 })
.setLngLat([item.longitude, item.latitude])
.addTo(this.map);
if(item.PositionStr.Left&&item.PositionStr.Right){
this.addLabel(item, i, item.PositionStr);
if(item.Lng&&item.Lat){
this.addLabel(item, i, item);
}else{
this.addLabel(item, i);
}
......@@ -550,19 +546,16 @@ export default {
draggable: true
})
if(PositionStr){
marker.setLngLat([PositionStr.Left, PositionStr.Right])
marker.setLngLat([PositionStr.Lng, PositionStr.Lat])
}else{
marker.setLngLat([item.longitude, item.latitude])
}
// marker.setLngLat([item.PositionStr.Left?item.PositionStr.Left:item.longitude, item.PositionStr.Right?item.PositionStr.Right:item.latitude])
marker.addTo(this.map);
let currentMarkerLngLat = marker.getLngLat();
// that.citiesData[i].PositionStr.Left = currentMarkerLngLat.lng
// that.citiesData[i].PositionStr.Right = currentMarkerLngLat.lat
marker.on('dragend', function() {
currentMarkerLngLat = marker.getLngLat();
that.citiesData[i].PositionStr.Left = currentMarkerLngLat.lng
that.citiesData[i].PositionStr.Right = currentMarkerLngLat.lat
let currentMarkerLngLat = marker.getLngLat();
that.citiesData[i].Lng = currentMarkerLngLat.lng
that.citiesData[i].Lat = currentMarkerLngLat.lat
that.SavePositionStr()
});
......@@ -581,13 +574,7 @@ export default {
const data = await response.json();
if (data.features.length > 0) {
const [longitude, latitude] = data.features[0].center;
this.citiesData.push({ name: cityName, longitude, latitude,
PositionStr:{
Left: 0,
Top: 0,
Right: 0,
Bottom: 0,
}
this.citiesData.push({ name: cityName, longitude, latitude, Lng: "", Lat: ""
});
} else {
this.coordinates = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment