fix: 修复情报页切换tab时,面包屑导航栏没有随之切换路由的问题

This commit is contained in:
刘洪洪
2024-03-06 20:23:23 +08:00
parent d82e700d55
commit bed28288cf
3 changed files with 34 additions and 3 deletions

View File

@@ -354,7 +354,7 @@ export default {
}, },
breadcrumb () { breadcrumb () {
const breadcrumb = [] const breadcrumb = []
this.generateBreadcrumb(breadcrumb, this.$store.getters.menuList) this.generateBreadcrumb(breadcrumb, this.$store.getters.menuList, this.$store.state.headerMenuByTab)
if (breadcrumb) { if (breadcrumb) {
// panel菜单是否可以点击跳转一级菜单不可点击二级菜单可以点击 // panel菜单是否可以点击跳转一级菜单不可点击二级菜单可以点击
if (breadcrumb[0] && breadcrumb[1] && breadcrumb[1].route && if (breadcrumb[0] && breadcrumb[1] && breadcrumb[1].route &&
@@ -414,6 +414,26 @@ export default {
if (newVal && Object.keys(newVal).length > 0) { if (newVal && Object.keys(newVal).length > 0) {
this.chartTimeFilter = newVal this.chartTimeFilter = newVal
} }
},
'$store.state.headerMenuByTab': function (newVal) {
if (newVal) {
const find = this.$store.getters.menuList.find(d => d.code === 'locationIntelligence')
if (find) {
const children = find.children
const item = children.find(d => d.code === newVal)
if (this.breadcrumb[0].code === find.code) {
const obj = {
code: item.code,
value: item.i18n ? this.$t(item.i18n) : item.name,
route: item.route,
type: 1,
clickable: true
}
this.breadcrumb[1] = obj
}
}
this.chartTimeFilter = newVal
}
} }
}, },
async mounted () { async mounted () {
@@ -457,7 +477,7 @@ export default {
} }
}, },
methods: { methods: {
generateBreadcrumb (breadcrumb, menus) { generateBreadcrumb (breadcrumb, menus, tab) {
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({

View File

@@ -83,7 +83,8 @@ const panel = {
p90: null p90: null
} }
}, },
chartTabList: null // chartTabs组件的tab状态点击列表初始化为null方便原有逻辑计算 chartTabList: null, // chartTabs组件的tab状态点击列表初始化为null方便原有逻辑计算
headerMenuByTab: 'locationMap'
}, },
mutations: { mutations: {
setShowRightBox (state, flag) { setShowRightBox (state, flag) {
@@ -228,6 +229,9 @@ const panel = {
}, },
setChartTabList (state, list) { setChartTabList (state, list) {
state.chartTabList = list state.chartTabList = list
},
setHeaderMenuByTab (state, data) {
state.headerMenuByTab = data
} }
}, },
getters: { getters: {
@@ -311,6 +315,9 @@ const panel = {
}, },
getScoreBase (state) { getScoreBase (state) {
return state.scoreBase return state.scoreBase
},
getHeaderMenuByTab (state) {
return state.headerMenuByTab
} }
}, },
actions: { actions: {
@@ -342,6 +349,9 @@ const panel = {
}, },
dispatchChartTabList (store, list) { dispatchChartTabList (store, list) {
store.commit('setChartTabList', list) store.commit('setChartTabList', list)
},
dispatchHeaderMenuByTab (store, data) {
store.commit('setHeaderMenuByTab', data)
} }
} }
} }

View File

@@ -1373,6 +1373,7 @@ export default {
watch: { watch: {
async activeTab (n) { async activeTab (n) {
this.initFlag = true this.initFlag = true
this.$store.state.headerMenuByTab = n
if (n === 'traceTracking') { if (n === 'traceTracking') {
// 切换到轨迹追踪tab时先移除地图上已有的图层和事件绑定、人型图标。基站予以保留 // 切换到轨迹追踪tab时先移除地图上已有的图层和事件绑定、人型图标。基站予以保留
this.unbindHexagonEvents() this.unbindHexagonEvents()