Commit 04d91f49 authored by xxx's avatar xxx

修改定位判断方法

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