CN-1468 fix: 路由动态设置

This commit is contained in:
chenjinsong
2023-11-09 16:17:25 +08:00
parent 1410f890f3
commit 330a4b0d3b
20 changed files with 161 additions and 157 deletions

View File

@@ -308,7 +308,7 @@ export default {
return this.$store.getters.menuList.find(menu => menu.code === 'networkAnalytics') return this.$store.getters.menuList.find(menu => menu.code === 'networkAnalytics')
}, },
otherMenu () { otherMenu () {
return this.$store.getters.menuList.filter(menu => ['networkAnalytics', 'chart', 'I18N', 'entityDetail', 'temp', 'entityGraph', 'detectionPolicy'].indexOf(menu.code) === -1) return this.$store.getters.menuList.filter(menu => ['networkAnalytics', 'I18N', 'entityDetail', 'entityGraph', 'detectionPolicy'].indexOf(menu.code) === -1)
/* function excludeButton (menu) { /* function excludeButton (menu) {
for (let i = 0; i < menu.length; i++) { for (let i = 0; i < menu.length; i++) {
@@ -370,7 +370,7 @@ export default {
}, },
async breadcrumb (n) { async breadcrumb (n) {
this.curTabProp = this.$route.query.dimensionType ? this.$route.query.dimensionType : null this.curTabProp = this.$route.query.dimensionType ? this.$route.query.dimensionType : null
if (this.$route.params.typeName === fromRoute.dnsServiceInsights) { if (this.$route.path.replace('/panel/', '') === fromRoute.dnsServiceInsights) {
if (this.dnsQtypeMapData.size === 0) { if (this.dnsQtypeMapData.size === 0) {
this.dnsQtypeMapData = await getDnsMapData('dnsQtype') this.dnsQtypeMapData = await getDnsMapData('dnsQtype')
} }
@@ -388,7 +388,7 @@ export default {
async mounted () { async mounted () {
this.from = Object.keys(this.entityType)[0] this.from = Object.keys(this.entityType)[0]
// 是否需要dns的qtype和rcode的数据字典 // 是否需要dns的qtype和rcode的数据字典
if (this.$route.params.typeName === fromRoute.dnsServiceInsights) { if (this.$route.path.replace('/panel/', '') === fromRoute.dnsServiceInsights) {
if (this.dnsQtypeMapData.size === 0) { if (this.dnsQtypeMapData.size === 0) {
this.dnsQtypeMapData = await getDnsMapData('dnsQtype') this.dnsQtypeMapData = await getDnsMapData('dnsQtype')
} }
@@ -427,7 +427,7 @@ export default {
}, },
methods: { methods: {
generateBreadcrumb (breadcrumb, menus) { generateBreadcrumb (breadcrumb, menus) {
if (this.route === '/entityDetail') { /*if (this.route === '/entityDetail') {
const entityMenu = menus.find(m => m.route === '/entityExplorer') const entityMenu = menus.find(m => m.route === '/entityExplorer')
const entityDetailMenu = menus.find(m => m.route === '/entityDetail') const entityDetailMenu = menus.find(m => m.route === '/entityDetail')
breadcrumb.push({ breadcrumb.push({
@@ -459,7 +459,7 @@ export default {
type: entityGraphMenu.type type: entityGraphMenu.type
}) })
return true return true
} }*/
const menu = menus.find(m => m.route === this.route) const menu = menus.find(m => m.route === this.route)
if (menu) { if (menu) {
breadcrumb.unshift({ breadcrumb.unshift({
@@ -511,7 +511,7 @@ export default {
}, },
getCurTabByLabel (label) { getCurTabByLabel (label) {
let curTab = null let curTab = null
const tableType = this.$route.params ? this.$route.params.typeName : 'networkOverview' const tableType = this.$route.path.replace('/panel/', '') || 'networkOverview'
const curTableInCode = networkTable[tableType] ? networkTable[tableType] : networkTable.networkOverview const curTableInCode = networkTable[tableType] ? networkTable[tableType] : networkTable.networkOverview
if (curTableInCode && curTableInCode.tabList) { if (curTableInCode && curTableInCode.tabList) {
curTab = curTableInCode.tabList.find(item => item.label === label) curTab = curTableInCode.tabList.find(item => item.label === label)
@@ -524,7 +524,7 @@ export default {
const currentValue = document.getElementById('breadcrumbValue') ? document.getElementById('breadcrumbValue').innerText : '' const currentValue = document.getElementById('breadcrumbValue') ? document.getElementById('breadcrumbValue').innerText : ''
const columnName = this.getUrlParam(this.curTabState.thirdMenu, '') const columnName = this.getUrlParam(this.curTabState.thirdMenu, '')
let type = 'ip' let type = 'ip'
const tableType = this.$route.params ? this.$route.params.typeName : 'networkOverview' const tableType = this.$route.path.replace('/panel/', '') || 'networkOverview'
const curTableInCode = networkTable[tableType] ? networkTable[tableType] : networkTable.networkOverview const curTableInCode = networkTable[tableType] ? networkTable[tableType] : networkTable.networkOverview
if (curTableInCode && curTableInCode.tabList) { if (curTableInCode && curTableInCode.tabList) {
const curTab = curTableInCode.tabList.find(item => item.label === columnName) const curTab = curTableInCode.tabList.find(item => item.label === columnName)
@@ -548,7 +548,7 @@ export default {
axios.get(curTableInCode.url.drilldownList, { params }).then(async response => { axios.get(curTableInCode.url.drilldownList, { params }).then(async response => {
if (response.status === 200) { if (response.status === 200) {
this.breadcrumbColumnValueListShow = response.data.data.result this.breadcrumbColumnValueListShow = response.data.data.result
if (this.$route.params.typeName === fromRoute.dnsServiceInsights) { if (this.$route.path.replace('/panel/', '') === fromRoute.dnsServiceInsights) {
if (this.dnsQtypeMapData.size === 0) { if (this.dnsQtypeMapData.size === 0) {
this.dnsQtypeMapData = await getDnsMapData('dnsQtype') this.dnsQtypeMapData = await getDnsMapData('dnsQtype')
} }
@@ -679,7 +679,7 @@ export default {
}, },
async handleCurDrilldownTableConfig (thirdMenu) { async handleCurDrilldownTableConfig (thirdMenu) {
// const userId = localStorage.getItem(storageKey.userId) // const userId = localStorage.getItem(storageKey.userId)
const tableType = this.$route.params ? this.$route.params.typeName : 'networkOverview' const tableType = this.$route.path.replace('/panel/', '') || 'networkOverview'
const metric = this.getUrlParam(this.curTabState.tableMetric, 'Bits/s') const metric = this.getUrlParam(this.curTabState.tableMetric, 'Bits/s')
const drillDownTableConfigs = await combineDrilldownTableWithUserConfig() const drillDownTableConfigs = await combineDrilldownTableWithUserConfig()
const currentTableConfig = drillDownTableConfigs.find(config => config.route === tableType) const currentTableConfig = drillDownTableConfigs.find(config => config.route === tableType)
@@ -701,6 +701,7 @@ export default {
} }
}, },
async jump (route, columnName, columnValue, opeType) { async jump (route, columnName, columnValue, opeType) {
route = route.replace('redirect:', '')
if (route === '/panel/linkMonitor' && opeType === 3) { if (route === '/panel/linkMonitor' && opeType === 3) {
return true return true
} }
@@ -720,7 +721,7 @@ export default {
this.$store.commit('setNetworkOverviewTabList', []) this.$store.commit('setNetworkOverviewTabList', [])
} }
// 清空网络概况的特殊面包屑 // 清空网络概况的特殊面包屑
const tableType = this.$route.params ? this.$route.params.typeName : 'networkOverview' const tableType = this.$route.path.replace('/panel/', '') || 'networkOverview'
const metric = this.getUrlParam(this.curTabState.tableMetric, 'Bits/s') const metric = this.getUrlParam(this.curTabState.tableMetric, 'Bits/s')
const curTab = await getDefaultCurTab(tableType, metric, columnName) const curTab = await getDefaultCurTab(tableType, metric, columnName)
this.$store.getters.menuList.forEach(menu => { this.$store.getters.menuList.forEach(menu => {

View File

@@ -32,14 +32,19 @@ router.beforeEach(async (to, from, next) => {
store.commit('setMenuList', menuList) store.commit('setMenuList', menuList)
store.commit('setButtonList', buttonList) store.commit('setButtonList', buttonList)
store.commit('setRoleList', roleList) store.commit('setRoleList', roleList)
} const homeRoute = {
if (to.path) { path: '/',
next() name: 'home',
/* if (hasMenu(store.getters.menuList, to.path)) { component: () => import('@/components/layout/Home'),
children: []
}
handleRoutes(menuList, homeRoute.children)
router.addRoute(homeRoute)
next({ ...to, replace: true })
} else {
if (to.path) {
next() next()
} else { }
ElMessage.error('No access') // TODO 国际化
} */
} }
} }
} else { } else {
@@ -160,3 +165,99 @@ export function getWelcomeMenu (menu) {
} }
} }
} }
export function handleComponent (code) {
switch (code) {
case 'networkOverview':
case 'networkAppPerformance':
case 'dnsServiceInsights':
case 'linkMonitor':
return () => import('@/views/charts2/Panel')
case 'entity':
return () => import('@/views/entityExplorer/EntityExplorer')
case 'entityDetail':
return () => import('@/views/entityExplorer/EntityDetail')
case 'entityGraph':
return () => import('@/views/entityExplorer/EntityGraph')
case 'securityEvents':
case 'performanceEvents':
return () => import('@/views/detections/Index')
case 'detectionPolicy':
return () => import('@/views/detections/detectionPolicies/Index')
case 'createDetectionPolicy':
case 'editDetectionPolicy':
return () => import('@/views/detections/detectionPolicies/PolicyForm')
case 'report':
return () => import('@/views/report/Report')
case 'knowledgeBase':
case 'userDefinedLibrary':
return () => import('@/views/setting/KnowledgeBase')
case 'createUserDefinedLibrary':
case 'editUserDefinedLibrary':
return () => import('@/views/setting/KnowledgeBaseForm')
case 'administration':
return () => import('@/views/administration/Index')
case 'user':
return () => import('@/views/administration/User')
case 'role':
return () => import('@/views/administration/Roles')
case 'operationLog':
return () => import('@/views/administration/OperationLog')
case 'appearance':
return () => import('@/views/administration/Appearance')
case 'I18N':
return () => import('@/views/administration/I18n')
default:
return null
}
}
export function handleRoutes (menus, routes) {
menus.forEach(menu => {
if (menu.route === '' && (!menu.children || menu.children.length < 0)) {
return false
}
// administration的路由使用了嵌套其他的是平铺
if (menu.pid === 0 && menu.code === 'administration') {
const path = menu.route.replace('redirect:', '')
if (menu.children && menu.children.length > 0) {
const route = {
name: menu.name,
path,
redirect: menu.children[0].route,
component: handleComponent(menu.code),
children: []
}
menu.children.forEach(c => {
route.children.push({
name: c.name,
path: c.route,
component: handleComponent(c.code)
})
})
routes.push(route)
}
} else {
if (menu.route && menu.route.startsWith('redirect:')) {
const path = menu.route.replace('redirect:', '')
if (menu.children && menu.children.length > 0) {
routes.push({
name: menu.name,
path,
redirect: menu.children[0].route
})
handleRoutes(menu.children, routes)
}
} else {
routes.push({
name: menu.code,
path: menu.route,
component: handleComponent(menu.code)
})
}
if (menu.children && menu.children.length > 0) {
handleRoutes(menu.children, routes)
}
}
})
}

View File

@@ -5,106 +5,6 @@ const routes = [
{ {
path: '/login', path: '/login',
component: () => import('@/Login') component: () => import('@/Login')
},
{
path: '/',
component: () => import('@/components/layout/Home'),
children: [
{
name: 'panel',
path: '/panel/:typeName',
component: () => import('@/views/charts2/Panel')
},
{
path: '/report/builtIn',
component: () => import('@/views/report/Report')
},
{
path: '/entityExplorer',
component: () => import('@/views/entityExplorer/EntityExplorer')
},
{
path: '/entityDetail',
component: () => import('@/views/entityExplorer/EntityDetail')
},
{
path: '/entityGraph',
component: () => import('@/views/entityExplorer/EntityGraph')
},
{
path: '/detection',
redirect: '/detection/securityEvent'
},
{
path: '/detection/:typeName',
component: () => import('@/views/detections/Index')
},
{
path: '/businessLog/viewer',
component: () => import('@/views/businessLog/Viewer')
},
{
path: '/knowledgeBase',
component: () => import('@/views/setting/KnowledgeBase')
},
{
path: '/knowledgeBase/userDefinedLibrary',
component: () => import('@/views/setting/KnowledgeBase')
},
{
path: '/knowledgeBase/userDefinedLibrary/create',
component: () => import('@/views/setting/KnowledgeBaseForm')
},
{
path: '/knowledgeBase/userDefinedLibrary/edit',
component: () => import('@/views/setting/KnowledgeBaseForm')
},
{
name: 'Administration',
path: '/administration',
redirect: '/administration/user',
component: () => import('@/views/administration/Index'),
children: [
{
name: 'User',
path: '/administration/user',
component: () => import('@/views/administration/User')
},
{
name: 'Role',
path: '/administration/role',
component: () => import('@/views/administration/Roles')
},
{
name: 'OperationLog',
path: '/administration/operationLog',
component: () => import('@/views/administration/OperationLog')
},
{
name: 'Appearance',
path: '/administration/appearance',
component: () => import('@/views/administration/Appearance')
}
]
},
{
name: 'I18n',
path: '/i18n',
component: () => import('@/views/administration/I18n')
},
{
path: '/detectionPolicy',
component: () => import('@/views/detections/detectionPolicies/Index')
},
{
path: '/detectionPolicy/create',
component: () => import('@/views/detections/detectionPolicies/PolicyForm')
},
{
path: '/detectionPolicy/edit',
component: () => import('@/views/detections/detectionPolicies/PolicyForm')
}
]
} }
] ]

View File

@@ -1,6 +1,6 @@
import axios from 'axios' import axios from 'axios'
import router from '@/router' import router from '@/router'
import { getWelcomeMenu, sortByOrderNum } from '@/permission' import { getWelcomeMenu, sortByOrderNum, handleRoutes } from '@/permission'
import { ElMessage } from 'element-plus' // dependent on utc plugin import { ElMessage } from 'element-plus' // dependent on utc plugin
import { dbDrilldownTableConfig, storageKey } from '@/utils/constants' import { dbDrilldownTableConfig, storageKey } from '@/utils/constants'
import { getConfigVersion } from '@/utils/tools' import { getConfigVersion } from '@/utils/tools'
@@ -64,7 +64,14 @@ const user = {
store.commit('setMenuList', menuList) store.commit('setMenuList', menuList)
store.commit('setButtonList', res2.data.buttons) store.commit('setButtonList', res2.data.buttons)
store.commit('setRoleList', res2.data.roles) store.commit('setRoleList', res2.data.roles)
const homeRoute = {
path: '/',
name: 'home',
component: () => import('@/components/layout/Home'),
children: []
}
handleRoutes(menuList, homeRoute.children)
router.addRoute(homeRoute)
if (res.loginSuccessPath) { if (res.loginSuccessPath) {
let tempArr = res.loginSuccessPath.split('?') let tempArr = res.loginSuccessPath.split('?')
const path = tempArr[0] const path = tempArr[0]

View File

@@ -213,7 +213,7 @@ export const detectionPageType = {
} }
export const listScrollPath = [ export const listScrollPath = [
'/entityExplorer', '/entity',
'/detection/performanceEvent', '/detection/performanceEvent',
'/detection/securityEvent' '/detection/securityEvent'
] ]

View File

@@ -5,12 +5,12 @@
v-if="panel.params && panel.params.wholeScreenScroll" v-if="panel.params && panel.params.wholeScreenScroll"
id="wholeScreenBox" id="wholeScreenBox"
> >
<dns-screen v-if="currentPath === wholeScreenRouterMapping.dns" <!-- <dns-screen v-if="currentPath === wholeScreenRouterMapping.dns"
:copy-data-list="chartList" :copy-data-list="chartList"
ref="dnsScreen" ref="dnsScreen"
:time-filter="timeFilter" :time-filter="timeFilter"
:entity="entity"> :entity="entity">
</dns-screen> </dns-screen>-->
</div> </div>
<div id="panelList" v-if="!isEntityDetail" class="panel-list"> <div id="panelList" v-if="!isEntityDetail" class="panel-list">
<div id="cn-panel" class="cn-panel2"> <div id="cn-panel" class="cn-panel2">
@@ -49,7 +49,7 @@
<script> <script>
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
import { ref } from 'vue' import { ref } from 'vue'
import DnsScreen from '@/views/charts/wholeScreenScroll/DnsScreen' // import DnsScreen from '@/views/charts/wholeScreenScroll/DnsScreen'
import { panelTypeAndRouteMapping, wholeScreenRouterMapping } from '@/utils/constants' import { panelTypeAndRouteMapping, wholeScreenRouterMapping } from '@/utils/constants'
import { api, getPanelList, getChartList } from '@/utils/api' import { api, getPanelList, getChartList } from '@/utils/api'
import { getNowTime } from '@/utils/date-util' import { getNowTime } from '@/utils/date-util'
@@ -66,9 +66,9 @@ export default {
isEntityDetail: Boolean, isEntityDetail: Boolean,
typeName: String typeName: String
}, },
components: { /*components: {
DnsScreen DnsScreen
}, },*/
data () { data () {
return { return {
chartList: [], // 普通panel的chart chartList: [], // 普通panel的chart
@@ -104,8 +104,8 @@ export default {
setup (props, ctx) { setup (props, ctx) {
const panel = ref({}) const panel = ref({})
let panelType = 1 // 取得panel的type let panelType = 1 // 取得panel的type
const { params } = useRoute() const { path } = useRoute()
panelType = props.entity ? props.entity.type : panelTypeAndRouteMapping[params.typeName] panelType = props.entity ? props.entity.type : panelTypeAndRouteMapping[path.replace('/panel/', '')]
// date // date
const dateRangeValue = 60 const dateRangeValue = 60

View File

@@ -148,7 +148,7 @@ export default {
// this.panelName = this.$store.getters.getPanelName // this.panelName = this.$store.getters.getPanelName
const pName = this.$route.query.panelName ? this.$t(this.$route.query.panelName) : '' const pName = this.$route.query.panelName ? this.$t(this.$route.query.panelName) : ''
const curTabProp = this.$route.query.dimensionType ? this.$route.query.dimensionType : null const curTabProp = this.$route.query.dimensionType ? this.$route.query.dimensionType : null
if (this.$route.params.typeName === fromRoute.dnsServiceInsights) { if (this.$route.path.replace('/panel/', '') === fromRoute.dnsServiceInsights) {
this.dnsQtypeMapData = await getDnsMapData('dnsQtype') this.dnsQtypeMapData = await getDnsMapData('dnsQtype')
this.dnsRcodeMapData = await getDnsMapData('dnsRcode') this.dnsRcodeMapData = await getDnsMapData('dnsRcode')
this.$store.commit('setDnsQtypeMapData', this.dnsQtypeMapData) this.$store.commit('setDnsQtypeMapData', this.dnsQtypeMapData)
@@ -249,12 +249,11 @@ export default {
const panel = ref({}) const panel = ref({})
let panelType = 1 // 取得panel的type let panelType = 1 // 取得panel的type
let { params, query, path } = useRoute() let { query, path } = useRoute()
// 获取路由跳转过的历史状态,赋值给当前界面,起到保留状态的作用,如浏览器的回退前进等 // 获取路由跳转过的历史状态,赋值给当前界面,起到保留状态的作用,如浏览器的回退前进等
const routerObj = store.getters.getRouterHistoryList.find(item => item.t === query.t) const routerObj = store.getters.getRouterHistoryList.find(item => item.t === query.t)
if (routerObj) { if (routerObj) {
params = routerObj.params
query = routerObj.query query = routerObj.query
path = routerObj.path path = routerObj.path
@@ -292,7 +291,7 @@ export default {
} else if (thirdPanel) { } else if (thirdPanel) {
panelType = Number(thirdPanel) panelType = Number(thirdPanel)
} else { } else {
panelType = props.entity ? props.entity.type : panelTypeAndRouteMapping[params.typeName] panelType = props.entity ? props.entity.type : panelTypeAndRouteMapping[path.replace('/panel/', '')]
} }
// 获取url携带的range、startTime、endTime // 获取url携带的range、startTime、endTime
@@ -519,7 +518,7 @@ export default {
}, },
jumpEntityDetail () { jumpEntityDetail () {
const { href } = this.$router.resolve({ const { href } = this.$router.resolve({
path: '/entityDetail', path: '/entity/detail',
query: { query: {
entityType: this.entityType, entityType: this.entityType,
entityName: this.entityValue entityName: this.entityValue

View File

@@ -282,7 +282,7 @@ export default {
icon: 'cn-icon cn-icon-graph', icon: 'cn-icon cn-icon-graph',
label: i18n.global.t('entities.graph'), label: i18n.global.t('entities.graph'),
url: resolvePath({ url: resolvePath({
path: '/entityGraph', path: '/entity/graph',
query: { query: {
entityType: props.entity.entityType, entityType: props.entity.entityType,
entityName: props.entity.entityName entityName: props.entity.entityName

View File

@@ -326,7 +326,7 @@ export default {
if (tabType) { if (tabType) {
const oldCurTab = this.getUrlParam(this.curTabState.networkOverviewBeforeTab, '') const oldCurTab = this.getUrlParam(this.curTabState.networkOverviewBeforeTab, '')
const curTable = networkTable.networkOverview const curTable = networkTable.networkOverview
const tableType = this.$route.params ? this.$route.params.typeName : 'networkOverview' const tableType = this.$route.path.replace('/panel/', '') || 'networkOverview'
const metric = this.getUrlParam(this.curTabState.tableMetric, 'Bits/s') const metric = this.getUrlParam(this.curTabState.tableMetric, 'Bits/s')
const list = await getUserDrilldownTableConfig(tableType, metric) const list = await getUserDrilldownTableConfig(tableType, metric)
const tabGroup = list.filter(item => item.label === tabType) const tabGroup = list.filter(item => item.label === tabType)

View File

@@ -503,7 +503,7 @@ export default {
const currentValue = document.getElementById('tabSearchValue' + tabProp) ? document.getElementById('tabSearchValue' + tabProp).value : '' const currentValue = document.getElementById('tabSearchValue' + tabProp) ? document.getElementById('tabSearchValue' + tabProp).value : ''
const columnName = curTab ? curTab.label : '' const columnName = curTab ? curTab.label : ''
let type = 'ip' let type = 'ip'
const tableType = this.$route.params ? this.$route.params.typeName : 'networkOverview' const tableType = this.$route.path.replace('/panel/', '') || 'networkOverview'
const curTableInCode = networkTable[tableType] ? networkTable[tableType] : networkTable.networkOverview const curTableInCode = networkTable[tableType] ? networkTable[tableType] : networkTable.networkOverview
if (curTableInCode && curTableInCode.tabList) { if (curTableInCode && curTableInCode.tabList) {
const curTab = curTableInCode.tabList.find(item => item.label === columnName) const curTab = curTableInCode.tabList.find(item => item.label === columnName)
@@ -536,7 +536,7 @@ export default {
axios.get(url, { params }).then(async response => { axios.get(url, { params }).then(async response => {
if (response.status === 200) { if (response.status === 200) {
this.tabSearchColumnValueListShow = response.data.data.result this.tabSearchColumnValueListShow = response.data.data.result
if (this.$route.params.typeName === fromRoute.dnsServiceInsights) { if (this.$route.path.replace('/panel/', '') === fromRoute.dnsServiceInsights) {
if (this.dnsQtypeMapData.size === 0) { if (this.dnsQtypeMapData.size === 0) {
this.dnsQtypeMapData = await getDnsMapData('dnsQtype') this.dnsQtypeMapData = await getDnsMapData('dnsQtype')
} }
@@ -2262,10 +2262,9 @@ export default {
this.drillDownTableConfigs = null this.drillDownTableConfigs = null
this.curTable = null this.curTable = null
this.commonColumnList = null this.commonColumnList = null
this.userId = localStorage.getItem(storageKey.userId) this.userId = localStorage.getItem(storageKey.userId)
this.drillDownTableConfigs = await combineDrilldownTableWithUserConfig() this.drillDownTableConfigs = await combineDrilldownTableWithUserConfig()
this.tableType = this.$route.params ? this.$route.params.typeName : 'networkOverview' this.tableType = this.$route.path.replace('/panel/', '') || 'networkOverview'
// 是否需要dns的qtype和rcode的数据字典 // 是否需要dns的qtype和rcode的数据字典
if (this.tableType === fromRoute.dnsServiceInsights) { if (this.tableType === fromRoute.dnsServiceInsights) {
this.dnsQtypeMapData = this.$store.getters.getDnsQtypeMapData this.dnsQtypeMapData = this.$store.getters.getDnsQtypeMapData
@@ -2347,8 +2346,6 @@ export default {
await this.saveUserLocalConfig() await this.saveUserLocalConfig()
this.getChartData() this.getChartData()
}, },
setup (props) {
},
beforeUnmount () { beforeUnmount () {
// 以下元素,检测到内存并未释放 // 以下元素,检测到内存并未释放
this.unitConvert = null this.unitConvert = null

View File

@@ -322,7 +322,7 @@ export default {
const tabType = 'network.applicationCategories' const tabType = 'network.applicationCategories'
const oldCurTab = this.getUrlParam(this.curTabState.networkOverviewBeforeTab, '') const oldCurTab = this.getUrlParam(this.curTabState.networkOverviewBeforeTab, '')
const curTable = networkTable.networkAppPerformance const curTable = networkTable.networkAppPerformance
const tableType = this.$route.params ? this.$route.params.typeName : 'networkOverview' const tableType = this.$route.path.replace('/panel/', '') || 'networkOverview'
const metric = this.getUrlParam(this.curTabState.tableMetric, 'Bits/s') const metric = this.getUrlParam(this.curTabState.tableMetric, 'Bits/s')
const list = await getUserDrilldownTableConfig(tableType, metric) const list = await getUserDrilldownTableConfig(tableType, metric)
const tabGroup = list.filter(item => item.label === tabType) const tabGroup = list.filter(item => item.label === tabType)

View File

@@ -810,7 +810,7 @@ export default {
}, },
jumpNewDetetion () { jumpNewDetetion () {
this.$router.push({ this.$router.push({
path: '/detectionPolicy', path: '/detection/policy',
query: { query: {
t: +new Date() t: +new Date()
} }
@@ -1006,11 +1006,10 @@ export default {
}, },
setup () { setup () {
const store = useStore() const store = useStore()
let { params, query, path } = useRoute() let { query, path } = useRoute()
// 获取路由跳转过的历史状态,赋值给当前界面,起到保留状态的作用,如浏览器的回退前进等 // 获取路由跳转过的历史状态,赋值给当前界面,起到保留状态的作用,如浏览器的回退前进等
const routerObj = store.getters.getRouterHistoryList.find(item => item.t === query.t) const routerObj = store.getters.getRouterHistoryList.find(item => item.t === query.t)
if (routerObj) { if (routerObj) {
params = routerObj.params
query = routerObj.query query = routerObj.query
path = routerObj.path path = routerObj.path
@@ -1018,7 +1017,7 @@ export default {
const newUrl = urlParamsHandler(window.location.href, useRoute().query, query) const newUrl = urlParamsHandler(window.location.href, useRoute().query, query)
overwriteUrl(newUrl) overwriteUrl(newUrl)
} }
const pageType = params.typeName const pageType = path.replace('/detection/', '')
// 获取url携带的range、startTime、endTime // 获取url携带的range、startTime、endTime
const rangeParam = query.range const rangeParam = query.range
const startTimeParam = query.startTime const startTimeParam = query.startTime

View File

@@ -140,7 +140,7 @@ export default {
}, },
onCreate () { onCreate () {
this.$router.push({ this.$router.push({
path: '/detectionPolicy/create', path: '/detection/policy/create',
query: { query: {
t: +new Date() t: +new Date()
} }
@@ -149,7 +149,7 @@ export default {
onEdit () { onEdit () {
const pageNo = this.$router.currentRoute.value.query.pageNo const pageNo = this.$router.currentRoute.value.query.pageNo
this.$router.push({ this.$router.push({
path: '/detectionPolicy/edit', path: '/detection/policy/edit',
query: { query: {
t: +new Date(), t: +new Date(),
pageNoForTable: pageNo || 1, pageNoForTable: pageNo || 1,

View File

@@ -332,7 +332,7 @@ export default {
console.error(e) console.error(e)
this.$message.error(this.errorMsgHandler(e)) this.$message.error(this.errorMsgHandler(e))
this.$router.push({ this.$router.push({
path: '/detectionPolicy', path: '/detection/policy',
query: { query: {
pageNo: this.pageNoForTable ? Number(this.pageNoForTable) : 1, pageNo: this.pageNoForTable ? Number(this.pageNoForTable) : 1,
t: +new Date() t: +new Date()
@@ -404,7 +404,7 @@ export default {
}) })
this.$router.push({ this.$router.push({
path: '/detectionPolicy', path: '/detection/policy',
query: { query: {
t: +new Date() t: +new Date()
} }
@@ -430,7 +430,7 @@ export default {
}) })
this.$router.push({ this.$router.push({
path: '/detectionPolicy', path: '/detection/policy',
query: { query: {
pageNo: self.pageNoForTable ? Number(self.pageNoForTable) : 1, pageNo: self.pageNoForTable ? Number(self.pageNoForTable) : 1,
t: +new Date() t: +new Date()

View File

@@ -243,7 +243,7 @@ export default {
}, },
goDetail (type, name) { goDetail (type, name) {
const { href } = this.$router.resolve({ const { href } = this.$router.resolve({
path: '/entityDetail', path: '/entity/detail',
query: { query: {
entityType: type, entityType: type,
entityName: name entityName: name

View File

@@ -274,7 +274,7 @@ export default {
}, },
goDetail (type, name) { goDetail (type, name) {
const { href } = this.$router.resolve({ const { href } = this.$router.resolve({
path: '/entityDetail', path: '/entity/detail',
query: { query: {
entityType: type, entityType: type,
entityName: name entityName: name

View File

@@ -235,7 +235,7 @@ export default {
}, },
goDetail (type, name) { goDetail (type, name) {
const { href } = this.$router.resolve({ const { href } = this.$router.resolve({
path: '/entityDetail', path: '/entity/detail',
query: { query: {
entityType: type, entityType: type,
entityName: name entityName: name

View File

@@ -488,7 +488,7 @@ export default {
goDetail (type, name) { goDetail (type, name) {
if (name) { if (name) {
const { href } = this.$router.resolve({ const { href } = this.$router.resolve({
path: '/entityDetail', path: '/entity/detail',
query: { query: {
entityType: type, entityType: type,
entityName: name entityName: name

View File

@@ -396,7 +396,7 @@ export default {
if (!this.showList) { if (!this.showList) {
// 首页进入搜索时重载页面,视觉上进入列表页面 // 首页进入搜索时重载页面,视觉上进入列表页面
this.$router.push({ this.$router.push({
path: '/entityExplorer', path: '/entity',
query: { query: {
listMode: this.listMode, listMode: this.listMode,
q: urlQ, q: urlQ,

View File

@@ -121,7 +121,7 @@ export default {
methods: { methods: {
showDetail () { showDetail () {
const { href } = this.$router.resolve({ const { href } = this.$router.resolve({
path: '/entityDetail', path: '/entity/detail',
query: { query: {
entityType: this.entityData.entityType, entityType: this.entityData.entityType,
entityName: this.entityData.entityValue entityName: this.entityData.entityValue
@@ -131,7 +131,7 @@ export default {
}, },
showGraph () { showGraph () {
const { href } = this.$router.resolve({ const { href } = this.$router.resolve({
path: '/entityGraph', path: '/entity/graph',
query: { query: {
entityType: this.entityData.entityType, entityType: this.entityData.entityType,
entityName: this.entityData.entityValue entityName: this.entityData.entityValue