diff --git a/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue b/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue index 63c9fe4de..e80839a7e 100644 --- a/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue +++ b/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue @@ -193,6 +193,7 @@ export default { return { minTime, maxTime, minValue, maxValue, copies, unit, dot } }, xAxisLabelFormatter (minTime, maxTime) { + let self = this return function (val, index) { const value = val * 1000 let offset = localStorage.getItem('nz-sys-timezone') @@ -211,12 +212,23 @@ export default { const diffSec = (maxTime - minTime) const secOneDay = 24 * 60 * 60// 1天的秒数 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) { // 同一天 return [hour, minute].join(':') } 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天 - return [tData.getMonth() + 1, tData.getDate()].join('/') + return str } } else { return [tData.getFullYear(), tData.getMonth() + 1, tData.getDate()].join('/') + '\n' + diff --git a/nezha-fronted/src/components/page/dashboard/overview/chart.vue b/nezha-fronted/src/components/page/dashboard/overview/chart.vue index e34f1cd30..ffc587b95 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/chart.vue +++ b/nezha-fronted/src/components/page/dashboard/overview/chart.vue @@ -387,7 +387,16 @@ export default { 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() - 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(':') }, defaultToolBoxFormatter (params) { diff --git a/nezha-fronted/src/components/page/tool/trace.vue b/nezha-fronted/src/components/page/tool/trace.vue index 3dd8c7dc2..57dd41178 100644 --- a/nezha-fronted/src/components/page/tool/trace.vue +++ b/nezha-fronted/src/components/page/tool/trace.vue @@ -95,7 +95,7 @@ {{$t('ping.progress')}}:{{process}}% - {{$t('ping.trance')}} + {{$t('ping.trace')}} {{$t('config.terminallog.stop')}}