NEZ-1801 fix:更改日期格式后Explore内查询图表信息下方日期未同步

This commit is contained in:
zhangyu
2022-06-01 11:23:47 +08:00
parent c440466895
commit baca48b651
3 changed files with 25 additions and 4 deletions

View File

@@ -193,6 +193,7 @@ export default {
return { minTime, maxTime, minValue, maxValue, copies, unit, dot } return { minTime, maxTime, minValue, maxValue, copies, unit, dot }
}, },
xAxisLabelFormatter (minTime, maxTime) { xAxisLabelFormatter (minTime, maxTime) {
let self = this
return function (val, index) { return function (val, index) {
const value = val * 1000 const value = val * 1000
let offset = localStorage.getItem('nz-sys-timezone') let offset = localStorage.getItem('nz-sys-timezone')
@@ -211,12 +212,23 @@ export default {
const diffSec = (maxTime - minTime) const diffSec = (maxTime - minTime)
const secOneDay = 24 * 60 * 60// 1天的秒数 const secOneDay = 24 * 60 * 60// 1天的秒数
const secOneMonth = secOneDay * 30// 30天的秒数 const secOneMonth = secOneDay * 30// 30天的秒数
const dateFormatStr = self.timeFormatMain.split(' ')[0]
let str = ''
const month = tData.getMonth() + 1
const day = tData.getDate()
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) { // 同一天 if (diffSec <= secOneDay) { // 同一天
return [hour, minute].join(':') return [hour, minute].join(':')
} else if (diffSec < secOneMonth) { // 大于1天小于30天 } else if (diffSec < secOneMonth) { // 大于1天小于30天
return [tData.getMonth() + 1, tData.getDate()].join('/') + '\n' + [hour, minute].join(':') return str + '\n' + [hour, minute].join(':')
} else { // 大于等于30天 } else { // 大于等于30天
return [tData.getMonth() + 1, tData.getDate()].join('/') return str
} }
} else { } else {
return [tData.getFullYear(), tData.getMonth() + 1, tData.getDate()].join('/') + '\n' + return [tData.getFullYear(), tData.getMonth() + 1, tData.getDate()].join('/') + '\n' +

View File

@@ -387,7 +387,16 @@ export default {
const day = tData.getDate() > 9 ? tData.getDate() : '0' + tData.getDate() const day = tData.getDate() > 9 ? tData.getDate() : '0' + tData.getDate()
const hour = tData.getHours() > 9 ? tData.getHours() : '0' + tData.getHours() const hour = tData.getHours() > 9 ? tData.getHours() : '0' + tData.getHours()
const minute = tData.getMinutes() > 9 ? tData.getMinutes() : '0' + tData.getMinutes() const minute = tData.getMinutes() > 9 ? tData.getMinutes() : '0' + tData.getMinutes()
return [month, day].join('-') + '\n' + const dateFormatStr = this.timeFormatMain.split(' ')[0]
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('-')
}
return str + '\n' +
[hour, minute].join(':') [hour, minute].join(':')
}, },
defaultToolBoxFormatter (params) { defaultToolBoxFormatter (params) {

View File

@@ -95,7 +95,7 @@
<span>{{$t('ping.progress')}}:<span class="margin-l-10 margin-r-30">{{process}}%</span></span> <span>{{$t('ping.progress')}}:<span class="margin-l-10 margin-r-30">{{process}}%</span></span>
</div> </div>
<el-button class="nz-btn nz-btn-size-normal nz-btn-style-normal" v-if="!isStart" @click="startTask"> <el-button class="nz-btn nz-btn-size-normal nz-btn-style-normal" v-if="!isStart" @click="startTask">
{{$t('ping.trance')}} {{$t('ping.trace')}}
</el-button> </el-button>
<el-button class="nz-btn nz-btn-size-normal nz-btn-style-normal" v-else @click="clearTask"> <el-button class="nz-btn nz-btn-size-normal nz-btn-style-normal" v-else @click="clearTask">
{{$t('config.terminallog.stop')}} {{$t('config.terminallog.stop')}}