CN-772: 解决状态保留相关bug

This commit is contained in:
刘洪洪
2022-11-07 15:28:25 +08:00
parent ec98178d45
commit 21e0f94d19
3 changed files with 61 additions and 14 deletions

View File

@@ -1117,6 +1117,8 @@ export default {
* */
handleTabValue (columnName, columnValue) {
// console.log('NetworkOverview类------handleTabValue下钻')
// 下钻前保存当前路由状态
this.beforeRouterPush()
const clickTab = this.getTabByName(columnName)// 下钻后显示的下钻tab对应的drilldownTabs
const tabLable = clickTab.label
const tabName = clickTab.name
@@ -1199,6 +1201,34 @@ export default {
}
})
},
/**
* 在路由跳转前,即下钻前将路由数据保存起来,确保回退和前进保留当时状态
*/
beforeRouterPush () {
const currentRouter = this.$_.cloneDeep(this.$route.query)
const tempObj = {
t: currentRouter.t,
query: currentRouter,
path: this.$_.cloneDeep(this.$route.path),
params: this.$_.cloneDeep(this.$route.params)
}
if (window.localRouterHistoryList.length > 0) {
let flag = true
window.localRouterHistoryList.forEach((item, index) => {
if (item.t === currentRouter.t) {
window.localRouterHistoryList[index] = tempObj
flag = false
}
if (!flag) {
return true
}
})
if (flag) window.localRouterHistoryList.push(tempObj)
} else {
window.localRouterHistoryList.push(tempObj)
}
},
handleSearchParams (columnValue) {
columnValue = columnValue.replaceAll("'", "\\\\'")
const queryCondition = []