Commit ef3e079d authored by xxx's avatar xxx

1

parent a559645e
...@@ -59,6 +59,7 @@ export default { ...@@ -59,6 +59,7 @@ export default {
} }
}, },
mounted(){ mounted(){
let that = this;
this.sonTimer1 = setInterval(() => { this.sonTimer1 = setInterval(() => {
if(this.carnumber == ''){ if(this.carnumber == ''){
return; return;
...@@ -120,21 +121,44 @@ export default { ...@@ -120,21 +121,44 @@ export default {
} }
} }
//获取车辆坐标计算距离并返回给后台 //获取车辆坐标计算距离并返回给后台
httpGet(carRealTimeLocationQuery2,{name:resSon1.data.content[0].equipmentName}).then((res2) => { // httpGet(carRealTimeLocationQuery2,{name:resSon1.data.content[0].equipmentName}).then((res2) => {
if(res2.data){ // if(res2.data){
if(this.oldxy.lat == 0 || this.oldxy.lng == 0){ // if(this.oldxy.lat == 0 || this.oldxy.lng == 0){
this.oldxy.lat = res2.data.location.y; // this.oldxy.lat = res2.data.location.y;
this.oldxy.lng = res2.data.location.x; // 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_1.data.content[0].mil);
// putForJson(dingDanBiaoCaoZuo,{id:res_1.data.content[0].id,mil:distance1}).then((res) => {});
// this.$nextTick(()=>{
// this.oldxy.lat = res2.data.location.y;
// this.oldxy.lng = res2.data.location.x;
// })
// }
// }
// });
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
function(position) {
if(that.oldxy.lat == 0 || that.oldxy.lng == 0){
that.oldxy.lat = position.coords.latitude;
that.oldxy.lng = position.coords.longitude;
}else{ }else{
let distance1 = this.getDistance(this.oldxy.lat,this.oldxy.lng,res2.data.location.y,res2.data.location.x) + parseFloat(res_1.data.content[0].mil); let distance1 = that.getDistance(that.oldxy.lat,that.oldxy.lng,position.coords.latitude,position.coords.longitude) + parseFloat(res_1.data.content[0].mil);
putForJson(dingDanBiaoCaoZuo,{id:res_1.data.content[0].id,mil:distance1}).then((res) => {}); putForJson(dingDanBiaoCaoZuo,{id:res_1.data.content[0].id,mil:distance1}).then((res) => {});
this.$nextTick(()=>{ that.$nextTick(()=>{
this.oldxy.lat = res2.data.location.y; that.oldxy.lat = position.coords.latitude;
this.oldxy.lng = res2.data.location.x; that.oldxy.lng = position.coords.longitude;
}) })
} }
},
function(error) {
var errorType = ['您拒绝共享位置信息', '获取不到位置信息', '获取位置信息超时'];
console.log(errorType[error.code - 1]);
},{
enableHighAccuracy: true,
}
);
} }
});
} }
}); });
} }
...@@ -676,7 +700,6 @@ export default { ...@@ -676,7 +700,6 @@ export default {
} }
//获取当前系统时间 格式(yyyy-mm-dd hh:mm:ss) //获取当前系统时间 格式(yyyy-mm-dd hh:mm:ss)
let currentFormatDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds; let currentFormatDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
//console.log(currentFormatDate);
return currentFormatDate; return currentFormatDate;
}, },
//判断卸车是车是否到达了卸区 //判断卸车是车是否到达了卸区
......
...@@ -263,7 +263,7 @@ export default { ...@@ -263,7 +263,7 @@ export default {
vehiIdno:that.carnumber vehiIdno:that.carnumber
} }
}).then(function (response2) { }).then(function (response2) {
if(response2.data.devices.length != 0){ if(response2.data.result == 0 && response2.data.devices.length != 0){
that.devices = response2.data.devices[0].did; that.devices = response2.data.devices[0].did;
} }
}) })
......
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