|
@@ -382,10 +382,16 @@ export default {
|
|
|
//校验查询时间
|
|
|
changeTime() {
|
|
|
let that = this;
|
|
|
+ console.log("that.time")
|
|
|
+ console.log(that.time)
|
|
|
+
|
|
|
if(that.time!=null&&that.time.length==2){
|
|
|
- if (that.time[1] - that.time[0] > 86400000 * 3) {
|
|
|
+ if (that.time[1].getTime() - that.time[0].getTime() > 86400000 * 3) {
|
|
|
this.$message.error("时间查询范围不能超过3天");
|
|
|
that.time = [];
|
|
|
+ }else if(that.time[1].getTime()<that.time[0].getTime()){
|
|
|
+ this.$message.error("开始时间要大于结束时间");
|
|
|
+ that.time = [];
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -484,21 +490,21 @@ export default {
|
|
|
.then(res => {
|
|
|
if (res.data.startAndEndRoutes != "") {
|
|
|
that.listPath = res.data.startAndEndRoutes;
|
|
|
- that.initMap();
|
|
|
+ that.initMap([105.602725, 37.076636]);
|
|
|
} else {
|
|
|
this.$message.error("车辆没有开启GPS");
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
//初始化地图
|
|
|
- initMap() {
|
|
|
+ initMap(lonlat) {
|
|
|
lazyAMapApiLoaderInstance.load().then(() => {
|
|
|
let that = this;
|
|
|
that.map = new AMap.Map("amap-container", {
|
|
|
//设置地图容器id
|
|
|
viewMode: "2D", //是否为2D地图模式
|
|
|
zoom: 10, //初始化地图级别
|
|
|
- center: [105.602725, 37.076636] //初始化地图中心点位置
|
|
|
+ center: lonlat, //初始化地图中心点位置
|
|
|
});
|
|
|
//初始化
|
|
|
that.initGeocoder();
|