iot行程问题完善
This commit is contained in:
parent
99627bab6f
commit
74dec8db3a
|
|
@ -37,14 +37,14 @@
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<el-row :gutter="24" class="map-container">
|
<el-row :gutter="24" class="map-container">
|
||||||
<el-col :span="6">
|
<el-col :span="6" v-loading="loadingData">
|
||||||
<el-tabs type="border-card" class="map-left">
|
<el-tabs type="border-card" class="map-left">
|
||||||
<el-tab-pane label="行程">
|
<el-tab-pane label="行程">
|
||||||
<template v-if="tripList.length > 0">
|
<template v-if="tripInfoListNew.length > 0">
|
||||||
<div
|
<div
|
||||||
class="trip-container"
|
class="trip-container"
|
||||||
@click="handlePreviewTrip(item, index)"
|
@click="handlePreviewTrip(item, index)"
|
||||||
v-for="(item, index) in tripList"
|
v-for="(item, index) in tripInfoListNew"
|
||||||
:key="index"
|
:key="index"
|
||||||
>
|
>
|
||||||
<div class="left-num">{{ index + 1 }}</div>
|
<div class="left-num">{{ index + 1 }}</div>
|
||||||
|
|
@ -226,6 +226,8 @@ export default {
|
||||||
parkList: [],
|
parkList: [],
|
||||||
warningList: [],
|
warningList: [],
|
||||||
loadingData: true,
|
loadingData: true,
|
||||||
|
|
||||||
|
tripInfoListNew: [], // 新行程信息
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {},
|
created() {},
|
||||||
|
|
@ -277,29 +279,30 @@ export default {
|
||||||
this.$message.error('请选择时间范围!')
|
this.$message.error('请选择时间范围!')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
this.loadingData = true
|
||||||
this.tripParams.iotId = this.iotCode
|
this.tripParams.iotId = this.iotCode
|
||||||
const res = await getIotDeviceTripApi({ ...this.tripParams })
|
// const res = await getIotDeviceTripApi({ ...this.tripParams })
|
||||||
console.log(res, '行程信息--')
|
// console.log(res, '行程信息--')
|
||||||
|
|
||||||
const resS = await getIotDeviceParkDetailApi({ ...this.tripParams })
|
const resS = await getIotDeviceParkDetailApi({ ...this.tripParams })
|
||||||
|
|
||||||
console.log(resS, '停留点信息--')
|
|
||||||
|
|
||||||
const params = { ...this.tripParams }
|
const params = { ...this.tripParams }
|
||||||
params.beginTime = params.beginTime.slice(0, 10)
|
params.beginTime = params.beginTime.slice(0, 10)
|
||||||
params.endTime = params.endTime.slice(0, 10)
|
params.endTime = params.endTime.slice(0, 10)
|
||||||
const resSs = await getIotDeviceAlarmApi(params)
|
const resSs = await getIotDeviceAlarmApi(params)
|
||||||
|
|
||||||
|
this.loadingData = false
|
||||||
|
|
||||||
this.warningList = resSs.data
|
this.warningList = resSs.data
|
||||||
this.warningList.forEach((e) => {
|
this.warningList.forEach((e) => {
|
||||||
e.warnTime = moment(parseInt(e.startAlarmTime)).format(
|
e.warnTime = moment(parseInt(e.startAlarmTime)).format(
|
||||||
'YYYY-MM-DD HH:mm:ss',
|
'YYYY-MM-DD HH:mm:ss',
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
console.log(resSs, '报警信息--')
|
|
||||||
|
|
||||||
this.parkList = resS.data
|
this.parkList = resS.data
|
||||||
this.parkList.forEach((e) => {
|
this.parkList.forEach((e) => {
|
||||||
|
console.log(e, '----')
|
||||||
e.startTime = moment(parseInt(e.beginTime)).format(
|
e.startTime = moment(parseInt(e.beginTime)).format(
|
||||||
'YYYY-MM-DD HH:mm:ss',
|
'YYYY-MM-DD HH:mm:ss',
|
||||||
)
|
)
|
||||||
|
|
@ -317,37 +320,71 @@ export default {
|
||||||
60,
|
60,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
let tripInfo = JSON.parse(res.msg)
|
|
||||||
console.log(tripInfo, '反序列化之后', this.parkList)
|
|
||||||
|
|
||||||
let addressList = []
|
// 处理行程信息
|
||||||
if (tripInfo.addressmap) {
|
this.tripInfoListNew = []
|
||||||
addressList = Object.keys(tripInfo.addressmap)
|
let tripInfoList = []
|
||||||
}
|
if (this.parkList.length > 1) {
|
||||||
|
this.parkList.forEach((e, index) => {
|
||||||
tripInfo.totaltrips.forEach((e) => {
|
if (index < this.parkList.length - 1) {
|
||||||
e.startTime = moment(e.trackstarttime).format(
|
let obj = {
|
||||||
'YYYY-MM-DD HH:mm:ss',
|
startTime: e.startTime,
|
||||||
)
|
startAddress: e.address,
|
||||||
e.endTime = moment(e.trackendtime).format('YYYY-MM-DD HH:mm:ss')
|
startLng: e.callon,
|
||||||
|
startLat: e.callat,
|
||||||
e.drivingDuration = parseInt(
|
endLng: '',
|
||||||
(e.trackendtime - e.trackstarttime) / 1000,
|
endLat: '',
|
||||||
)
|
endTime: '',
|
||||||
|
endAddress: '',
|
||||||
addressList.forEach((v) => {
|
}
|
||||||
if (v.indexOf(e.slat.toString().slice(0, 7)) > -1) {
|
tripInfoList.push(obj)
|
||||||
e.startAddress = tripInfo.addressmap[v]
|
|
||||||
}
|
|
||||||
if (v.indexOf(e.elat.toString().slice(0, 7)) > -1) {
|
|
||||||
e.endAddress = tripInfo.addressmap[v]
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
|
||||||
this.tripList = tripInfo.totaltrips
|
this.parkList.forEach((e, index) => {
|
||||||
|
if (index > 0) {
|
||||||
|
tripInfoList[index - 1].endTime = e.startTime
|
||||||
|
tripInfoList[index - 1].endAddress = e.address
|
||||||
|
tripInfoList[index - 1].endLng = e.callon
|
||||||
|
tripInfoList[index - 1].endLat = e.callat
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
console.log(tripInfo, '处理之后-----')
|
this.tripInfoListNew = tripInfoList
|
||||||
|
|
||||||
|
// console.log(tripInfoList, '处理后的行程---')
|
||||||
|
// let tripInfo = JSON.parse(res.msg)
|
||||||
|
// console.log(tripInfo, '反序列化之后', this.parkList)
|
||||||
|
|
||||||
|
// let addressList = []
|
||||||
|
// if (tripInfo.addressmap) {
|
||||||
|
// addressList = Object.keys(tripInfo.addressmap)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// tripInfo.totaltrips.forEach((e) => {
|
||||||
|
// e.startTime = moment(e.trackstarttime).format(
|
||||||
|
// 'YYYY-MM-DD HH:mm:ss',
|
||||||
|
// )
|
||||||
|
// e.endTime = moment(e.trackendtime).format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
|
||||||
|
// e.drivingDuration = parseInt(
|
||||||
|
// (e.trackendtime - e.trackstarttime) / 1000,
|
||||||
|
// )
|
||||||
|
|
||||||
|
// addressList.forEach((v) => {
|
||||||
|
// if (v.indexOf(e.slat.toString().slice(0, 7)) > -1) {
|
||||||
|
// e.startAddress = tripInfo.addressmap[v]
|
||||||
|
// }
|
||||||
|
// if (v.indexOf(e.elat.toString().slice(0, 7)) > -1) {
|
||||||
|
// e.endAddress = tripInfo.addressmap[v]
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// })
|
||||||
|
|
||||||
|
// this.tripList = tripInfo.totaltrips
|
||||||
|
|
||||||
|
// console.log(tripInfo, '处理之后-----')
|
||||||
},
|
},
|
||||||
/** 查看行程 */
|
/** 查看行程 */
|
||||||
handlePreviewTrip(item, index) {
|
handlePreviewTrip(item, index) {
|
||||||
|
|
@ -357,10 +394,10 @@ export default {
|
||||||
}
|
}
|
||||||
this.map.clearOverlays()
|
this.map.clearOverlays()
|
||||||
let pointList = []
|
let pointList = []
|
||||||
this.linePointList[0].lng = item.slon
|
this.linePointList[0].lng = item.startLng
|
||||||
this.linePointList[0].lat = item.slat
|
this.linePointList[0].lat = item.startLat
|
||||||
this.linePointList[1].lng = item.elon
|
this.linePointList[1].lng = item.endLng
|
||||||
this.linePointList[1].lat = item.elat
|
this.linePointList[1].lat = item.endLat
|
||||||
if (this.linePointList.length === 0) return
|
if (this.linePointList.length === 0) return
|
||||||
for (var i = 0; i < this.linePointList.length; i++) {
|
for (var i = 0; i < this.linePointList.length; i++) {
|
||||||
pointList.push(
|
pointList.push(
|
||||||
|
|
@ -379,9 +416,9 @@ export default {
|
||||||
// polyline.setStrokeWeight(2) // 线宽
|
// polyline.setStrokeWeight(2) // 线宽
|
||||||
this.trackAni = new BMapGLLib.TrackAnimation(this.map, polyline, {
|
this.trackAni = new BMapGLLib.TrackAnimation(this.map, polyline, {
|
||||||
overallView: true, // 动画完成后自动调整视野到总览
|
overallView: true, // 动画完成后自动调整视野到总览
|
||||||
tilt: 30, // 轨迹播放的角度,默认为55
|
tilt: 55, // 轨迹播放的角度,默认为55
|
||||||
duration: 3000, // 动画持续时长,默认为10000,单位ms
|
duration: 1500, // 动画持续时长,默认为10000,单位ms
|
||||||
delay: 500, // 动画开始的延迟,默认0,单位ms
|
delay: 100, // 动画开始的延迟,默认0,单位ms
|
||||||
})
|
})
|
||||||
this.trackAni.start()
|
this.trackAni.start()
|
||||||
// 设置起点终点图标
|
// 设置起点终点图标
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue