Commit 544c9a18 authored by wangdanlei's avatar wangdanlei

标签页解除跨app显示限制

parent f7499c0b
...@@ -73,6 +73,14 @@ export default { ...@@ -73,6 +73,14 @@ export default {
}, },
methods: { methods: {
toPage(data, basePath) { toPage(data, basePath) {
let list = []
Object.keys(this.$store.state.tagsView.visitedViews).forEach(key => {
list = [...list, ...this.$store.state.tagsView.visitedViews[key]]
})
if (list.length >= 15) {
this.$message.warning('超过最大标签数,添加新的标签页需要关闭已经打开标签页!')
return
}
if (data.menuSource === '1') { if (data.menuSource === '1') {
const page = { const page = {
path: `/iframePage/${encodeURIComponent(data.menuUrl)}`, path: `/iframePage/${encodeURIComponent(data.menuUrl)}`,
......
...@@ -218,7 +218,11 @@ export default { ...@@ -218,7 +218,11 @@ export default {
this.visitedViews = [] this.visitedViews = []
} else { } else {
// this.$set(this, 'visitedViews', this.$store.state.tagsView.visitedViews[this.activeModel.id].filter(x => (x.path !== '/dee-task-center/workflow/task-center/home'))) // this.$set(this, 'visitedViews', this.$store.state.tagsView.visitedViews[this.activeModel.id].filter(x => (x.path !== '/dee-task-center/workflow/task-center/home')))
this.$set(this, 'visitedViews', this.$store.state.tagsView.visitedViews[this.activeModel.id].filter(x => (x.path !== '/home'))) let list = []
Object.keys(this.$store.state.tagsView.visitedViews).forEach(key => {
list = [...list, ...this.$store.state.tagsView.visitedViews[key]]
})
this.$set(this, 'visitedViews', list.filter(x => (x.path !== '/home')))
} }
}, 0) }, 0)
}, },
......
const state = { const state = {
visitedViews: sessionStorage.getItem('visitedViews') ? JSON.parse(sessionStorage.getItem('visitedViews')) : {}, visitedViews: sessionStorage.getItem('visitedViews') ? JSON.parse(sessionStorage.getItem('visitedViews')) : {},
cachedViews: [], cachedViews: [],
...@@ -34,9 +35,9 @@ const mutations = { ...@@ -34,9 +35,9 @@ const mutations = {
}) })
) )
} }
if (state.visitedViews[belongModel].length > 10) { /* if (state.visitedViews[belongModel].length > 10) {
state.visitedViews[belongModel].shift() state.visitedViews[belongModel].shift()
} }*/
sessionStorage.setItem('visitedViews', JSON.stringify(state.visitedViews)) sessionStorage.setItem('visitedViews', JSON.stringify(state.visitedViews))
}, },
ADD_CACHED_VIEW: (state, view) => { ADD_CACHED_VIEW: (state, view) => {
...@@ -47,7 +48,8 @@ const mutations = { ...@@ -47,7 +48,8 @@ const mutations = {
}, },
DEL_VISITED_VIEW: (state, view) => { DEL_VISITED_VIEW: (state, view) => {
const belongModel = sessionStorage.getItem('activePageModel') ? JSON.parse(sessionStorage.getItem('activePageModel')).id : 'todoTask' // const belongModel = sessionStorage.getItem('activePageModel') ? JSON.parse(sessionStorage.getItem('activePageModel')).id : 'todoTask'
const belongModel = view.belongModel
if (!state.visitedViews[belongModel]) { if (!state.visitedViews[belongModel]) {
state.visitedViews[belongModel] = [] state.visitedViews[belongModel] = []
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment