设备监控部分代码,日志监控修复排序
This commit is contained in:
@@ -139,15 +139,15 @@
|
||||
<!-- <el-table-column prop="manufacturer" label="生产厂家" />-->
|
||||
<!-- <el-table-column prop="manufacturer_phone" label="厂家电话" />-->
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
<!-- <el-table-column label="操作" width="150px" align="center">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <el-button size="mini" style="margin-left: -1px;margin-right: 2px" type="text">-->
|
||||
<!-- <router-link :to="'/devices/device/config/' + scope.row.device_code ">-->
|
||||
<!-- 驱动配置-->
|
||||
<!-- </router-link>-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column label="操作" width="150px" align="center">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <el-button size="mini" style="margin-left: -1px;margin-right: 2px" type="text">-->
|
||||
<!-- <router-link :to="'/devices/device/config/' + scope.row.device_code ">-->
|
||||
<!-- 驱动配置-->
|
||||
<!-- </router-link>-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column v-permission="['admin','device:edit','device:del']" label="操作" width="200px" align="center">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
|
||||
@@ -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