NEZ-1649 fix:Explore查询Logs数据名称调整
This commit is contained in:
@@ -172,7 +172,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
<el-collapse-item v-if="showTab.indexOf('2') > -1" name="2" title="Logs">
|
<el-collapse-item v-if="showTab.indexOf('2') > -1" name="2" title="Logs">
|
||||||
<log-tab ref="logDetail" :log-data="logData" :explore-log-table="logTabNoData" :explore-item="true" :tab-index="tabIndex" @exportLog="exportLog" @limitChange="queryLogData" v-loading="chartLoading"></log-tab>
|
<log-tab ref="logDetail" :timeRange="filterTime" :log-data="logData" :explore-log-table="logTabNoData" :explore-item="true" :tab-index="tabIndex" @exportLog="exportLog" @limitChange="queryLogData" v-loading="chartLoading"></log-tab>
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
</template>
|
</template>
|
||||||
</el-collapse>
|
</el-collapse>
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
prop="date"
|
prop="date"
|
||||||
width="160"
|
width="160"
|
||||||
>
|
>
|
||||||
<template slot-scope="{ row }">{{utcTimeToTimezoneStr(row.date)}}</template>
|
<template slot-scope="{ row }">{{momentTz(row.date)}}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
v-if="!showSwitch"
|
v-if="!showSwitch"
|
||||||
@@ -117,7 +117,8 @@ export default {
|
|||||||
},
|
},
|
||||||
loadingBottom: Boolean,
|
loadingBottom: Boolean,
|
||||||
exploreLogTable: Boolean,
|
exploreLogTable: Boolean,
|
||||||
exploreItem: Boolean
|
exploreItem: Boolean,
|
||||||
|
timeRange: {}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
tableTimeFormat () {
|
tableTimeFormat () {
|
||||||
@@ -250,7 +251,7 @@ export default {
|
|||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
top: 20,
|
top: 20,
|
||||||
left: 30,
|
left: 60,
|
||||||
right: 10,
|
right: 10,
|
||||||
bottom: 80
|
bottom: 80
|
||||||
},
|
},
|
||||||
@@ -274,7 +275,7 @@ export default {
|
|||||||
rotate: 0,
|
rotate: 0,
|
||||||
fontSize: 13 * window.devicePixelRatio,
|
fontSize: 13 * window.devicePixelRatio,
|
||||||
formatter (value) {
|
formatter (value) {
|
||||||
return vm.utcTimeToTimezoneStr(vm.$unixTimeParseToString(vm.toMillisecondTime(parseInt(value)) / 1000, 'yyyy-MM-dd hh:mm:ss'), 'hh:mm')
|
return vm.defaultXAxisFormatter(vm.toMillisecondTime(parseInt(value)))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
boundaryGap: [0, '1%']
|
boundaryGap: [0, '1%']
|
||||||
@@ -495,12 +496,36 @@ export default {
|
|||||||
}
|
}
|
||||||
return alias
|
return alias
|
||||||
},
|
},
|
||||||
|
defaultXAxisFormatter: function (value) {
|
||||||
|
value = bus.UTCTimeToConfigTimezone(value)
|
||||||
|
const tData = new Date(value)
|
||||||
|
const month = tData.getMonth() + 1 > 9 ? tData.getMonth() + 1 : '0' + (tData.getMonth() + 1)
|
||||||
|
const day = tData.getDate() > 9 ? tData.getDate() : '0' + tData.getDate()
|
||||||
|
const hour = tData.getHours() > 9 ? tData.getHours() : '0' + tData.getHours()
|
||||||
|
const minute = tData.getMinutes() > 9 ? tData.getMinutes() : '0' + tData.getMinutes()
|
||||||
|
const dateFormatStr = this.timeFormatMain.split(' ')[0]
|
||||||
|
const diffSec = (this.momentStrToTimestamp(this.timeRange[1]) - this.momentStrToTimestamp(this.timeRange[0]))
|
||||||
|
const secOneDay = 24 * 60 * 60 * 1000// 1天的毫秒数
|
||||||
|
let str = ''
|
||||||
|
if (dateFormatStr === 'DD/MM/YYYY') {
|
||||||
|
str += [day, month].join('/')
|
||||||
|
} else if (dateFormatStr === 'MM/DD/YYYY') {
|
||||||
|
str += [month, day].join('/')
|
||||||
|
} else {
|
||||||
|
str += [month, day].join('-')
|
||||||
|
}
|
||||||
|
if (diffSec <= secOneDay) { // 同一天
|
||||||
|
return [hour, minute].join(':')
|
||||||
|
} else { // 大于1天,小于30天
|
||||||
|
return str + '\n' + [hour, minute].join(':')
|
||||||
|
}
|
||||||
|
},
|
||||||
tooltipFormatter (params, a, b) {
|
tooltipFormatter (params, a, b) {
|
||||||
const vm = this
|
const vm = this
|
||||||
let str = `
|
let str = `
|
||||||
<div style="margin: 0px 0 0;line-height:1;">
|
<div style="margin: 0px 0 0;line-height:1;">
|
||||||
<div style="margin: 0px 0 0;line-height:1;">
|
<div style="margin: 0px 0 0;line-height:1;">
|
||||||
<div style="font-size:14px;color:#666;font-weight:400;line-height:1;">${vm.utcTimeToTimezoneStr(vm.$unixTimeParseToString(vm.toMillisecondTime(parseInt(params[0].axisValue)) / 1000, 'yyyy-MM-dd hh:mm:ss'), 'hh:mm')}</div>
|
<div style="font-size:14px;color:#666;font-weight:400;line-height:1;">${vm.utcTimeToTimezoneStr(vm.toMillisecondTime(parseInt(params[0].axisValue), 'yyyy-MM-dd hh:mm:ss'))}</div>
|
||||||
<div style="margin: 10px 0 0;line-height:1;">
|
<div style="margin: 10px 0 0;line-height:1;">
|
||||||
<div style="margin: 0px 0 0;line-height:1;">`
|
<div style="margin: 0px 0 0;line-height:1;">`
|
||||||
params.forEach(item => {
|
params.forEach(item => {
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ import { hasPermission, hasButton } from './permission'
|
|||||||
import plTable from 'pl-table'
|
import plTable from 'pl-table'
|
||||||
import 'pl-table/themes/index.css'
|
import 'pl-table/themes/index.css'
|
||||||
|
|
||||||
|
import moment from 'moment-timezone'
|
||||||
|
|
||||||
import { post, get, put, del } from './http.js'
|
import { post, get, put, del } from './http.js'
|
||||||
import { clickoutside, bottomBoxWindow, stringTimeParseToUnix, unixTimeParseToString, chartResizeTool, tableSet, cancelWithChange, myLoading } from './components/common/js/tools.js'
|
import { clickoutside, bottomBoxWindow, stringTimeParseToUnix, unixTimeParseToString, chartResizeTool, tableSet, cancelWithChange, myLoading } from './components/common/js/tools.js'
|
||||||
import * as tools from './components/common/js/tools.js'
|
import * as tools from './components/common/js/tools.js'
|
||||||
@@ -104,13 +106,17 @@ Vue.mixin({
|
|||||||
return bus.UTCTimeToConfigTimezone(time)
|
return bus.UTCTimeToConfigTimezone(time)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
utcTimeToTimezoneStr: function (time) {
|
utcTimeToTimezoneStr: function (time, fmt) {
|
||||||
|
if (!fmt) {
|
||||||
|
fmt = localStorage.getItem('nz-default-dateFormat') || 'YYYY-MM-DD HH:mm:ss'
|
||||||
|
}
|
||||||
if (time) {
|
if (time) {
|
||||||
return bus.timeFormate(bus.UTCTimeToConfigTimezone(time), localStorage.getItem('nz-default-dateFormat') || 'YYYY-MM-DD HH:mm:ss')
|
return bus.timeFormate(bus.UTCTimeToConfigTimezone(time), fmt)
|
||||||
} else {
|
} else {
|
||||||
return '-'
|
return '-'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
timezoneToUtcTime: function (time) {
|
timezoneToUtcTime: function (time) {
|
||||||
if (time) {
|
if (time) {
|
||||||
return bus.configTimezoneToUTCTime(time)
|
return bus.configTimezoneToUTCTime(time)
|
||||||
@@ -189,6 +195,17 @@ Vue.mixin({
|
|||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
momentTz (timestamp, fmt) { // moment 转化时间戳为str
|
||||||
|
const offset = localStorage.getItem('nz-sys-timezone')
|
||||||
|
const format = fmt || localStorage.getItem('nz-default-dateFormat')
|
||||||
|
return moment.tz(timestamp, offset).format(format)
|
||||||
|
},
|
||||||
|
momentStrToTimestamp (str, fmt) {
|
||||||
|
const offset = localStorage.getItem('nz-sys-timezone')
|
||||||
|
const format = fmt || localStorage.getItem('nz-default-dateFormat')
|
||||||
|
const date = moment.tz(str, format, offset).valueOf()
|
||||||
|
return date
|
||||||
|
},
|
||||||
copyRow (row, rightBoxValKey, idKey = 'id', show = false, format, callback) {
|
copyRow (row, rightBoxValKey, idKey = 'id', show = false, format, callback) {
|
||||||
/*
|
/*
|
||||||
row 表格当前行
|
row 表格当前行
|
||||||
|
|||||||
Reference in New Issue
Block a user