Commit 04d91f49 authored by xxx's avatar xxx

修改定位判断方法

parent e7e43b5b
......@@ -252,22 +252,22 @@ export default {
})
//三秒后位置
graphicLayer4.eachGraphic((graphic) => {
graphic.addDynamicPosition(Cesium.Cartesian3.fromDegrees(that.defaultjd, that.defaultwd, 1000), 3)
graphic.addDynamicPosition(Cesium.Cartesian3.fromDegrees(that.defaultjd, that.defaultwd, 1000), 1)
})
//定时更新动态位置
setInterval(() => {
httpGet(carRealTimeLocationQuery2,{name:equipmentName}).then((res) => {
if(res.data){
graphicLayer4.eachGraphic((graphic) => {
graphic.addDynamicPosition(Cesium.Cartesian3.fromDegrees(res.data.location.x, res.data.location.y, 1000), 3)
graphic.addDynamicPosition(Cesium.Cartesian3.fromDegrees(res.data.location.x, res.data.location.y, 1000), 1)
})
}else{
graphicLayer4.eachGraphic((graphic) => {
graphic.addDynamicPosition(Cesium.Cartesian3.fromDegrees(that.defaultjd, that.defaultwd, 1000), 3)
graphic.addDynamicPosition(Cesium.Cartesian3.fromDegrees(that.defaultjd, that.defaultwd, 1000), 1)
})
}
});
}, 2500)
}, 1000)
},
// 装车箭头线 graphicLayer.removeGraphic(graphic);
......
......@@ -136,7 +136,6 @@ export default {
personalName:'',
zongTimer1:null,
zongTimer2:null,
zongTimer3:null,
currentTime:'',
selectFunction:0,
carnumber:'',
......@@ -177,12 +176,10 @@ export default {
this.setNowTimes();
this.zongTimer1 = setInterval(() => {
this.setNowTimes();
}, 1000)
this.zongTimer3 = setInterval(() => {
if(this.equipmentName){
if(this.equipmentName){
this.getCarLoaction();
}
}, 2000)
}, 1000)
this.zongTimer2 = setInterval(() => {
if(this.carnumber == ''){
return
......@@ -364,24 +361,40 @@ export default {
let LoaObj1 = {};
let LoaObj1xy = {};
//判断该车是否在行驶状态
if(that.getDistanceIndex(that.navigatorXY.y,that.navigatorXY.x,position.coords.latitude,position.coords.longitude) <= 1){
let drivingDistance = that.getDistanceIndex(that.navigatorXY.y,that.navigatorXY.x,position.coords.latitude,position.coords.longitude);
console.log(drivingDistance);
if(drivingDistance <= 1){
that.leftBtnDisable = true;
}else{
that.leftBtnDisable = false;
}
LoaObj1xy.x = position.coords.longitude;
LoaObj1xy.y = position.coords.latitude;
that.navigatorXY.x = position.coords.longitude;
that.navigatorXY.y = position.coords.latitude;
LoaObj1.gndRate = '';
LoaObj1.location = LoaObj1xy;
LoaObj1.name = that.equipmentName;
LoaObj1.time = new Date().getTime();
let zuizhong1 = {};
zuizhong1.name = that.equipmentName;
zuizhong1.jsonObject = JSON.stringify(LoaObj1);
httpPostForJson(gpsPhoneGpsQuery,zuizhong1).then((res1) => {})
httpPostForJson(carRealTimeLocationQuery2,JSON.stringify(LoaObj1)).then((res2) => {})
if(drivingDistance > 10 && drivingDistance < 10000){
LoaObj1xy.x = that.navigatorXY.x;
LoaObj1xy.y = that.navigatorXY.y;
LoaObj1.gndRate = '';
LoaObj1.location = LoaObj1xy;
LoaObj1.name = that.equipmentName;
LoaObj1.time = new Date().getTime();
let zuizhong1 = {};
zuizhong1.name = that.equipmentName;
zuizhong1.jsonObject = JSON.stringify(LoaObj1);
httpPostForJson(gpsPhoneGpsQuery,zuizhong1).then((res1) => {})
httpPostForJson(carRealTimeLocationQuery2,JSON.stringify(LoaObj1)).then((res2) => {})
}else{
LoaObj1xy.x = position.coords.longitude;
LoaObj1xy.y = position.coords.latitude;
that.navigatorXY.x = position.coords.longitude;
that.navigatorXY.y = position.coords.latitude;
LoaObj1.gndRate = '';
LoaObj1.location = LoaObj1xy;
LoaObj1.name = that.equipmentName;
LoaObj1.time = new Date().getTime();
let zuizhong1 = {};
zuizhong1.name = that.equipmentName;
zuizhong1.jsonObject = JSON.stringify(LoaObj1);
httpPostForJson(gpsPhoneGpsQuery,zuizhong1).then((res1) => {})
httpPostForJson(carRealTimeLocationQuery2,JSON.stringify(LoaObj1)).then((res2) => {})
}
},
//locationError 获取失败的话
function(error) {
......@@ -714,12 +727,11 @@ export default {
this.$refs.startOrderReceivingMethod.dingshiqiCloseFn();
if(this.zongTimer1) {
clearInterval(this.zongTimer1);
this.zongTimer1 = null;
}
if(this.zongTimer2) {
clearInterval(this.zongTimer2);
}
if(this.zongTimer3) {
clearInterval(this.zongTimer3);
this.zongTimer2 = 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