diff --git a/nezha-fronted/src/components/common/alert/alertMessageTable.vue b/nezha-fronted/src/components/common/alert/alertMessageTable.vue index c6deeeb42..592b0360b 100644 --- a/nezha-fronted/src/components/common/alert/alertMessageTable.vue +++ b/nezha-fronted/src/components/common/alert/alertMessageTable.vue @@ -84,6 +84,8 @@ P3 + {{utcTimeToTimezoneStr(scope.row[item.prop])}} + {{utcTimeToTimezoneStr(scope.row[item.prop])}} diff --git a/nezha-fronted/src/components/page/config/mib.vue b/nezha-fronted/src/components/page/config/mib.vue index 3fa7c918f..c8623ffb1 100644 --- a/nezha-fronted/src/components/page/config/mib.vue +++ b/nezha-fronted/src/components/page/config/mib.vue @@ -73,6 +73,7 @@ + {{utcTimeToTimezoneStr(scope.row[item.prop])}}
  diff --git a/nezha-fronted/src/components/page/config/operationlog.vue b/nezha-fronted/src/components/page/config/operationlog.vue index 6185e9b64..d6b492215 100644 --- a/nezha-fronted/src/components/page/config/operationlog.vue +++ b/nezha-fronted/src/components/page/config/operationlog.vue @@ -50,6 +50,7 @@ {{scope.row[item.prop]}} ms + {{utcTimeToTimezoneStr(scope.row[item.prop])}} {{scope.row[item.prop]}} diff --git a/nezha-fronted/src/components/page/config/promServer.vue b/nezha-fronted/src/components/page/config/promServer.vue index 297919908..e6f08bfd5 100644 --- a/nezha-fronted/src/components/page/config/promServer.vue +++ b/nezha-fronted/src/components/page/config/promServer.vue @@ -48,8 +48,9 @@ {{scope.row[item.prop] == '2' ? 'Per-Datacenter' : ''}}--> {{findServerType(scope.row[item.prop]).text}} + {{utcTimeToTimezoneStr(scope.row[item.prop])}} - +
diff --git a/nezha-fronted/src/components/page/config/terminallog.vue b/nezha-fronted/src/components/page/config/terminallog.vue index 633039262..cdb106b13 100644 --- a/nezha-fronted/src/components/page/config/terminallog.vue +++ b/nezha-fronted/src/components/page/config/terminallog.vue @@ -51,6 +51,7 @@ {{scope.row[item.prop] == 'zh' ? '中文' : ''}} {{scope.row[item.prop] == 'ru' ? 'русский' : ''}}
+ {{utcTimeToTimezoneStr(scope.row[item.prop])}} @@ -92,7 +93,7 @@ show: false, isEdit: false, //false查看,true编辑 title: '' - + }, rightBoxResize: { //resize弹出框相关 show: false, diff --git a/nezha-fronted/src/components/page/dashboard/overview/overview2.scss b/nezha-fronted/src/components/page/dashboard/overview/overview2.scss index 230a02b0f..e7ee564ac 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/overview2.scss +++ b/nezha-fronted/src/components/page/dashboard/overview/overview2.scss @@ -356,4 +356,13 @@ top: 50%; transform: translate(100%, -50%); } - +.overview-loading{ + width: 35px; + height: 35px; + position: relative; +} +.overview-loading .el-loading-spinner{ + transform: scale(0.5); + top: -5px; + left: 0px; +} diff --git a/nezha-fronted/src/components/page/dashboard/overview/overview2.vue b/nezha-fronted/src/components/page/dashboard/overview/overview2.vue index 28eb24477..71a799626 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/overview2.vue +++ b/nezha-fronted/src/components/page/dashboard/overview/overview2.vue @@ -3,6 +3,7 @@
{{systemName&&systemName != 'undefined'&&systemName != null?systemName: $t('dashboard.overview.contentTitle')}}
+
{{sysTime}}
@@ -187,7 +188,7 @@ diff --git a/nezha-fronted/src/libs/bus.js b/nezha-fronted/src/libs/bus.js index 6b0e56364..60d6e4541 100644 --- a/nezha-fronted/src/libs/bus.js +++ b/nezha-fronted/src/libs/bus.js @@ -255,6 +255,7 @@ export default new Vue({ } return statisticsRlt; }, + //将本地时区转为系统配置的时区 computeTimezone:function(sourceTime){ let offset=localStorage.getItem('nz-sys-timezone'); if(offset&& offset != 'undefined' && offset != null){ @@ -290,7 +291,34 @@ export default new Vue({ }, delay); } }, + UTCTimeToConfigTimezone:function(utcTime){ + let offset=localStorage.getItem('nz-sys-timezone'); + if(offset&& offset != 'undefined' && offset != null){ + let time = utcTime; + if(typeof time == 'string' && /(\d+?-){2}\d+?\s(\d+?:)*\d+/.test(time)){ + time = new Date(time).getTime(); + } + offset=Number.parseInt(offset); + return time += offset * 60*60*1000 + }else{ + return utcTime; + } + }, + configTimezoneToUTCTime:function(configTime){ + let offset=localStorage.getItem('nz-sys-timezone'); + if(offset&& offset != 'undefined' && offset != null){ + let time = configTime; + if(typeof time == 'string' && /(\d+?-){2}\d+?\s(\d+?:)*\d+/.test(time)){ + time = new Date(time).getTime(); + } + offset=Number.parseInt(offset); + return time -= offset * 60*60*1000 + + }else{ + return configTime; + } + } }, created() { this.getDefaultDate(); diff --git a/nezha-fronted/src/main.js b/nezha-fronted/src/main.js index 843537d1f..c1c58cf6a 100644 --- a/nezha-fronted/src/main.js +++ b/nezha-fronted/src/main.js @@ -44,6 +44,7 @@ import loading from "./components/common/loading"; import mibBox from "./components/common/rightBox/mibBox"; import leftMenu from "./components/common/leftMenu"; import pickTime from "./components/common/pickTime"; +import bus from "./libs/bus"; Vue.component("Pagination", Pagination); Vue.component("searchInput", searchInput); @@ -88,6 +89,34 @@ Vue.prototype.$tableHeight = { //列表页表格的高度 noPagination: 'calc(100% - 60px)', //特例:没有翻页组件 }; +Vue.mixin({ + methods: { + utcTimeToTimezone:function(time){ + if(time){ + return bus.UTCTimeToConfigTimezone(time) + } + }, + utcTimeToTimezoneStr:function(time,format='yyyy-MM-dd hh:mm:ss'){ + if(time){ + return bus.timeFormate(bus.UTCTimeToConfigTimezone(time),format) + }else{ + return '-' + } + }, + timezoneToUtcTime:function(time){ + if(time){ + return bus.configTimezoneToUTCTime(time) + } + }, + timezoneToUtcTimeStr:function(time,format='yyyy-MM-dd hh:mm:ss'){ + if(time){ + return bus.timeFormate(this.timezoneToUtcTime(time),format) + } + } + } +}) + + Vue.config.productionTip = false; Vue.use(ElementUI); Vue.use(Vuex);