fix: 添加下钻前保存参数,回退时保留状态方法
This commit is contained in:
@@ -5,6 +5,7 @@ import { storageKey, iso36112, topDomain, echartsFontSize, dbGeoDataTableName, n
|
|||||||
import { getIso36112JsonData, getDictList } from '@/utils/api'
|
import { getIso36112JsonData, getDictList } from '@/utils/api'
|
||||||
import { format } from 'echarts'
|
import { format } from 'echarts'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
|
import store from '@/store'
|
||||||
import indexedDBUtils from '@/indexedDB'
|
import indexedDBUtils from '@/indexedDB'
|
||||||
|
|
||||||
export const tableSort = {
|
export const tableSort = {
|
||||||
@@ -1317,3 +1318,34 @@ export function switchStatus (status) {
|
|||||||
return 'Enabled'
|
return 'Enabled'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在路由跳转前,即下钻前将路由数据保存起来,确保回退和前进保留当时状态
|
||||||
|
*/
|
||||||
|
export function beforeRouterPush () {
|
||||||
|
const currentRouter = _.cloneDeep(router.currentRoute.value.query)
|
||||||
|
const historyList = _.cloneDeep(store.getters.getRouterHistoryList)
|
||||||
|
|
||||||
|
const tempObj = {
|
||||||
|
t: currentRouter.t,
|
||||||
|
query: currentRouter,
|
||||||
|
path: _.cloneDeep(router.currentRoute.value.path),
|
||||||
|
params: _.cloneDeep(router.currentRoute.value.params)
|
||||||
|
}
|
||||||
|
if (historyList.length > 0) {
|
||||||
|
let flag = true
|
||||||
|
historyList.forEach((item, index) => {
|
||||||
|
if (item.t === currentRouter.t) {
|
||||||
|
historyList[index] = tempObj
|
||||||
|
flag = false
|
||||||
|
}
|
||||||
|
if (!flag) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (flag) historyList.push(tempObj)
|
||||||
|
} else {
|
||||||
|
historyList.push(tempObj)
|
||||||
|
}
|
||||||
|
store.commit('setRouterHistoryList', historyList)
|
||||||
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ import chartMixin from '@/views/charts2/chart-mixin'
|
|||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { api } from '@/utils/api'
|
import { api } from '@/utils/api'
|
||||||
import { colorGradientCalculation } from '@/utils/tools'
|
import { colorGradientCalculation, beforeRouterPush } from '@/utils/tools'
|
||||||
import unitConvert from '@/utils/unit-convert'
|
import unitConvert from '@/utils/unit-convert'
|
||||||
import { drillDownPanelTypeMapping, storageKey, unitTypes } from '@/utils/constants'
|
import { drillDownPanelTypeMapping, storageKey, unitTypes } from '@/utils/constants'
|
||||||
import { getSecond } from '@/utils/date-util'
|
import { getSecond } from '@/utils/date-util'
|
||||||
@@ -372,6 +372,7 @@ export default {
|
|||||||
},
|
},
|
||||||
drillLinkId (item) {
|
drillLinkId (item) {
|
||||||
const queryCondition = `common_out_link_id = ${item.outLinkId} or common_in_link_id = ${item.inLinkId}`
|
const queryCondition = `common_out_link_id = ${item.outLinkId} or common_in_link_id = ${item.inLinkId}`
|
||||||
|
beforeRouterPush()
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
query: {
|
query: {
|
||||||
...this.$route.query,
|
...this.$route.query,
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import { getSecond } from '@/utils/date-util'
|
|||||||
import ChartNoData from '@/views/charts/charts/ChartNoData'
|
import ChartNoData from '@/views/charts/charts/ChartNoData'
|
||||||
import chartMixin from '@/views/charts2/chart-mixin'
|
import chartMixin from '@/views/charts2/chart-mixin'
|
||||||
import ChartError from '@/components/common/Error'
|
import ChartError from '@/components/common/Error'
|
||||||
import { getIndexByEventSeverity } from '@/utils/tools'
|
import { getIndexByEventSeverity, beforeRouterPush } from '@/utils/tools'
|
||||||
export default {
|
export default {
|
||||||
name: 'NetworkOverviewPerformanceEvent',
|
name: 'NetworkOverviewPerformanceEvent',
|
||||||
setup () {
|
setup () {
|
||||||
@@ -65,7 +65,7 @@ export default {
|
|||||||
startTime: getSecond(this.timeFilter.startTime),
|
startTime: getSecond(this.timeFilter.startTime),
|
||||||
endTime: getSecond(this.timeFilter.endTime)
|
endTime: getSecond(this.timeFilter.endTime)
|
||||||
}
|
}
|
||||||
/*const dom = document.getElementById('chart1')
|
/* const dom = document.getElementById('chart1')
|
||||||
const dom2 = document.getElementById('chart2')
|
const dom2 = document.getElementById('chart2')
|
||||||
if (dom) {
|
if (dom) {
|
||||||
if (!this.myChart) {
|
if (!this.myChart) {
|
||||||
@@ -145,7 +145,7 @@ export default {
|
|||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
this.loading2 = false
|
this.loading2 = false
|
||||||
})
|
})
|
||||||
}*/
|
} */
|
||||||
this.loading1 = false
|
this.loading1 = false
|
||||||
this.loading2 = false
|
this.loading2 = false
|
||||||
this.isNoData = true
|
this.isNoData = true
|
||||||
@@ -153,6 +153,7 @@ export default {
|
|||||||
this.toggleLoading(false)
|
this.toggleLoading(false)
|
||||||
},
|
},
|
||||||
routerJump () {
|
routerJump () {
|
||||||
|
beforeRouterPush()
|
||||||
const params = {
|
const params = {
|
||||||
startTime: this.timeFilter.startTime,
|
startTime: this.timeFilter.startTime,
|
||||||
endTime: this.timeFilter.endTime,
|
endTime: this.timeFilter.endTime,
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ import {
|
|||||||
} from '@/utils/constants'
|
} from '@/utils/constants'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import unitConvert, { valueToRangeValue } from '@/utils/unit-convert'
|
import unitConvert, { valueToRangeValue } from '@/utils/unit-convert'
|
||||||
import { getChainRatio, computeScore, urlParamsHandler, overwriteUrl, readDrilldownTableConfigByUser, combineDrilldownTableWithUserConfig, getDnsMapData, handleSpecialValue, getConfigVersion } from '@/utils/tools'
|
import { getChainRatio, computeScore, urlParamsHandler, overwriteUrl, readDrilldownTableConfigByUser, combineDrilldownTableWithUserConfig, getDnsMapData, handleSpecialValue, getConfigVersion, beforeRouterPush } from '@/utils/tools'
|
||||||
import { getSecond } from '@/utils/date-util'
|
import { getSecond } from '@/utils/date-util'
|
||||||
import chartMixin from '@/views/charts2/chart-mixin'
|
import chartMixin from '@/views/charts2/chart-mixin'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
@@ -1449,7 +1449,7 @@ export default {
|
|||||||
overwriteUrl(newUrl)
|
overwriteUrl(newUrl)
|
||||||
}
|
}
|
||||||
// 下钻前保存当前路由状态
|
// 下钻前保存当前路由状态
|
||||||
this.beforeRouterPush()
|
beforeRouterPush()
|
||||||
const clickTab = this.getTabByName(columnName)// 下钻后,显示的下钻tab对应的drilldownTabs
|
const clickTab = this.getTabByName(columnName)// 下钻后,显示的下钻tab对应的drilldownTabs
|
||||||
const tabLable = clickTab.label
|
const tabLable = clickTab.label
|
||||||
const tabName = clickTab.name
|
const tabName = clickTab.name
|
||||||
@@ -1539,36 +1539,6 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* 在路由跳转前,即下钻前将路由数据保存起来,确保回退和前进保留当时状态
|
|
||||||
*/
|
|
||||||
beforeRouterPush () {
|
|
||||||
const currentRouter = this.$_.cloneDeep(this.$route.query)
|
|
||||||
const historyList = this.$_.cloneDeep(this.$store.getters.getRouterHistoryList)
|
|
||||||
|
|
||||||
const tempObj = {
|
|
||||||
t: currentRouter.t,
|
|
||||||
query: currentRouter,
|
|
||||||
path: this.$_.cloneDeep(this.$route.path),
|
|
||||||
params: this.$_.cloneDeep(this.$route.params)
|
|
||||||
}
|
|
||||||
if (historyList.length > 0) {
|
|
||||||
let flag = true
|
|
||||||
historyList.forEach((item, index) => {
|
|
||||||
if (item.t === currentRouter.t) {
|
|
||||||
historyList[index] = tempObj
|
|
||||||
flag = false
|
|
||||||
}
|
|
||||||
if (!flag) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if (flag) historyList.push(tempObj)
|
|
||||||
} else {
|
|
||||||
historyList.push(tempObj)
|
|
||||||
}
|
|
||||||
this.$store.commit('setRouterHistoryList', historyList)
|
|
||||||
},
|
|
||||||
handleSearchParams (columnValue) {
|
handleSearchParams (columnValue) {
|
||||||
columnValue = handleSpecialValue(columnValue)// columnValue.replaceAll("'", "\\\\'")
|
columnValue = handleSpecialValue(columnValue)// columnValue.replaceAll("'", "\\\\'")
|
||||||
const queryCondition = []
|
const queryCondition = []
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ import { ref } from 'vue'
|
|||||||
import ChartError from '@/components/common/Error'
|
import ChartError from '@/components/common/Error'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { dataForNpmRecentEvents } from '@/utils/static-data'
|
import { dataForNpmRecentEvents } from '@/utils/static-data'
|
||||||
|
import { beforeRouterPush } from '@/utils/tools'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'NpmRecentEvents',
|
name: 'NpmRecentEvents',
|
||||||
@@ -108,7 +109,7 @@ export default {
|
|||||||
url = api.npm.events.recentEvents
|
url = api.npm.events.recentEvents
|
||||||
}
|
}
|
||||||
|
|
||||||
/*this.toggleLoading(true)
|
/* this.toggleLoading(true)
|
||||||
axios.get(url, { params: params }).then(response => {
|
axios.get(url, { params: params }).then(response => {
|
||||||
const res = response.data
|
const res = response.data
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
@@ -129,7 +130,7 @@ export default {
|
|||||||
this.httpError(e)
|
this.httpError(e)
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
this.toggleLoading(false)
|
this.toggleLoading(false)
|
||||||
})*/
|
}) */
|
||||||
this.isNoData = true
|
this.isNoData = true
|
||||||
this.toggleLoading(false)
|
this.toggleLoading(false)
|
||||||
},
|
},
|
||||||
@@ -144,7 +145,7 @@ export default {
|
|||||||
return name
|
return name
|
||||||
},
|
},
|
||||||
jumpPage (item) {
|
jumpPage (item) {
|
||||||
this.beforeRouterPush()
|
beforeRouterPush()
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: '/detection/performanceEvent',
|
path: '/detection/performanceEvent',
|
||||||
query: {
|
query: {
|
||||||
@@ -153,36 +154,6 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* 在路由跳转前,即下钻前将路由数据保存起来,确保回退和前进保留当时状态
|
|
||||||
*/
|
|
||||||
beforeRouterPush () {
|
|
||||||
const currentRouter = this.$_.cloneDeep(this.$route.query)
|
|
||||||
const historyList = this.$_.cloneDeep(this.$store.getters.getRouterHistoryList)
|
|
||||||
|
|
||||||
const tempObj = {
|
|
||||||
t: currentRouter.t,
|
|
||||||
query: currentRouter,
|
|
||||||
path: this.$_.cloneDeep(this.$route.path),
|
|
||||||
params: this.$_.cloneDeep(this.$route.params)
|
|
||||||
}
|
|
||||||
if (historyList.length > 0) {
|
|
||||||
let flag = true
|
|
||||||
historyList.forEach((item, index) => {
|
|
||||||
if (item.t === currentRouter.t) {
|
|
||||||
historyList[index] = tempObj
|
|
||||||
flag = false
|
|
||||||
}
|
|
||||||
if (!flag) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if (flag) historyList.push(tempObj)
|
|
||||||
} else {
|
|
||||||
historyList.push(tempObj)
|
|
||||||
}
|
|
||||||
this.$store.commit('setRouterHistoryList', historyList)
|
|
||||||
},
|
|
||||||
httpError (res) {
|
httpError (res) {
|
||||||
this.isNoData = false
|
this.isNoData = false
|
||||||
this.showError = true
|
this.showError = true
|
||||||
|
|||||||
Reference in New Issue
Block a user