Commit b99fd2d9 authored by xxx's avatar xxx

1

parent 9df807eb
...@@ -42,6 +42,11 @@ export default { ...@@ -42,6 +42,11 @@ export default {
dingDanId:'', dingDanId:'',
equipmentName:'',//车载设备编号 equipmentName:'',//车载设备编号
xiecheBtnAble:false,//卸车按钮是否能用 xiecheBtnAble:false,//卸车按钮是否能用
//暂存的经纬度
oldxy:{
lat:0,//纬度
lng:0,//经度
},
} }
}, },
mounted(){ mounted(){
...@@ -97,6 +102,22 @@ export default { ...@@ -97,6 +102,22 @@ export default {
}); });
} }
} }
//获取车辆坐标计算距离并返回给后台
httpGet(carRealTimeLocationQuery2,{name:resSon1.data.content[0].equipmentName}).then((res2) => {
if(res2.data){
if(this.oldxy.lat == 0 || this.oldxy.lng == 0){
this.oldxy.lat = res2.data.location.y;
this.oldxy.lng = res2.data.location.x;
}else{
let distance1 = this.getDistance(this.oldxy.lat,this.oldxy.lng,res2.data.location.y,res2.data.location.x) + parseFloat(res.data.content[0].mil);
putForJson(dingDanBiaoCaoZuo,{id:res.data.content[0].id,mil:distance1}).then((res) => {});
this.$nextTick(()=>{
this.oldxy.lat = res2.data.location.y;
this.oldxy.lng = res2.data.location.x;
})
}
}
});
} }
}); });
} }
...@@ -131,6 +152,22 @@ export default { ...@@ -131,6 +152,22 @@ export default {
this.dingDanId = res.data.content[0].id; this.dingDanId = res.data.content[0].id;
} }
} }
//获取车辆坐标计算距离并返回给后台
httpGet(carRealTimeLocationQuery2,{name:resSon1.data.content[0].equipmentName}).then((res2) => {
if(res2.data){
if(this.oldxy.lat == 0 || this.oldxy.lng == 0){
this.oldxy.lat = res2.data.location.y;
this.oldxy.lng = res2.data.location.x;
}else{
let distance1 = this.getDistance(this.oldxy.lat,this.oldxy.lng,res2.data.location.y,res2.data.location.x) + parseFloat(res.data.content[0].mil);
putForJson(dingDanBiaoCaoZuo,{id:res.data.content[0].id,mil:distance1}).then((res) => {});
this.$nextTick(()=>{
this.oldxy.lat = res2.data.location.y;
this.oldxy.lng = res2.data.location.x;
})
}
}
});
} }
}); });
} }
...@@ -192,6 +229,7 @@ export default { ...@@ -192,6 +229,7 @@ export default {
refusePaidanFn(){ refusePaidanFn(){
this.btnShow1 = false; this.btnShow1 = false;
this.showDe = false; this.showDe = false;
this.$notify({ this.$notify({
title: '已拒绝派单!', title: '已拒绝派单!',
type: 'success', type: 'success',
...@@ -212,6 +250,10 @@ export default { ...@@ -212,6 +250,10 @@ export default {
} }
}); });
httpDelForJson(dingDanBiaoCaoZuo,[this.dingDanId]).then((res) => {}); httpDelForJson(dingDanBiaoCaoZuo,[this.dingDanId]).then((res) => {});
this.$nextTick(()=>{
this.oldxy.lat = 0;
this.oldxy.lng = 0;
})
}, },
//卸车 //卸车
finishPaidanFn(){ finishPaidanFn(){
...@@ -241,7 +283,10 @@ export default { ...@@ -241,7 +283,10 @@ export default {
httpDelForJson(dingDanBiaoCaoZuo,[this.dingDanId]).then((res) => { httpDelForJson(dingDanBiaoCaoZuo,[this.dingDanId]).then((res) => {
//this.$parent.zhixinglujing2(false); //this.$parent.zhixinglujing2(false);
}); });
this.$nextTick(()=>{
this.oldxy.lat = 0;
this.oldxy.lng = 0;
})
} }
}, },
//获取当前时间 //获取当前时间
...@@ -336,6 +381,17 @@ export default { ...@@ -336,6 +381,17 @@ export default {
return true; return true;
} }
}, },
//根据两个经纬度计算距离
getDistance(lat1, lng1, lat2, lng2) {
var radLat1 = lat1 * Math.PI / 180.0;
var radLat2 = lat2 * Math.PI / 180.0;
var a = radLat1 - radLat2;
var b = lng1 * Math.PI / 180.0 - lng2 * Math.PI / 180.0;
var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
s = s * 6378.137 // EARTH_RADIUS;
s = Math.round(s * 10000) / 10000;
return s
},
}, },
beforeDestroy() { beforeDestroy() {
......
...@@ -134,11 +134,6 @@ export default { ...@@ -134,11 +134,6 @@ export default {
batteryEnegy:0, batteryEnegy:0,
//判断卸车1 //判断卸车1
boo1:false, boo1:false,
//暂存的经纬度
oldxy:{
lat:0,//纬度
lng:0,//经度
},
} }
}, },
mounted(){ mounted(){
...@@ -179,22 +174,7 @@ export default { ...@@ -179,22 +174,7 @@ export default {
}); });
} }
}); });
//获取车辆坐标计算距离并返回给后台
httpGet(carRealTimeLocationQuery2,{name:res.data.content[0].equipmentName}).then((res2) => {
if(res2.data){
if(this.oldxy.lat == 0 || this.oldxy.lng == 0){
this.oldxy.lat = res2.data.location.y;
this.oldxy.lng = res2.data.location.x;
}else{
let distance1 = this.getDistance(this.oldxy.lat,this.oldxy.lng,res2.data.location.y,res2.data.location.x) + parseFloat(res.data.content[0].odo);
putForJson(vehicleInformationUpdate,{id:res.data.content[0].id,odo:distance1}).then((res) => {});
this.$nextTick(()=>{
this.oldxy.lat = res2.data.location.y;
this.oldxy.lng = res2.data.location.x;
})
}
}
});
} }
} }
}); });
...@@ -528,17 +508,6 @@ export default { ...@@ -528,17 +508,6 @@ export default {
} }
}); });
}, },
//根据两个经纬度计算距离
getDistance(lat1, lng1, lat2, lng2) {
var radLat1 = lat1 * Math.PI / 180.0;
var radLat2 = lat2 * Math.PI / 180.0;
var a = radLat1 - radLat2;
var b = lng1 * Math.PI / 180.0 - lng2 * Math.PI / 180.0;
var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
s = s * 6378.137 // EARTH_RADIUS;
s = Math.round(s * 10000) / 10000;
return s
},
//执行路径 //执行路径
zhixinglujing(boo){ zhixinglujing(boo){
//this.$refs.mars3dViewerMapMethod.addArrowGraphic3(boo); //this.$refs.mars3dViewerMapMethod.addArrowGraphic3(boo);
......
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