mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-13 23:20:12 +08:00
Co-authored-by: EdwinBetanc0urt <EdwinBetanco0urt@outlook.com>
This commit is contained in:
parent
1b280259e5
commit
95bc92f962
@ -77,6 +77,8 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
redirect(item) {
|
redirect(item) {
|
||||||
|
this.openItemMenu(item)
|
||||||
|
|
||||||
let tabParent
|
let tabParent
|
||||||
if (item.meta && item.meta.type === 'window') {
|
if (item.meta && item.meta.type === 'window') {
|
||||||
tabParent = 0
|
tabParent = 0
|
||||||
@ -93,6 +95,34 @@ export default {
|
|||||||
childs: item.children
|
childs: item.children
|
||||||
}
|
}
|
||||||
}, () => {})
|
}, () => {})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Clear field values, and set default values with open
|
||||||
|
* @param view router item with meta attributes
|
||||||
|
*/
|
||||||
|
openItemMenu(view) {
|
||||||
|
if (view.meta && view.meta.uuid && view.meta.type) {
|
||||||
|
const {
|
||||||
|
parentUuid,
|
||||||
|
uuid: containerUuid,
|
||||||
|
type: panelType
|
||||||
|
} = view.meta
|
||||||
|
|
||||||
|
if (panelType !== 'window') {
|
||||||
|
this.$store.dispatch('setDefaultValues', {
|
||||||
|
parentUuid,
|
||||||
|
containerUuid,
|
||||||
|
panelType,
|
||||||
|
isNewRecord: false
|
||||||
|
})
|
||||||
|
|
||||||
|
if (['browser'].includes(panelType)) {
|
||||||
|
this.$store.dispatch('deleteRecordContainer', {
|
||||||
|
viewUuid: containerUuid
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,16 @@
|
|||||||
<div v-if="!item.hidden">
|
<div v-if="!item.hidden">
|
||||||
<template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow">
|
<template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow">
|
||||||
<app-link v-if="onlyOneChild.meta" :to="onlyOneChild">
|
<app-link v-if="onlyOneChild.meta" :to="onlyOneChild">
|
||||||
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">
|
<el-menu-item
|
||||||
<item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="generateTitle(onlyOneChild.meta.title)" />
|
:index="resolvePath(onlyOneChild.path)"
|
||||||
|
:route="item"
|
||||||
|
:class="{'submenu-title-noDropdown':!isNest}"
|
||||||
|
@click="openItemMenu"
|
||||||
|
>
|
||||||
|
<item
|
||||||
|
:icon="onlyOneChild.meta.icon || (item.meta && item.meta.icon)"
|
||||||
|
:title="generateTitle(onlyOneChild.meta.title)"
|
||||||
|
/>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</app-link>
|
</app-link>
|
||||||
</template>
|
</template>
|
||||||
@ -94,6 +102,36 @@ export default {
|
|||||||
|
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Clear field values, and set default values with open
|
||||||
|
* @param view router item with meta attributes
|
||||||
|
*/
|
||||||
|
openItemMenu(menuItem) {
|
||||||
|
const view = menuItem._props.route
|
||||||
|
|
||||||
|
if (view.meta && view.meta.uuid && view.meta.type) {
|
||||||
|
const {
|
||||||
|
parentUuid,
|
||||||
|
uuid: containerUuid,
|
||||||
|
type: panelType
|
||||||
|
} = view.meta
|
||||||
|
|
||||||
|
if (panelType !== 'window') {
|
||||||
|
this.$store.dispatch('setDefaultValues', {
|
||||||
|
parentUuid,
|
||||||
|
containerUuid,
|
||||||
|
panelType,
|
||||||
|
isNewRecord: false
|
||||||
|
})
|
||||||
|
|
||||||
|
if (['browser'].includes(panelType)) {
|
||||||
|
this.$store.dispatch('deleteRecordContainer', {
|
||||||
|
viewUuid: containerUuid
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
resolvePath(routePath) {
|
resolvePath(routePath) {
|
||||||
if (isExternal(routePath)) {
|
if (isExternal(routePath)) {
|
||||||
return routePath
|
return routePath
|
||||||
|
Loading…
x
Reference in New Issue
Block a user