NEZ-3005 fix:APM Explorer的query按钮不能自动更新Relative Time Range
This commit is contained in:
@@ -531,6 +531,7 @@ export default {
|
||||
})
|
||||
},
|
||||
getAlertList () {
|
||||
this.setSearchTime('searchTime')
|
||||
this.tableData = []
|
||||
this.loading = true
|
||||
this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo)
|
||||
|
||||
@@ -382,6 +382,7 @@ export default {
|
||||
})
|
||||
},
|
||||
dateChange () {
|
||||
this.setSearchTime('searchTimeHeader')
|
||||
this.getTableData()
|
||||
},
|
||||
getTableData (state) {
|
||||
|
||||
@@ -431,6 +431,7 @@ export default {
|
||||
})
|
||||
},
|
||||
queryChartDate () {
|
||||
this.setSearchTime('searchTime')
|
||||
const start = this.searchTime[0] ? this.searchTime[0] : this.getTime(-1, 'h')
|
||||
const end = this.searchTime[1] ? this.searchTime[1] : this.getTime(0, 'h')
|
||||
this.searchTime = [start, end]
|
||||
|
||||
@@ -152,6 +152,38 @@ export default {
|
||||
}
|
||||
return aliasExpression
|
||||
}
|
||||
},
|
||||
/* 时间条件查询--end */
|
||||
setSearchTime (key, cb) { // 设置searchTime
|
||||
if (this.$refs.pickTime) {
|
||||
const nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType
|
||||
this.nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType
|
||||
const type = nowTimeType.type
|
||||
const val = nowTimeType.value
|
||||
if (type === 'minute') {
|
||||
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[key], 0, startTime)
|
||||
this.$set(this[key], 1, endTime)
|
||||
this.$set(this[key], 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))
|
||||
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())))
|
||||
this.$set(this[key], 0, startTime)
|
||||
this.$set(this[key], 1, endTime)
|
||||
this.$set(this[key], 2, val + 'h')
|
||||
} 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))
|
||||
const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())))
|
||||
this.$set(this[key], 0, startTime)
|
||||
this.$set(this[key], 1, endTime)
|
||||
this.$set(this[key], 2, val + 'd')
|
||||
}
|
||||
this.$refs.pickTime.$refs.timePicker.searchTime = this[key]
|
||||
}
|
||||
if (cb) {
|
||||
this.cb()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -881,6 +881,7 @@ export default {
|
||||
},
|
||||
|
||||
dateChange () {
|
||||
this.setSearchTime('searchTime')
|
||||
this.getTableData()
|
||||
},
|
||||
getTableData (state) {
|
||||
|
||||
@@ -3988,6 +3988,11 @@ export default {
|
||||
}
|
||||
},
|
||||
expressionChange () {
|
||||
if (this.$refs.pickTime) {
|
||||
const nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType
|
||||
this.nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType
|
||||
this.setSearchTime(nowTimeType.type, nowTimeType.value)
|
||||
}
|
||||
if (this.expressions && this.expressions.length >= 1) {
|
||||
if (this.showMetrics) {
|
||||
this.queryTableData()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const timePicker = {
|
||||
state: {
|
||||
timePickerLocked: localStorage.getItem('nz-time-picker-locked') ? JSON.parse(localStorage.getItem('nz-time-picker-locked')) : false,
|
||||
timePickerRange: localStorage.getItem('nz-time-picker-range') ? JSON.parse(localStorage.getItem('nz-time-picker-range')) : {},
|
||||
timePickerRange: localStorage.getItem('nz-time-picker-range') ? JSON.parse(localStorage.getItem('nz-time-picker-range')) : {}
|
||||
},
|
||||
mutations: {
|
||||
setTimePickerLocked (state, flag) {
|
||||
|
||||
Reference in New Issue
Block a user