fix: 修复切换timeFilter后追踪页时间轴没有返回时间戳,以及返回时间戳不为整分的问题

This commit is contained in:
刘洪洪
2024-03-04 14:22:24 +08:00
parent 033ab94e8a
commit 27ae3571f1

View File

@@ -38,6 +38,7 @@ export default {
if (n) {
this.currentTime = 99
this.getDate()
this.onChange('change')
}
}
},
@@ -85,7 +86,7 @@ export default {
for (let i = startTime; i <= timeFilter.endTime; i += showTimeInterval * 60 * 1000) {
const obj = this.formatTime(i, showTimeInterval, timeInterval)
if (obj) {
myTimeRange.push({ time: obj.time, time1: obj.time1, stamp: i, showFlag: obj.showFlag })
myTimeRange.push({ time: obj.time, time1: obj.time1, stamp: new Date(obj.time1).getTime(), showFlag: obj.showFlag })
}
}
@@ -204,7 +205,14 @@ export default {
}
},
onChange (e) {
if (this.timeLine[e]) {
if (e === 'change') {
// 切换timeFilter时选取最后一分钟
const timeObj = {
startTime: this.timeLine.slice(-1)[0].stamp - 60 * 1000,
endTime: this.timeLine.slice(-1)[0].stamp
}
this.$emit('change', timeObj)
} else if (this.timeLine[e]) {
// 返回所选时间后一分钟
const timeObj = {
startTime: this.timeLine[e].stamp - 60 * 1000,