|
|
|
@ -32,14 +32,12 @@ export default {
|
|
|
|
|
this.closeThat(val)
|
|
|
|
|
})
|
|
|
|
|
.$on('rename', ({ key, name }) => {
|
|
|
|
|
// console.log('rename', key, name)
|
|
|
|
|
try {
|
|
|
|
|
const item = this.pages.find(item => item.path === key)
|
|
|
|
|
item.meta.customTitle = name
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
} catch (e) {}
|
|
|
|
|
})
|
|
|
|
|
console.log('== 路由新增 ==', this.$route, this.$route.fullPath, this.fullPathList)
|
|
|
|
|
this.pages.push(this.$route)
|
|
|
|
|
this.fullPathList.push(this.$route.fullPath)
|
|
|
|
|
this.selectedLastPath()
|
|
|
|
@ -48,10 +46,8 @@ export default {
|
|
|
|
|
...mapActions(['setNeedSavePages']),
|
|
|
|
|
onEdit(targetKey, action) {
|
|
|
|
|
const _that = this
|
|
|
|
|
console.log('== 路由编辑 start ==', this.fullPathList, this.page)
|
|
|
|
|
if (targetKey.includes('BookingDetail')) {
|
|
|
|
|
if (Object.keys(this.needSavePages).includes(targetKey) && (this.needSavePages[targetKey].details || this.needSavePages[targetKey].hbList)) {
|
|
|
|
|
console.log('== 理由编辑 - 有未保存数据 biu 弹窗出现 ==', this.fullPathList, this.page)
|
|
|
|
|
this.$confirm({
|
|
|
|
|
title: '请确认无未保存数据!',
|
|
|
|
|
content: '当点击确定按钮时,此页面 将会关闭。',
|
|
|
|
@ -75,15 +71,12 @@ export default {
|
|
|
|
|
} else {
|
|
|
|
|
this[action](targetKey)
|
|
|
|
|
}
|
|
|
|
|
console.log(' === 路由编辑 end ==', this.fullPathList, this.page)
|
|
|
|
|
},
|
|
|
|
|
remove(targetKey) {
|
|
|
|
|
this.pages = this.pages.filter(page => page.fullPath !== targetKey)
|
|
|
|
|
this.fullPathList = this.fullPathList.filter(path => path !== targetKey)
|
|
|
|
|
console.log('== 关闭 ==', this.pages, this.fullPathList)
|
|
|
|
|
// 判断当前标签是否关闭,若关闭则跳转到最后一个还存在的标签页
|
|
|
|
|
if (!this.fullPathList.includes(this.activeKey)) {
|
|
|
|
|
console.log('=== 最后一个标签页 ===')
|
|
|
|
|
this.selectedLastPath()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
@ -93,7 +86,6 @@ export default {
|
|
|
|
|
|
|
|
|
|
// content menu
|
|
|
|
|
closeThat(e) {
|
|
|
|
|
console.log('=== 测试点4 ===', this.fullPathList)
|
|
|
|
|
// 判断是否为最后一个标签页,如果是最后一个,则无法被关闭
|
|
|
|
|
if (this.fullPathList.length > 1) {
|
|
|
|
|
this.remove(e)
|
|
|
|
@ -102,7 +94,6 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
closeLeft(e) {
|
|
|
|
|
console.log('=== 测试点1 ===', this.fullPathList)
|
|
|
|
|
const currentIndex = this.fullPathList.indexOf(e)
|
|
|
|
|
if (currentIndex > 0) {
|
|
|
|
|
this.fullPathList.forEach((item, index) => {
|
|
|
|
@ -115,7 +106,6 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
closeRight(e) {
|
|
|
|
|
console.log('=== 测试点2 ===')
|
|
|
|
|
const currentIndex = this.fullPathList.indexOf(e)
|
|
|
|
|
if (currentIndex < this.fullPathList.length - 1) {
|
|
|
|
|
this.fullPathList.forEach((item, index) => {
|
|
|
|
@ -128,7 +118,6 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
closeAll(e) {
|
|
|
|
|
console.log('=== 测试点3 ===')
|
|
|
|
|
const currentIndex = this.fullPathList.indexOf(e)
|
|
|
|
|
this.fullPathList.forEach((item, index) => {
|
|
|
|
|
if (index !== currentIndex) {
|
|
|
|
@ -159,7 +148,6 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
// render
|
|
|
|
|
renderTabPane(title, keyPath) {
|
|
|
|
|
// console.log(title, keyPath)
|
|
|
|
|
let name = title
|
|
|
|
|
let data = Object.fromEntries(new URLSearchParams(keyPath.split('?')[1]))
|
|
|
|
|
const menu = this.renderTabPaneMenu(keyPath)
|
|
|
|
@ -201,7 +189,6 @@ export default {
|
|
|
|
|
this.fullPathList = this.pages.map((item, index) => {
|
|
|
|
|
return item.fullPath
|
|
|
|
|
})
|
|
|
|
|
console.log('=== 路由切换 === - pages: ', this.pages, ', fullPathList: ', this.fullPathList)
|
|
|
|
|
},
|
|
|
|
|
activeKey: function(newPathKey) {
|
|
|
|
|
this.$router.push({ path: newPathKey })
|
|
|
|
|