From bed28288cf4d3bf241edbdfcf8dfdcdb5e08c87c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B4=AA=E6=B4=AA?= <2498601771@qq.com> Date: Wed, 6 Mar 2024 20:23:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=83=85=E6=8A=A5?= =?UTF-8?q?=E9=A1=B5=E5=88=87=E6=8D=A2tab=E6=97=B6=EF=BC=8C=E9=9D=A2?= =?UTF-8?q?=E5=8C=85=E5=B1=91=E5=AF=BC=E8=88=AA=E6=A0=8F=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E9=9A=8F=E4=B9=8B=E5=88=87=E6=8D=A2=E8=B7=AF=E7=94=B1=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/layout/Header.vue | 24 ++++++++++++++++++++++-- src/store/modules/panel.js | 12 +++++++++++- src/views/location/Index.vue | 1 + 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/components/layout/Header.vue b/src/components/layout/Header.vue index 67d2f19e..9515ea28 100644 --- a/src/components/layout/Header.vue +++ b/src/components/layout/Header.vue @@ -354,7 +354,7 @@ export default { }, breadcrumb () { const breadcrumb = [] - this.generateBreadcrumb(breadcrumb, this.$store.getters.menuList) + this.generateBreadcrumb(breadcrumb, this.$store.getters.menuList, this.$store.state.headerMenuByTab) if (breadcrumb) { // panel菜单是否可以点击跳转:一级菜单不可点击,二级菜单可以点击 if (breadcrumb[0] && breadcrumb[1] && breadcrumb[1].route && @@ -414,6 +414,26 @@ export default { if (newVal && Object.keys(newVal).length > 0) { 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 () { @@ -457,7 +477,7 @@ export default { } }, methods: { - generateBreadcrumb (breadcrumb, menus) { + generateBreadcrumb (breadcrumb, menus, tab) { const menu = menus.find(m => m.route === this.route) if (menu) { breadcrumb.unshift({ diff --git a/src/store/modules/panel.js b/src/store/modules/panel.js index 4b6ed4b9..af659926 100644 --- a/src/store/modules/panel.js +++ b/src/store/modules/panel.js @@ -83,7 +83,8 @@ const panel = { p90: null } }, - chartTabList: null // chartTabs组件的tab状态点击列表,初始化为null方便原有逻辑计算 + chartTabList: null, // chartTabs组件的tab状态点击列表,初始化为null方便原有逻辑计算 + headerMenuByTab: 'locationMap' }, mutations: { setShowRightBox (state, flag) { @@ -228,6 +229,9 @@ const panel = { }, setChartTabList (state, list) { state.chartTabList = list + }, + setHeaderMenuByTab (state, data) { + state.headerMenuByTab = data } }, getters: { @@ -311,6 +315,9 @@ const panel = { }, getScoreBase (state) { return state.scoreBase + }, + getHeaderMenuByTab (state) { + return state.headerMenuByTab } }, actions: { @@ -342,6 +349,9 @@ const panel = { }, dispatchChartTabList (store, list) { store.commit('setChartTabList', list) + }, + dispatchHeaderMenuByTab (store, data) { + store.commit('setHeaderMenuByTab', data) } } } diff --git a/src/views/location/Index.vue b/src/views/location/Index.vue index 25b7e294..701d0c01 100644 --- a/src/views/location/Index.vue +++ b/src/views/location/Index.vue @@ -1373,6 +1373,7 @@ export default { watch: { async activeTab (n) { this.initFlag = true + this.$store.state.headerMenuByTab = n if (n === 'traceTracking') { // 切换到轨迹追踪tab时,先移除地图上已有的图层和事件绑定、人型图标。基站予以保留 this.unbindHexagonEvents()