diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/logBottomTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/logBottomTab.vue index 18fbbc76b..27b2e8865 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/logBottomTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/logBottomTab.vue @@ -61,8 +61,8 @@ export default { return { logData: null, filterTime: [ - bus.timeFormate(bus.getOffsetTimezoneData(-1), this.timeFormatMain), - bus.timeFormate(bus.getOffsetTimezoneData(), this.timeFormatMain) + bus.timeFormate(bus.getOffsetTimezoneData(-1)), + bus.timeFormate(bus.getOffsetTimezoneData()) ], expressions: [''], matchSymbol: '|=', @@ -75,8 +75,8 @@ export default { exportLog ({ limit, descending }) { const params = { logql: this.expressions, - start: this.$stringTimeParseToUnix(this.filterTime[0]), - end: this.$stringTimeParseToUnix(this.filterTime[1]), + start: this.$stringTimeParseToUnix(bus.formateTimeToTime(this.filterTime[0])), + end: this.$stringTimeParseToUnix(bus.formateTimeToTime(this.filterTime[1])), direction: descending ? 'backward' : 'forward', limit } @@ -118,7 +118,9 @@ export default { if (item != '') { let expr = item this.matchContent && (expr = `${item} ${this.matchSymbol} "${this.matchContent}"`) - requestArr.push(this.$get('/logs/loki/api/v1/query_range?format=1&query=' + encodeURIComponent(expr) + '&start=' + this.$stringTimeParseToUnix(this.filterTime[0]) + '&end=' + this.$stringTimeParseToUnix(this.filterTime[1]) + '&limit=' + limit)) + const statTime = bus.formateTimeToTime(this.filterTime[0]) + const endTime = bus.formateTimeToTime(this.filterTime[1]) + requestArr.push(this.$get('/logs/loki/api/v1/query_range?format=1&query=' + encodeURIComponent(expr) + '&start=' + this.$stringTimeParseToUnix(statTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&limit=' + limit)) } }) axios.all(requestArr).then(res => { diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue b/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue index 7e18df206..56b62dcc3 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue @@ -289,8 +289,8 @@ export default { this.getData(this.filter) }, refreshTime (st, et) { - const startTime = bus.timeFormate(st, 'yyyy-MM-dd hh:mm') - const endTime = bus.timeFormate(et, 'yyyy-MM-dd hh:mm') + const startTime = bus.timeFormate(st) + const endTime = bus.timeFormate(et) this.searchTime = [startTime, endTime] }, panelReloadForDel () { @@ -494,9 +494,10 @@ export default { if (this.$refs.pickTime) { const nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType this.nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType + console.log(nowTimeType, this.nowTimeType) this.setSearchTime(nowTimeType.type, nowTimeType.value) - this.filter.start_time = bus.timeFormate(this.searchTime[0], 'YYYY-MM-DD HH:mm:ss') - this.filter.end_time = bus.timeFormate(this.searchTime[1], 'YYYY-MM-DD HH:mm:ss') + this.filter.start_time = bus.timeFormate(this.searchTime[0]) + this.filter.end_time = bus.timeFormate(this.searchTime[1]) this.filter.panelId = this.showPanel.id this.getData(this.filter) this.$store.dispatch('dispatchPanelTime', { @@ -508,20 +509,21 @@ export default { /* 时间条件查询--end */ setSearchTime (type, val) { // 设置searchTime if (type === 'minute') { - const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setMinutes(new Date(bus.computeTimezone(new Date().getTime())).getMinutes() - val), 'YYYY-MM-DD HH:mm:ss') - const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'YYYY-MM-DD HH:mm:ss') + const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setMinutes(new Date(bus.computeTimezone(new Date().getTime())).getMinutes() - val)) + const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime()))) this.$set(this.searchTime, 0, startTime) this.$set(this.searchTime, 1, endTime) this.$set(this.searchTime, 2, val + 'm') } else if (type === 'hour') { - const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - val), 'YYYY-MM-DD HH:mm:ss') - const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'YYYY-MM-DD HH:mm:ss') + const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - val)) + const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime()))) this.$set(this.searchTime, 0, startTime) this.$set(this.searchTime, 1, endTime) this.$set(this.searchTime, 2, val + 'h') + console.log(this.searchTime) } else if (type === 'date') { - const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setDate(new Date(bus.computeTimezone(new Date().getTime())).getDate() - val), 'YYYY-MM-DD HH:mm:ss') - const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'YYYY-MM-DD HH:mm:ss') + const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setDate(new Date(bus.computeTimezone(new Date().getTime())).getDate() - val)) + const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime()))) this.$set(this.searchTime, 0, startTime) this.$set(this.searchTime, 1, endTime) this.$set(this.searchTime, 2, val + 'd') diff --git a/nezha-fronted/src/components/common/timePicker.vue b/nezha-fronted/src/components/common/timePicker.vue index eed500617..52f41880f 100644 --- a/nezha-fronted/src/components/common/timePicker.vue +++ b/nezha-fronted/src/components/common/timePicker.vue @@ -255,7 +255,7 @@ export default { this.getRangeHistoryArr() }, methods: { - changeDropdownFlag(){ + changeDropdownFlag () { if (this.dropdownFlag) { this.dropdownFlag = false } @@ -269,27 +269,27 @@ export default { }, myDatePickerShow (item) { this.whoChoose = item - this.isCustom = true + this.isCustom = true this.$refs.calendar.focus() - this.$refs.calendar.pickerVisible = true - if (document.getElementById('viewGraphDialog')) { - // 处理 多弹出的z-index的问题 当前为 alertMessage的处理 - const viewGraphDialogStyle = window.getComputedStyle( - document.getElementById('viewGraphDialog', null) - ) - setTimeout(() => { - if (viewGraphDialogStyle['z-index'] !== 'auto') { - const dom = + this.$refs.calendar.pickerVisible = true + if (document.getElementById('viewGraphDialog')) { + // 处理 多弹出的z-index的问题 当前为 alertMessage的处理 + const viewGraphDialogStyle = window.getComputedStyle( + document.getElementById('viewGraphDialog', null) + ) + setTimeout(() => { + if (viewGraphDialogStyle['z-index'] !== 'auto') { + const dom = document.getElementsByClassName('el-picker-panel') - Array.prototype.forEach.call(dom, function (element) { - element.style['z-index'] = + Array.prototype.forEach.call(dom, function (element) { + element.style['z-index'] = viewGraphDialogStyle['z-index'] + 1 - }) - this.$refs.calendar.$el.style['z-index'] = + }) + this.$refs.calendar.$el.style['z-index'] = viewGraphDialogStyle['z-index'] + 1 - } - }) - } + } + }) + } }, historyChange (item) { this.searchTime[0] = item.start @@ -389,27 +389,27 @@ export default { // } // this.$set(this.searchTime, 0, bus.timeFormate(time[0])) // this.$set(this.searchTime, 1, bus.timeFormate(time[1])) - this.$set(this.searchTime, 0, bus.timeFormate(timeGroup.start_time)); - this.$set(this.searchTime, 1, bus.timeFormate(timeGroup.end_time)); + this.$set(this.searchTime, 0, bus.timeFormate(timeGroup.start_time)) + this.$set(this.searchTime, 1, bus.timeFormate(timeGroup.end_time)) this.showTime = this.nowTimeType = { id: 4, - text: this.$t("dashboard.panel.lastOneHour"), - type: "hour", - value: 1, - }; - const time = bus.getTimezontDateRange(); + text: this.$t('dashboard.panel.lastOneHour'), + type: 'hour', + value: 1 + } + const time = bus.getTimezontDateRange() if (timeGroup.start_time) { this.$set( this.searchTime, 0, bus.timeFormate(timeGroup.start_time) - ); - this.$set(this.searchTime, 1, bus.timeFormate(timeGroup.end_time)); + ) + this.$set(this.searchTime, 1, bus.timeFormate(timeGroup.end_time)) } else { - this.$set(this.searchTime, 0, bus.timeFormate(time[0])); - this.$set(this.searchTime, 1, bus.timeFormate(time[1])); + this.$set(this.searchTime, 0, bus.timeFormate(time[0])) + this.$set(this.searchTime, 1, bus.timeFormate(time[1])) } - this.$set(this.searchTime, 0, bus.timeFormate(time[0])); + this.$set(this.searchTime, 0, bus.timeFormate(time[0])) } } else { this.showTime = this.nowTimeType = { @@ -463,7 +463,7 @@ export default { } } } else { - this.isCustom = false; + this.isCustom = false this.showDropdown() if (this.showEmpty && id === 12) { this.searchTime = []