fix:CN-1518 Network Overview流量曲线图的交互逻辑优化,减少请求次数

This commit is contained in:
hanyuxia
2023-12-19 13:44:14 +08:00
parent a2a7bdcd14
commit 56ad79bd0d
2 changed files with 41 additions and 5 deletions

View File

@@ -408,9 +408,18 @@ export default {
},
metricChange (value) {
const { query } = this.$route
const newUrl = urlParamsHandler(window.location.href, query, {
metric: value
})
const rangeParam = query.range
let params = { metric: value }
// 优先级url > config.js > 默认值。
const dateRangeValue = rangeParam ? parseInt(rangeParam) : (DEFAULT_TIME_FILTER_RANGE.dashboard || 60)
if (dateRangeValue !== -1) {
const { startTime, endTime } = getNowTime(dateRangeValue)
this.timeFilter = { startTime: getSecond(startTime), endTime: getSecond(endTime), dateRangeValue: dateRangeValue }
this.$store.commit('setTimeRangeArray', [this.timeFilter.startTime, this.timeFilter.endTime])
this.$store.commit('setTimeRangeFlag', dateRangeValue.value)
params = { metric: value, startTime: this.timeFilter.startTime, endTime: this.timeFilter.endTime, range: dateRangeValue }
}
const newUrl = urlParamsHandler(window.location.href, query, params)
overwriteUrl(newUrl)
},
// 动态查询评分基准