Commit c9f92deb authored by youjie's avatar youjie

no message

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