mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 20:39:48 +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: {
|
||||
redirect(item) {
|
||||
this.openItemMenu(item)
|
||||
|
||||
let tabParent
|
||||
if (item.meta && item.meta.type === 'window') {
|
||||
tabParent = 0
|
||||
@ -93,6 +95,34 @@ export default {
|
||||
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">
|
||||
<template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow">
|
||||
<app-link v-if="onlyOneChild.meta" :to="onlyOneChild">
|
||||
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">
|
||||
<item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="generateTitle(onlyOneChild.meta.title)" />
|
||||
<el-menu-item
|
||||
: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>
|
||||
</app-link>
|
||||
</template>
|
||||
@ -94,6 +102,36 @@ export default {
|
||||
|
||||
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) {
|
||||
if (isExternal(routePath)) {
|
||||
return routePath
|
||||
|
Loading…
x
Reference in New Issue
Block a user