|
@@ -4,7 +4,6 @@
|
|
<div class="controller">
|
|
<div class="controller">
|
|
<div class="in_transit_information">
|
|
<div class="in_transit_information">
|
|
<span class="item_details">车牌号:</span> <el-input style="width: 100px;" class="inputStyle" v-model="carNumber"> </el-input>
|
|
<span class="item_details">车牌号:</span> <el-input style="width: 100px;" class="inputStyle" v-model="carNumber"> </el-input>
|
|
-
|
|
|
|
</div>
|
|
</div>
|
|
<div class="in_transit_information2">
|
|
<div class="in_transit_information2">
|
|
<span class="item_details">时间段:</span>
|
|
<span class="item_details">时间段:</span>
|
|
@@ -20,54 +19,56 @@
|
|
</el-date-picker>
|
|
</el-date-picker>
|
|
<el-button type="primary" class="searchstyle" @click="initData">查询</el-button>
|
|
<el-button type="primary" class="searchstyle" @click="initData">查询</el-button>
|
|
</div>
|
|
</div>
|
|
-
|
|
|
|
<div class="driving_information">
|
|
<div class="driving_information">
|
|
<span class="item_details2">时间:{{runRoute.gtm}}</span>
|
|
<span class="item_details2">时间:{{runRoute.gtm}}</span>
|
|
<br/>
|
|
<br/>
|
|
<span class="item_details2" >车速:{{runRoute.spd}}千米/小时</span>
|
|
<span class="item_details2" >车速:{{runRoute.spd}}千米/小时</span>
|
|
<br/>
|
|
<br/>
|
|
- <!--控制条-->
|
|
|
|
-
|
|
|
|
</div>
|
|
</div>
|
|
- <div class="map-control" v-show="isActual">
|
|
|
|
|
|
+ <div class="map-control">
|
|
<!--播放暂停按钮-->
|
|
<!--播放暂停按钮-->
|
|
进度:
|
|
进度:
|
|
- <Icon v-if="!isPlay" class="play-icon play" type="ios-play" @click="isPlay=true;play();navgControl(playIcon)"/>
|
|
|
|
|
|
+ <Icon v-if="!isPlay" class="play-icon play" type="ios-play" @click="isPlay=true;play();"/>
|
|
<Icon v-else class="play-icon pause" type="ios-pause" @click="isPlay=false;stop();navgControl('pause')"/>
|
|
<Icon v-else class="play-icon pause" type="ios-pause" @click="isPlay=false;stop();navgControl('pause')"/>
|
|
- <Icon class="play-icon quickly" type="ios-play" @click="addIndex()"/>
|
|
|
|
|
|
+ <Icon class="play-icon quickly" type="ios-play" @click="addProgress()"/>
|
|
<div class="mySlider"><Slider class="map-slider" v-model="sliderVal" :tip-format="hideFormat" :step="0.0001"></Slider></div>
|
|
<div class="mySlider"><Slider class="map-slider" v-model="sliderVal" :tip-format="hideFormat" :step="0.0001"></Slider></div>
|
|
-
|
|
|
|
- <!--播放暂停按钮-->
|
|
|
|
-
|
|
|
|
- <!-- <Icon class="play-icon quickly" type="ios-play" @click="addIndexSpeed()"/> -->
|
|
|
|
- <!-- <Slider class="map-slider" v-model="speedVal" :tip-format="speedFormat" :step="0.0001"></Slider> -->
|
|
|
|
- <div class="mySlider2"><el-slider
|
|
|
|
- v-model="speedVal"
|
|
|
|
- show-input>
|
|
|
|
- </el-slider></div>
|
|
|
|
|
|
+ <!--速度-->
|
|
|
|
+ <div class="mySlider2"><el-slider v-model="speedVal" show-input></el-slider></div>
|
|
</div>
|
|
</div>
|
|
- <div class="map-control" v-show="isActual">
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ <div class="in_transit_information3" v-if="listPath.length>0">
|
|
|
|
+ <span class="item_details">停车时长:</span>
|
|
|
|
+ <el-select style="width:100px" @change="changeParkingTime" v-model="parkingTime" placeholder="请选择">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in parkingOptions"
|
|
|
|
+ :key="item.value"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.value">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="in_transit_information3" v-if="listPath.length>0">
|
|
|
|
+ <span class="item_details">离线时长:</span>
|
|
|
|
+ <el-select style="width:100px" @change="changeLeaveTime" v-model="leaveTime" placeholder="请选择">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in parkingOptions"
|
|
|
|
+ :key="item.value"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.value">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
-
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
-
|
|
|
|
<script>
|
|
<script>
|
|
-import AMapLoader from '@amap/amap-jsapi-loader';
|
|
|
|
import { shallowRef } from '@vue/reactivity'
|
|
import { shallowRef } from '@vue/reactivity'
|
|
-import { sjTime } from "@/utils/sharedJsFile";
|
|
|
|
-import { Loading } from 'element-ui';
|
|
|
|
import { lazyAMapApiLoaderInstance } from 'vue-amap';
|
|
import { lazyAMapApiLoaderInstance } from 'vue-amap';
|
|
|
|
+import { sjTime,stringToDate } from "@/utils/sharedJsFile";
|
|
import Slider from './slider.vue'
|
|
import Slider from './slider.vue'
|
|
Vue.use(Slider)
|
|
Vue.use(Slider)
|
|
-import AMapJS from "amap-js";
|
|
|
|
import Vue from 'vue';
|
|
import Vue from 'vue';
|
|
export default {
|
|
export default {
|
|
name: "PathView",
|
|
name: "PathView",
|
|
-
|
|
|
|
setup(){
|
|
setup(){
|
|
const map = shallowRef(null);
|
|
const map = shallowRef(null);
|
|
return{
|
|
return{
|
|
@@ -80,215 +81,249 @@ export default {
|
|
handler(val, oldVal) {
|
|
handler(val, oldVal) {
|
|
let that=this;
|
|
let that=this;
|
|
if(that.pathNavigator!=null){
|
|
if(that.pathNavigator!=null){
|
|
- that.pathNavigator.setSpeed(100*val)
|
|
|
|
|
|
+ that.pathNavigator.setSpeed(100*val)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- startTime:'',
|
|
|
|
- endTime:'',
|
|
|
|
|
|
+ //一、 查询相关
|
|
|
|
+ //选择时间区间
|
|
time:[],
|
|
time:[],
|
|
|
|
+ //查询车牌号
|
|
carNumber:"",
|
|
carNumber:"",
|
|
- orderNumber:'',
|
|
|
|
- ///che
|
|
|
|
- isTimesChoose:false,
|
|
|
|
- isActual:true,
|
|
|
|
- isPlay:true,
|
|
|
|
- passedTime:"12:02:10",
|
|
|
|
- sliderVal:0,
|
|
|
|
- speedVal:10,
|
|
|
|
- speed:1000,
|
|
|
|
- times:1,
|
|
|
|
-
|
|
|
|
- totalTime:"11",
|
|
|
|
- speedList:["1倍数","2倍数","3倍数"],
|
|
|
|
- //已行驶轨迹
|
|
|
|
|
|
+ //选择停车时长
|
|
|
|
+ parkingTime:null,
|
|
|
|
+ //停车时长选择区间
|
|
|
|
+ parkingOptions: [{
|
|
|
|
+ value: 600000,
|
|
|
|
+ label: '10分钟'
|
|
|
|
+ }, {
|
|
|
|
+ value: 1200000,
|
|
|
|
+ label: '20分钟'
|
|
|
|
+ }, {
|
|
|
|
+ value: 1800000,
|
|
|
|
+ label: '30分钟'
|
|
|
|
+ }, {
|
|
|
|
+ value: 2400000,
|
|
|
|
+ label: '40分钟'
|
|
|
|
+ }, {
|
|
|
|
+ value: 3000000,
|
|
|
|
+ label: '50分钟'
|
|
|
|
+ }
|
|
|
|
+ , {
|
|
|
|
+ value: 3600000,
|
|
|
|
+ label: '60分钟'
|
|
|
|
+ }
|
|
|
|
+ ],
|
|
|
|
+ //选择离线时长
|
|
|
|
+ leaveTime:null,
|
|
|
|
+ //离线时长选择区间
|
|
|
|
+ leaveOptions: [{
|
|
|
|
+ value: 600000,
|
|
|
|
+ label: '10分钟'
|
|
|
|
+ }, {
|
|
|
|
+ value: 1200000,
|
|
|
|
+ label: '20分钟'
|
|
|
|
+ }, {
|
|
|
|
+ value: 1800000,
|
|
|
|
+ label: '30分钟'
|
|
|
|
+ }, {
|
|
|
|
+ value: 2400000,
|
|
|
|
+ label: '40分钟'
|
|
|
|
+ }, {
|
|
|
|
+ value: 3000000,
|
|
|
|
+ label: '50分钟'
|
|
|
|
+ }
|
|
|
|
+ , {
|
|
|
|
+ value: 3600000,
|
|
|
|
+ label: '60分钟'
|
|
|
|
+ }
|
|
|
|
+ ],
|
|
|
|
+ //二、 展示相关
|
|
|
|
+ //离线图标
|
|
|
|
+ leaveMark:[],
|
|
|
|
+ //停车图标
|
|
|
|
+ parkMark:[],
|
|
|
|
+ //开始地址
|
|
|
|
+ startPointName:"",
|
|
|
|
+ //结束地址
|
|
|
|
+ endPointName:"",
|
|
|
|
+ //小车行驶当前点所在的位置
|
|
runRoute:
|
|
runRoute:
|
|
{
|
|
{
|
|
- agl: "44",
|
|
|
|
- gtm: "2022年03月09日 16:47:24",
|
|
|
|
- hgt: "13",
|
|
|
|
- lat: "32.906411535084985",
|
|
|
|
- lon: "115.76177868692135",
|
|
|
|
- mil: "429409.2",
|
|
|
|
- spd: "17.0"
|
|
|
|
|
|
+ //正北方向夹角
|
|
|
|
+ agl: "0",
|
|
|
|
+ //当前的时间
|
|
|
|
+ gtm: "0",
|
|
|
|
+ //海拔
|
|
|
|
+ hgt: "0",
|
|
|
|
+ //进度
|
|
|
|
+ lat: "0",
|
|
|
|
+ //纬度
|
|
|
|
+ lon: "0",
|
|
|
|
+ //累计行驶距离(是车辆GPS安装开始到现在的距离,如果你想要查询范围内的行驶距离,用开始的累计距离和结束点累计距离相减)
|
|
|
|
+ mil: "0",
|
|
|
|
+ //这个时间的速度
|
|
|
|
+ spd: "0"
|
|
},
|
|
},
|
|
|
|
+ //小车行驶当前点下标
|
|
point:"",
|
|
point:"",
|
|
- pointNext:"",
|
|
|
|
- loading : null,
|
|
|
|
- navgtrSpeed:1,
|
|
|
|
- //地图中心位置
|
|
|
|
- centerPoint:{
|
|
|
|
- pointLat:"",
|
|
|
|
- pointLon:""
|
|
|
|
- },
|
|
|
|
|
|
+ //三、 播放相关
|
|
|
|
+ //是否暂停
|
|
|
|
+ isPlay:true,
|
|
|
|
+ //播放进度值
|
|
|
|
+ sliderVal:0,
|
|
|
|
+ //播放速度值
|
|
|
|
+ speedVal:10,
|
|
|
|
+ //四、组件相关
|
|
//自定义窗体信息
|
|
//自定义窗体信息
|
|
- ctmarkes:{
|
|
|
|
- lat:"33.015888071433764",
|
|
|
|
- lon : "115.96995235868168",
|
|
|
|
- title:"豫SE8888",
|
|
|
|
- details:"安徽省阜阳市颍东区阜阳舜岳水泥公司,西北方向,155.1米"
|
|
|
|
- },
|
|
|
|
- //运输详情
|
|
|
|
- transportDetail:{
|
|
|
|
- //车牌号
|
|
|
|
- capacityNumber:'',
|
|
|
|
- //规划路线
|
|
|
|
- estimateRoute:[
|
|
|
|
- {
|
|
|
|
- lat:"33.015888071433764",
|
|
|
|
- lon : "115.96995235868168"
|
|
|
|
- }
|
|
|
|
- ],
|
|
|
|
- //规划线路
|
|
|
|
- estimatePath:[
|
|
|
|
- [
|
|
|
|
- 114.03046212985384,
|
|
|
|
- 32.49786984660489
|
|
|
|
- ],
|
|
|
|
-
|
|
|
|
- ],
|
|
|
|
- //已行驶轨迹
|
|
|
|
- runRoute:[
|
|
|
|
- {
|
|
|
|
- agl: "44",
|
|
|
|
- gtm: "2022年03月09日 16:47:24",
|
|
|
|
- hgt: "13",
|
|
|
|
- lat: "32.906411535084985",
|
|
|
|
- lon: "115.76177868692135",
|
|
|
|
- mil: "429409.2",
|
|
|
|
- spd: "17.0"
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- runPath: [
|
|
|
|
- [
|
|
|
|
- 114.03922119568348,
|
|
|
|
- 32.49746162481379
|
|
|
|
- ],
|
|
|
|
- ],
|
|
|
|
- //当前位置
|
|
|
|
- currentPointName:"中国达州市通川区",
|
|
|
|
- //当前位置经纬度
|
|
|
|
- currentPoint:{
|
|
|
|
- lat:"",
|
|
|
|
- lon:""
|
|
|
|
- },
|
|
|
|
- //起点位置
|
|
|
|
- startPointName:"中国达州市通川区",
|
|
|
|
- //起点位置经纬度
|
|
|
|
- startPoint:{
|
|
|
|
- lon:"114.03922119568348",
|
|
|
|
- lat:"32.49746162481379"
|
|
|
|
- },
|
|
|
|
- //终点位置
|
|
|
|
- endPointName:"中国成都萧山",
|
|
|
|
- //终点位置经纬度
|
|
|
|
- endPoint:{
|
|
|
|
- lon:"115.96995737755431",
|
|
|
|
- lat:"33.01595479752097"
|
|
|
|
- },
|
|
|
|
- //自定义标记
|
|
|
|
- content:[],
|
|
|
|
- //异常位置
|
|
|
|
- abnormalLocation:[],
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
- listPath:[
|
|
|
|
-
|
|
|
|
- ],
|
|
|
|
- //组件
|
|
|
|
|
|
+ // ctmarkes:{
|
|
|
|
+ // lat:"33.015888071433764",
|
|
|
|
+ // lon : "115.96995235868168",
|
|
|
|
+ // title:"豫SE8888",
|
|
|
|
+ // details:"安徽省阜阳市颍东区阜阳舜岳水泥公司,西北方向,155.1米"
|
|
|
|
+ // },
|
|
|
|
+ //五、返回值相关
|
|
|
|
+ //返回值集合
|
|
|
|
+ listPath:[],
|
|
|
|
+ //六、地图组件相关值
|
|
|
|
+ //创建轨迹
|
|
pathSimplifierIns:{},
|
|
pathSimplifierIns:{},
|
|
- pathNavigator:{}
|
|
|
|
|
|
+ //巡回器
|
|
|
|
+ pathNavigator:{},
|
|
|
|
+ //初始化巡回器速度
|
|
|
|
+ speed:1000,
|
|
|
|
+ //地图解析
|
|
|
|
+ geocoder:null,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
created(){
|
|
created(){
|
|
- let that=this;
|
|
|
|
|
|
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
|
|
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- formatDate (date, fmt) {
|
|
|
|
- if (/(y+)/.test(fmt)) {
|
|
|
|
- fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
|
|
|
|
- }
|
|
|
|
- let o = {
|
|
|
|
- 'M+': date.getMonth() + 1,
|
|
|
|
- 'd+': date.getDate(),
|
|
|
|
- "h+": date.getHours(),
|
|
|
|
- "m+": date.getMinutes(),
|
|
|
|
- "s+": date.getSeconds(),
|
|
|
|
- }
|
|
|
|
- for (let k in o) {
|
|
|
|
- if (new RegExp(`(${k})`).test(fmt)) {
|
|
|
|
- let str = o[k] + ''
|
|
|
|
- fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? str : this.padLeftZero(str))
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return fmt
|
|
|
|
- },
|
|
|
|
- padLeftZero (str) {
|
|
|
|
- return ('00' + str).substr(str.length)
|
|
|
|
- },
|
|
|
|
- geocoder(){
|
|
|
|
- AMap.plugin('AMap.Geocoder', function() {
|
|
|
|
- var geocoder = new AMap.Geocoder({
|
|
|
|
- // city 指定进行编码查询的城市,支持传入城市名、adcode 和 citycode
|
|
|
|
- city: '全球'
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- var lnglat = [116.396574, 39.992706]
|
|
|
|
- console.log("fsdaf")
|
|
|
|
- geocoder.getAddress(lnglat, function(status, result) {
|
|
|
|
- console.log(result)
|
|
|
|
- if (status === 'complete' && result.info === 'OK') {
|
|
|
|
- // result为对应的地理位置详细信息
|
|
|
|
- console.log(result)
|
|
|
|
|
|
+
|
|
|
|
+ //停车时间改变
|
|
|
|
+ changeParkingTime(){
|
|
|
|
+ let that=this;
|
|
|
|
+ //清除之前的停车点
|
|
|
|
+ that.hideParkingMark();
|
|
|
|
+ //计算时间的点
|
|
|
|
+ let calculationPoint=null;
|
|
|
|
+ that.listPath[0].runRoute.forEach(function(item,indexOf){
|
|
|
|
+ if(indexOf+1<that.listPath[0].runRoute.length){
|
|
|
|
+ //判断calculationPoint是否为空,如果是空的说明当前没有在计算停车时间
|
|
|
|
+ if(calculationPoint==null&&item.spd=='0.0'){
|
|
|
|
+ calculationPoint=item
|
|
|
|
+ } else if(calculationPoint!=null&&item.spd!='0.0'){
|
|
|
|
+ let beforeTime=that.stringToDate(calculationPoint.gtm)
|
|
|
|
+ let item2=that.listPath[0].runRoute[indexOf];
|
|
|
|
+ let afterTime=that.stringToDate(item2.gtm);
|
|
|
|
+ let second=afterTime-beforeTime;
|
|
|
|
+ if(second>that.parkingTime){
|
|
|
|
+
|
|
|
|
+ let message='停车:'+second/60000;
|
|
|
|
+ console.log(message)
|
|
|
|
+ that.initParkingMarkes(20,35,require('@/assets/img/start.png'),calculationPoint.lon,calculationPoint.lat,message.split('.')[0]+"分钟");
|
|
|
|
+ }
|
|
|
|
+ calculationPoint=null;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- })
|
|
|
|
- })
|
|
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ //停车所有离线图标
|
|
|
|
+ hideParkingMark(){
|
|
|
|
+ let that=this;
|
|
|
|
+ that.parkMark.forEach(function(item,indexOf){
|
|
|
|
+ item.hide();
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ //离线时间改变时获得超过时间的点信息
|
|
|
|
+ changeLeaveTime(){
|
|
|
|
+ let that=this;
|
|
|
|
+ //关闭所有图标
|
|
|
|
+ that.hideLeaveMark();
|
|
|
|
+ that.listPath[0].runRoute.forEach(function(item,indexOf){
|
|
|
|
+ if(indexOf+1<that.listPath[0].runRoute.length){
|
|
|
|
+ let beforeTime=that.stringToDate(item.gtm)
|
|
|
|
+ let item2=that.listPath[0].runRoute[indexOf+1];
|
|
|
|
+ let afterTime=that.stringToDate(item2.gtm);
|
|
|
|
+ let second=afterTime-beforeTime;
|
|
|
|
+ if(second>that.leaveTime){
|
|
|
|
+ let message='离线:'+second/60000;
|
|
|
|
+ that.initLeaveMarkes(20,35,require('@/assets/img/start.png'),item2.lon,item2.lat,message.split('.')[0]+"分钟");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ //关闭所有离线图标
|
|
|
|
+ hideLeaveMark(){
|
|
|
|
+ let that=this;
|
|
|
|
+ that.leaveMark.forEach(function(item,indexOf){
|
|
|
|
+ item.hide();
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ //字符串转为Date
|
|
|
|
+ stringToDate(dateString){
|
|
|
|
+ let dateStr=dateString.replace('年','-').replace('月','-').replace('日','');
|
|
|
|
+ return Date.parse(dateStr);
|
|
|
|
+ },
|
|
|
|
+ //校验查询时间
|
|
|
|
+ changeTime(){
|
|
|
|
+ let that=this;
|
|
|
|
+ console.log((that.time[1]-that.time[0])-(86400000*3))
|
|
|
|
+ if((that.time[1]-that.time[0])>86400000*3){
|
|
|
|
+ this.$message.error('时间查询范围不能超过3天');
|
|
|
|
+ that.time=[];
|
|
|
|
+ }
|
|
},
|
|
},
|
|
|
|
+ //启动
|
|
play(){
|
|
play(){
|
|
let that =this;
|
|
let that =this;
|
|
that.pathNavigator.resume();
|
|
that.pathNavigator.resume();
|
|
},
|
|
},
|
|
|
|
+ //停止
|
|
stop(){
|
|
stop(){
|
|
let that =this;
|
|
let that =this;
|
|
that.pathNavigator.pause();
|
|
that.pathNavigator.pause();
|
|
- this.geocoder()
|
|
|
|
},
|
|
},
|
|
- addIndexSpeed(){
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
- addIndex(){
|
|
|
|
- console.log("1123")
|
|
|
|
-
|
|
|
|
|
|
+ //添加进度
|
|
|
|
+ addProgress(){
|
|
let that =this;
|
|
let that =this;
|
|
let increment=(that.listPath[0].runPath.length*0.1)
|
|
let increment=(that.listPath[0].runPath.length*0.1)
|
|
that.pathNavigator.start(((that.point+increment)%that.listPath[0].runPath.length))
|
|
that.pathNavigator.start(((that.point+increment)%that.listPath[0].runPath.length))
|
|
},
|
|
},
|
|
- ///che
|
|
|
|
- navgControl(){
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
- speedFormat(value){
|
|
|
|
- let that=this;
|
|
|
|
- that.speedVal=value
|
|
|
|
-
|
|
|
|
- if(that.pathNavigator!=null){
|
|
|
|
-
|
|
|
|
- that.pathNavigator.setSpeed(1000*value)
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
|
|
+ //进度监听
|
|
hideFormat(value){
|
|
hideFormat(value){
|
|
let that=this;
|
|
let that=this;
|
|
that.sliderVal=value;
|
|
that.sliderVal=value;
|
|
},
|
|
},
|
|
- initData(orderNumber){
|
|
|
|
|
|
+ //获得开始地址
|
|
|
|
+ getStartPointName(lnglatXY){
|
|
|
|
+ let that=this;
|
|
|
|
+ console.log("start",that.geocoder)
|
|
|
|
+ that.geocoder.getAddress(lnglatXY, function(status, result) {
|
|
|
|
+ if (status === 'complete' && result.info === 'OK') {
|
|
|
|
+ that.startPointName = result.regeocode.formattedAddress;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ //获得结束地址
|
|
|
|
+ getEndPointName(lnglatXY){
|
|
|
|
+ let that=this;
|
|
|
|
+ that.geocoder.getAddress(lnglatXY, function(status, result) {
|
|
|
|
+ if (status === 'complete' && result.info === 'OK') {
|
|
|
|
+ that.endPointName = result.regeocode.formattedAddress;
|
|
|
|
+ that.initCustomMarkes(that.carNumber+"("+that.listPath[0].miled+")","起点:"+that.startPointName+"<br/>"+"终点:"+that.endPointName,lnglatXY[0],lnglatXY[1])
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ //初始化数据
|
|
|
|
+ initData(){
|
|
let that=this;
|
|
let that=this;
|
|
that.listPath=[];
|
|
that.listPath=[];
|
|
if(that.carNumber==""){
|
|
if(that.carNumber==""){
|
|
@@ -298,67 +333,79 @@ export default {
|
|
if(that.time==[]){
|
|
if(that.time==[]){
|
|
this.$message.error('请选择时间');
|
|
this.$message.error('请选择时间');
|
|
}
|
|
}
|
|
- that.axios.post("/api/v1/otms/fullPathVisualizationByCarNumber",
|
|
|
|
- {
|
|
|
|
|
|
+ that.axios.post("/api/v1/otms/fullPathVisualizationByCarNumber",{
|
|
"capacityNumber":that.carNumber,
|
|
"capacityNumber":that.carNumber,
|
|
"startTime":that.formatDate(that.time[0],"yyyy-MM-dd hh:mm:ss"),
|
|
"startTime":that.formatDate(that.time[0],"yyyy-MM-dd hh:mm:ss"),
|
|
"endTime":that.formatDate(that.time[1],"yyyy-MM-dd hh:mm:ss"),
|
|
"endTime":that.formatDate(that.time[1],"yyyy-MM-dd hh:mm:ss"),
|
|
- }
|
|
|
|
- ).then((res) => {
|
|
|
|
|
|
+ }).then((res) => {
|
|
if(res.data.startAndEndRoutes!=''){
|
|
if(res.data.startAndEndRoutes!=''){
|
|
- that.listPath=res.data.startAndEndRoutes
|
|
|
|
|
|
+ that.listPath=res.data.startAndEndRoutes;
|
|
that.initMap();
|
|
that.initMap();
|
|
}else{
|
|
}else{
|
|
this.$message.error('车辆没有开启GPS');
|
|
this.$message.error('车辆没有开启GPS');
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- endline(){
|
|
|
|
|
|
+ //初始化地图
|
|
|
|
+ initMap(){
|
|
|
|
+ lazyAMapApiLoaderInstance.load().then(() => {
|
|
|
|
+ let that=this;
|
|
|
|
+ that.map = new AMap.Map("amap-container",{ //设置地图容器id
|
|
|
|
+ viewMode:"2D", //是否为2D地图模式
|
|
|
|
+ zoom:10, //初始化地图级别
|
|
|
|
+ center:[105.602725,37.076636], //初始化地图中心点位置
|
|
|
|
+ });
|
|
|
|
+ //初始化
|
|
|
|
+ that.initGeocoder();
|
|
|
|
+ //初始化巡航轨迹和巡航器
|
|
|
|
+ that.initPathSimplifier();
|
|
|
|
+ //初始化起点、当前点、当前点
|
|
|
|
+ that.initThreeMarker();
|
|
|
|
+ //初始化当前点标记
|
|
|
|
+ //that.initCustomMarkes(that.carNumber+"("+that.listPath[0].miled+")",that.listPath[0].currentPointName,that.listPath[0].currentPoint.lon,that.listPath[0].currentPoint.lat)
|
|
|
|
+ //that.initEndline();
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ //结束点
|
|
|
|
+ initEndline(){
|
|
let that=this;
|
|
let that=this;
|
|
that.initPolyline(that.listPath[0].estimatePath,"#FF0000");
|
|
that.initPolyline(that.listPath[0].estimatePath,"#FF0000");
|
|
},
|
|
},
|
|
//创建起点终点当前点
|
|
//创建起点终点当前点
|
|
- threeMarker(){
|
|
|
|
|
|
+ initThreeMarker(){
|
|
let that=this;
|
|
let that=this;
|
|
that.listPath.forEach((element,index) => {
|
|
that.listPath.forEach((element,index) => {
|
|
|
|
+ //起点名称
|
|
|
|
+ that.getStartPointName([element.startPoint.lon,element.startPoint.lat])
|
|
|
|
+
|
|
|
|
+
|
|
//开始标记点
|
|
//开始标记点
|
|
if(element.startPoint.lon!=''&&element.startPoint.lat!=''){
|
|
if(element.startPoint.lon!=''&&element.startPoint.lat!=''){
|
|
|
|
+
|
|
that.initMarkes(20,35,require('@/assets/img/start.png'),element.startPoint.lon,element.startPoint.lat,'起点');
|
|
that.initMarkes(20,35,require('@/assets/img/start.png'),element.startPoint.lon,element.startPoint.lat,'起点');
|
|
}
|
|
}
|
|
//结束标记点
|
|
//结束标记点
|
|
- console.log(element.endPoint,"element.endPoint")
|
|
|
|
if(element.endPoint!={}&&element.endPoint!=''&&element.endPoint!=null){
|
|
if(element.endPoint!={}&&element.endPoint!=''&&element.endPoint!=null){
|
|
- console.log("1111")
|
|
|
|
- that.initMarkes(20,35,require('@/assets/img/end.png'),element.endPoint.lon,element.endPoint.lat,'终点');
|
|
|
|
|
|
+ // that.initMarkes(20,35,require('@/assets/img/end.png'),element.endPoint.lon,element.endPoint.lat,'终点');
|
|
|
|
+ //终点名称
|
|
|
|
+ that.getEndPointName([element.endPoint.lon,element.endPoint.lat]);
|
|
}else{
|
|
}else{
|
|
- console.log(element)
|
|
|
|
- that.initMarkes(20,35,require('@/assets/img/end.png'),element.runRoute[element.runRoute.length-1].lon,element.runRoute[element.runRoute.length-1].lat,'终点');
|
|
|
|
|
|
+ // that.initMarkes(20,35,require('@/assets/img/end.png'),element.runRoute[element.runRoute.length-1].lon,element.runRoute[element.runRoute.length-1].lat,'终点');
|
|
|
|
+ //终点名称
|
|
|
|
+ that.getEndPointName([element.runRoute[element.runRoute.length-1].lon,element.runRoute[element.runRoute.length-1].lat])
|
|
}
|
|
}
|
|
|
|
+
|
|
});
|
|
});
|
|
|
|
|
|
},
|
|
},
|
|
- //初始化地图
|
|
|
|
- initMap(){
|
|
|
|
- lazyAMapApiLoaderInstance.load().then(() => {
|
|
|
|
- let that=this;
|
|
|
|
- that.map = new AMap.Map("amap-container",{ //设置地图容器id
|
|
|
|
- viewMode:"2D", //是否为2D地图模式
|
|
|
|
- zoom:10, //初始化地图级别
|
|
|
|
- center:[105.602725,37.076636], //初始化地图中心点位置
|
|
|
|
- });
|
|
|
|
- that.initPathSimplifier();
|
|
|
|
- that.threeMarker();
|
|
|
|
- console.log("that.listPath[0]",that.listPath)
|
|
|
|
- that.initCustomMarkes(that.carNumber+"("+that.listPath[0].miled+")",that.listPath[0].currentPointName,that.listPath[0].currentPoint.lon,that.listPath[0].currentPoint.lat)
|
|
|
|
- that.endline();
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
|
|
+ //初始化窗体
|
|
initCustomMarkes(title,details,lon,lat){
|
|
initCustomMarkes(title,details,lon,lat){
|
|
let that=this;
|
|
let that=this;
|
|
//自定义窗体内容
|
|
//自定义窗体内容
|
|
var content = [
|
|
var content = [
|
|
"<div style='top:1px;width: 180px; background-color: rgba(0, 0, 0, 1);' ><font color='white'>"+title+"</font>",
|
|
"<div style='top:1px;width: 180px; background-color: rgba(0, 0, 0, 1);' ><font color='white'>"+title+"</font>",
|
|
- "<div style='background-color:rgba(255, 255, 255, 0.5);'><font color='white'>"+details+"</font></div></div>"
|
|
|
|
|
|
+ "<div style='background-color:rgba(255, 255, 255, 0.5);'><font color='white'>"+details+"</font></div></div>",
|
|
];
|
|
];
|
|
// 创建 infoWindow 实例
|
|
// 创建 infoWindow 实例
|
|
var infoWindow = new AMap.InfoWindow({
|
|
var infoWindow = new AMap.InfoWindow({
|
|
@@ -367,14 +414,15 @@ export default {
|
|
// 打开信息窗体
|
|
// 打开信息窗体
|
|
infoWindow.open(that.map,[lon,lat]);
|
|
infoWindow.open(that.map,[lon,lat]);
|
|
},
|
|
},
|
|
|
|
+ //初始化预计轨迹
|
|
initPolyline(path,color){
|
|
initPolyline(path,color){
|
|
let that=this;
|
|
let that=this;
|
|
//预计轨迹
|
|
//预计轨迹
|
|
var endLine = new AMap.Polyline({
|
|
var endLine = new AMap.Polyline({
|
|
- map:that.map,
|
|
|
|
- path: path,
|
|
|
|
|
|
+ map:that.map,//地图组件
|
|
|
|
+ path: path,//预计轨迹
|
|
isOutline: true,
|
|
isOutline: true,
|
|
- outlineColor: color,
|
|
|
|
|
|
+ outlineColor: color,//轨迹颜色
|
|
borderWeight: 0,
|
|
borderWeight: 0,
|
|
strokeColor: "#FF0000",
|
|
strokeColor: "#FF0000",
|
|
strokeOpacity: 1,
|
|
strokeOpacity: 1,
|
|
@@ -389,6 +437,45 @@ export default {
|
|
})
|
|
})
|
|
that.map.setFitView([[ endLine ]])
|
|
that.map.setFitView([[ endLine ]])
|
|
},
|
|
},
|
|
|
|
+ initParkingMarkes(weight,height,image,lon,lat,title){
|
|
|
|
+ let that=this;
|
|
|
|
+ //图标标记点
|
|
|
|
+ let pointicon = new AMap.Icon({
|
|
|
|
+ size: new AMap.Size(weight, height), // 图标尺寸
|
|
|
|
+ image: image, // Icon的图像
|
|
|
|
+ imageOffset: new AMap.Pixel(0,0), // 图像相对展示区域的偏移量,适于雪碧图等
|
|
|
|
+ imageSize: new AMap.Size(weight, height) // 根据所设置的大小拉伸或压缩图片
|
|
|
|
+ });
|
|
|
|
+ // 创建一个 Marker 实例:
|
|
|
|
+ var pointmarker = new AMap.Marker({
|
|
|
|
+ position: new AMap.LngLat(lon, lat), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
|
|
|
|
+ icon: pointicon,
|
|
|
|
+ title: title
|
|
|
|
+ });
|
|
|
|
+ that.parkMark.push(pointmarker)
|
|
|
|
+ // 将创建的点标记添加到已有的地图实例:
|
|
|
|
+ that.map.add(pointmarker);
|
|
|
|
+ },
|
|
|
|
+ //创建离线和停车的标记
|
|
|
|
+ initLeaveMarkes(weight,height,image,lon,lat,title){
|
|
|
|
+ let that=this;
|
|
|
|
+ //图标标记点
|
|
|
|
+ let pointicon = new AMap.Icon({
|
|
|
|
+ size: new AMap.Size(weight, height), // 图标尺寸
|
|
|
|
+ image: image, // Icon的图像
|
|
|
|
+ imageOffset: new AMap.Pixel(0,0), // 图像相对展示区域的偏移量,适于雪碧图等
|
|
|
|
+ imageSize: new AMap.Size(weight, height) // 根据所设置的大小拉伸或压缩图片
|
|
|
|
+ });
|
|
|
|
+ // 创建一个 Marker 实例:
|
|
|
|
+ var pointmarker = new AMap.Marker({
|
|
|
|
+ position: new AMap.LngLat(lon, lat), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
|
|
|
|
+ icon: pointicon,
|
|
|
|
+ title: title
|
|
|
|
+ });
|
|
|
|
+ that.leaveMark.push(pointmarker)
|
|
|
|
+ // 将创建的点标记添加到已有的地图实例:
|
|
|
|
+ that.map.add(pointmarker);
|
|
|
|
+ },
|
|
//创建简单的标记
|
|
//创建简单的标记
|
|
initMarkes(weight,height,image,lon,lat,title){
|
|
initMarkes(weight,height,image,lon,lat,title){
|
|
let that=this;
|
|
let that=this;
|
|
@@ -433,7 +520,7 @@ export default {
|
|
if (pointIndex >= 0) {
|
|
if (pointIndex >= 0) {
|
|
if(pathData.runRoute[pointIndex].gtm!=='undefined'){
|
|
if(pathData.runRoute[pointIndex].gtm!=='undefined'){
|
|
//鼠标悬停在某个轨迹节点上
|
|
//鼠标悬停在某个轨迹节点上
|
|
- return pathData.runRoute[pointIndex].gtm + ',速度'+ pathData.runRoute[pointIndex].spd+'千米/小时,点:' + pointIndex + '/' + pathData.runPath.length;
|
|
|
|
|
|
+ return pathData.runRoute[pointIndex].gtm + ',速度'+ pathData.runRoute[pointIndex].spd+'千米/小时';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -441,7 +528,7 @@ export default {
|
|
renderOptions: {
|
|
renderOptions: {
|
|
//轨迹线的样式
|
|
//轨迹线的样式
|
|
pathLineStyle: {
|
|
pathLineStyle: {
|
|
- strokeStyle: 'black',
|
|
|
|
|
|
+ strokeStyle: 'black',//路径颜色
|
|
lineWidth: 6,
|
|
lineWidth: 6,
|
|
dirArrowStyle: true
|
|
dirArrowStyle: true
|
|
}
|
|
}
|
|
@@ -452,9 +539,9 @@ export default {
|
|
loop: true, // 是否循环
|
|
loop: true, // 是否循环
|
|
speed: that.speed ,// 速度(km/h)
|
|
speed: that.speed ,// 速度(km/h)
|
|
pathNavigatorStyle: {
|
|
pathNavigatorStyle: {
|
|
- width: 20,
|
|
|
|
- height: 40,
|
|
|
|
- content:PathSimplifier.Render.Canvas.getImageContent( require('@/assets/img/smallcar.png'), onload, onerror),
|
|
|
|
|
|
+ width: 20,//车辆图片宽度
|
|
|
|
+ height: 40,//车辆图片高度
|
|
|
|
+ content:PathSimplifier.Render.Canvas.getImageContent( require('@/assets/img/smallcar.png'), onload, onerror),//车辆图片
|
|
strokeStyle: null,
|
|
strokeStyle: null,
|
|
fillStyle: null
|
|
fillStyle: null
|
|
}
|
|
}
|
|
@@ -462,45 +549,60 @@ export default {
|
|
//开启巡航
|
|
//开启巡航
|
|
that.pathNavigator.start()
|
|
that.pathNavigator.start()
|
|
|
|
|
|
- //开始事件
|
|
|
|
|
|
+ //开始事件监听
|
|
that.pathNavigator.on("start resume", function() {
|
|
that.pathNavigator.on("start resume", function() {
|
|
- // that.navgtr._startTime = Date.now();
|
|
|
|
- // that.navgtr._startDist = this.getMovedDistance();
|
|
|
|
});
|
|
});
|
|
- //暂停
|
|
|
|
|
|
+
|
|
|
|
+ //暂停事件监听
|
|
that.pathNavigator.on("stop pause", function() {
|
|
that.pathNavigator.on("stop pause", function() {
|
|
- // that.navgtr._movedTime = Date.now() - that.navgtr._startTime;
|
|
|
|
- // that.navgtr._movedDist = this.getMovedDistance() - that.navgtr._startDist;
|
|
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ //移动事件监听
|
|
that.pathNavigator.on('move', function (data,value) {
|
|
that.pathNavigator.on('move', function (data,value) {
|
|
that.updateLable(value)
|
|
that.updateLable(value)
|
|
});
|
|
});
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ //实时展示
|
|
updateLable(value){
|
|
updateLable(value){
|
|
let that=this;
|
|
let that=this;
|
|
that.point=value.dataItem.pointIndex;
|
|
that.point=value.dataItem.pointIndex;
|
|
that.runRoute=value.dataItem.pathData.runRoute[that.point];
|
|
that.runRoute=value.dataItem.pathData.runRoute[that.point];
|
|
that.sliderVal=(value.dataItem.pointIndex/value.dataItem.pathData.runRoute.length)*100;
|
|
that.sliderVal=(value.dataItem.pointIndex/value.dataItem.pathData.runRoute.length)*100;
|
|
},
|
|
},
|
|
- changeSpeed(value){
|
|
|
|
- // console.log(value)
|
|
|
|
- // let that=this;
|
|
|
|
- // that.times=value;
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
- playIcon(){
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
- changeTime(){
|
|
|
|
|
|
+ //逆解码函数
|
|
|
|
+ initGeocoder(){
|
|
let that=this;
|
|
let that=this;
|
|
- console.log((that.time[1]-that.time[0])-(86400000*3))
|
|
|
|
- if((that.time[1]-that.time[0])>86400000*3){
|
|
|
|
- this.$message.error('时间查询范围不能超过3天');
|
|
|
|
- that.time=[];
|
|
|
|
|
|
+ console.log("initGeocoder") ;
|
|
|
|
+ AMap.plugin('AMap.Geocoder',function(){
|
|
|
|
+ that.geocoder = new AMap.Geocoder({
|
|
|
|
+ radius: 1000,
|
|
|
|
+ extensions: "all"
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ console.log(that.geocoder)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ //时间格式转换
|
|
|
|
+ formatDate (date, fmt) {
|
|
|
|
+ if (/(y+)/.test(fmt)) {
|
|
|
|
+ fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ let o = {
|
|
|
|
+ 'M+': date.getMonth() + 1,
|
|
|
|
+ 'd+': date.getDate(),
|
|
|
|
+ "h+": date.getHours(),
|
|
|
|
+ "m+": date.getMinutes(),
|
|
|
|
+ "s+": date.getSeconds(),
|
|
|
|
+ }
|
|
|
|
+ for (let k in o) {
|
|
|
|
+ if (new RegExp(`(${k})`).test(fmt)) {
|
|
|
|
+ let str = o[k] + ''
|
|
|
|
+ fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? str : ('00' + str).substr(str.length))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return fmt
|
|
|
|
+ },
|
|
}
|
|
}
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
@@ -523,6 +625,11 @@ export default {
|
|
float: left;
|
|
float: left;
|
|
height: 40px;
|
|
height: 40px;
|
|
}
|
|
}
|
|
|
|
+.in_transit_information3{
|
|
|
|
+ float: right;
|
|
|
|
+ height: 40px;
|
|
|
|
+ width: 180px;
|
|
|
|
+}
|
|
.in_transit_information2 {
|
|
.in_transit_information2 {
|
|
|
|
|
|
height: 40px;
|
|
height: 40px;
|
|
@@ -616,7 +723,4 @@ span.item_details2 {
|
|
width: 240px;
|
|
width: 240px;
|
|
float: left;
|
|
float: left;
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
</style>
|
|
</style>
|