设备监控部分代码,日志监控修复排序
This commit is contained in:
@@ -324,6 +324,12 @@ export default {
|
||||
for (const k in this.logs) {
|
||||
this.logs[k][1] = ansi_up.ansi_to_html(this.logs[k][1])
|
||||
}
|
||||
if (this.direction === 'backward') { // 由于使用公共标签会导致时间顺序错乱,因此对二维数组进行排序
|
||||
this.logs.sort((a, b) => b[0] - a[0])
|
||||
} else {
|
||||
this.logs.sort((a, b) => a[0] - b[0])
|
||||
}
|
||||
console.log(this.logs)
|
||||
} else {
|
||||
this.showEmpty = true
|
||||
this.emptyText = '暂无日志信息,请选择时间段试试'
|
||||
@@ -351,9 +357,6 @@ export default {
|
||||
const bottomest = Math.round(scrollTop + clientHeight)
|
||||
if (bottomest === scrollHeight) {
|
||||
// 加载新数据
|
||||
// console.log(this.logs[this.logs.length - 1][0]) // 最后一个日志的时间
|
||||
// console.log(queryParam.end - queryParam.start) // 时差
|
||||
// 需要:最后一个日志时间, 时差 ---- 查询的时间范围:最后时间-时 - 差最后时间
|
||||
queryParam.limits = this.scrollStep
|
||||
queryParam.direction = this.direction
|
||||
if (this.direction === 'backward') {
|
||||
@@ -382,6 +385,11 @@ export default {
|
||||
}
|
||||
}
|
||||
console.log(tempArray)
|
||||
if (this.direction === 'backward') { // 由于使用公共标签会导致时间顺序错乱,因此对二维数组进行排序
|
||||
tempArray.sort((a, b) => b[0] - a[0])
|
||||
} else {
|
||||
tempArray.sort((a, b) => a[0] - b[0])
|
||||
}
|
||||
for (const k in tempArray) {
|
||||
tempArray[k][1] = ansi_up.ansi_to_html(tempArray[k][1]) // 数据转换
|
||||
this.logs.push(tempArray[k]) // 追加数据
|
||||
@@ -444,6 +452,11 @@ export default {
|
||||
for (const k in this.logs) {
|
||||
this.logs[k][1] = ansi_up.ansi_to_html(this.logs[k][1])
|
||||
}
|
||||
if (this.direction === 'backward') { // 由于使用公共标签会导致时间顺序错乱,因此对二维数组进行排序
|
||||
this.logs.sort((a, b) => b[0] - a[0])
|
||||
} else {
|
||||
this.logs.sort((a, b) => a[0] - b[0])
|
||||
}
|
||||
} else {
|
||||
this.showEmpty = true
|
||||
this.emptyText = '暂无日志信息,请选择时间段试试'
|
||||
|
||||
Reference in New Issue
Block a user