CN-697 fix: 下钻界面刷新保持状态

This commit is contained in:
@changcode
2022-09-20 10:35:39 +08:00
parent e69a0147e7
commit 27146d195d
3 changed files with 28 additions and 22 deletions

View File

@@ -171,13 +171,6 @@ export default {
}) })
overwriteUrl(newUrl) overwriteUrl(newUrl)
}, },
queryCondition (n) {
const { query } = this.$route
const newUrl = urlParamsHandler(window.location.href, query, {
queryCondition: n
})
overwriteUrl(newUrl)
},
timeFilter: { timeFilter: {
deep: true, deep: true,
handler (n) { handler (n) {
@@ -198,14 +191,11 @@ export default {
startTime: getSecond(this.timeFilter.startTime), startTime: getSecond(this.timeFilter.startTime),
endTime: getSecond(this.timeFilter.endTime) endTime: getSecond(this.timeFilter.endTime)
} }
// const condition = this.$store.getters.getQueryCondition
// const condition = this.$route.query.queryCondition ? this.$route.query.queryCondition : ''
if (this.queryCondition) { if (this.queryCondition) {
params.q = this.queryCondition params.q = this.queryCondition
} }
// const condition = this.$store.getters.getQueryCondition
const condition = this.$route.query.queryCondition ? this.$route.query.queryCondition : ''
if (condition) {
params.q = condition
}
this.toggleLoading(true) this.toggleLoading(true)
get(api.netWorkOverview.totalTrafficAnalysis, params).then((res) => { get(api.netWorkOverview.totalTrafficAnalysis, params).then((res) => {
if (res.code === 200) { if (res.code === 200) {

View File

@@ -15,10 +15,21 @@ import { api } from '@/utils/api'
import chartMixin from '@/views/charts2/chart-mixin' import chartMixin from '@/views/charts2/chart-mixin'
import _ from 'lodash' import _ from 'lodash'
import { computeScore, getChainRatio } from '@/utils/tools' import { computeScore, getChainRatio } from '@/utils/tools'
import { useRoute } from 'vue-router'
import { ref } from 'vue'
export default { export default {
name: 'NpmNetworkQuantity', name: 'NpmNetworkQuantity',
components: { SingleValue }, components: { SingleValue },
mixins: [chartMixin], mixins: [chartMixin],
setup () {
const { query } = useRoute()
const queryCondition = ref(query.queryCondition || '')
const dimensionType = ref(query.dimensionType || '')
return {
queryCondition,
dimensionType
}
},
data () { data () {
return { return {
npmNetworkName: [ npmNetworkName: [
@@ -47,15 +58,16 @@ export default {
}, },
methods: { methods: {
npmNetworkCycleQuery () { npmNetworkCycleQuery () {
const conditionStr = this.$route.query.queryCondition ? this.$route.query.queryCondition : '' // const conditionStr = this.$route.query.queryCondition ? this.$route.query.queryCondition : ''
let condition = '' let condition = ''
if (conditionStr.indexOf('OR') > -1) { if (this.queryCondition.indexOf('OR') > -1) {
condition = conditionStr.split(/["|'](.*?)["|']/) condition = this.queryCondition.split(/["|'](.*?)["|']/)
} else { } else {
condition = conditionStr condition = this.queryCondition
} }
// const type = this.$store.getters.getDimensionType // const type = this.$store.getters.getDimensionType
const type = this.$route.query.dimensionType ? this.$route.query.dimensionType : '' // const type = this.$route.query.dimensionType ? this.$route.query.dimensionType : ''
const type = this.dimensionType
const params = { const params = {
startTime: getSecond(this.timeFilter.startTime), startTime: getSecond(this.timeFilter.startTime),
endTime: getSecond(this.timeFilter.endTime), endTime: getSecond(this.timeFilter.endTime),

View File

@@ -49,8 +49,12 @@ export default {
setup () { setup () {
const { query } = useRoute() const { query } = useRoute()
const metricFilter = ref(query.lineMetric || 'Bits/s') const metricFilter = ref(query.lineMetric || 'Bits/s')
const queryCondition = ref(query.queryCondition || '')
const dimensionType = ref(query.dimensionType || '')
return { return {
metricFilter, metricFilter,
queryCondition,
dimensionType,
myChart: shallowRef(null) myChart: shallowRef(null)
} }
}, },
@@ -131,15 +135,15 @@ export default {
if (!val) { if (!val) {
val = this.metricFilter val = this.metricFilter
} }
const conditionStr = this.$route.query.queryCondition ? this.$route.query.queryCondition : '' // const conditionStr = this.$route.query.queryCondition ? this.$route.query.queryCondition : ''
let condition = '' let condition = ''
if (conditionStr.indexOf('OR') > -1) { if (this.queryCondition.indexOf('OR') > -1) {
condition = conditionStr.split(/["|'](.*?)["|']/) condition = this.queryCondition.split(/["|'](.*?)["|']/)
} else { } else {
condition = conditionStr condition = this.queryCondition
} }
// const type = this.$store.getters.getDimensionType // const type = this.$store.getters.getDimensionType
const type = this.$route.query.dimensionType ? this.$route.query.dimensionType : '' const type = this.dimensionType
if (this.chartData.id === 24) { if (this.chartData.id === 24) {
this.side = 'client' this.side = 'client'
} else if (this.chartData.id === 29) { } else if (this.chartData.id === 29) {