Commit d5e0dd09 by zhangquan

新增产品页面出来不切换二级目录

1 parent a94153b2
...@@ -533,6 +533,8 @@ export default { ...@@ -533,6 +533,8 @@ export default {
this.isEditType = true this.isEditType = true
}, },
goListPage(){ goListPage(){
const { menuId , subMenuId } = this.formObj
window.localStorage.setItem('menuInfo', JSON.stringify({menuId , subMenuId}))
this.$router.push({path: '/discoverManager/index'}) this.$router.push({path: '/discoverManager/index'})
} }
} }
......
...@@ -122,7 +122,12 @@ ...@@ -122,7 +122,12 @@
} }
}, },
created(){ created(){
const menuInfo = window.localStorage.getItem('menuInfo') //判断是否是新增产品进来,不切换二级目录
if(menuInfo){
this.getMenuList('rename', JSON.parse(menuInfo))
}else{
this.getMenuList() this.getMenuList()
}
}, },
mounted() { mounted() {
document.addEventListener("click", this.eventListener); document.addEventListener("click", this.eventListener);
...@@ -134,15 +139,18 @@ ...@@ -134,15 +139,18 @@
eventListener(e){ eventListener(e){
if (!this.$refs?.menuOpRef?.[0]?.contains(e.target)) this.boxShow = false; if (!this.$refs?.menuOpRef?.[0]?.contains(e.target)) this.boxShow = false;
}, },
getMenuList(type) { getMenuList(type, menuInfo) {
this.$apis.discover.getMenuListApi({}).then(res => { this.$apis.discover.getMenuListApi({}).then(res => {
if(res?.length){ if(res?.length){
this.menuList = res this.menuList = res
let menuItem = res[0] let menuItem = res[0]
let subMenuItem = res[0]?.childList[0] || {} let subMenuItem = res[0]?.childList[0] || {}
if(type=='rename') { if(type=='rename') {
menuItem = res.find(item => item.id == this.curModuleInfo.menuId) let menuId = menuInfo ? menuInfo.menuId : this.curModuleInfo.menuId
subMenuItem = menuItem.find(item => item.id == this.curModuleInfo.subMenuId) let subMenuId = menuInfo ? menuInfo.subMenuId : this.curModuleInfo.subMenuId
menuItem = res.find(item => item.id == menuId)
subMenuItem = menuItem?.childList?.find(item => item.id == subMenuId)
window.localStorage.removeItem('menuInfo')
} }
this.slectedSubmenu(menuItem, subMenuItem) this.slectedSubmenu(menuItem, subMenuItem)
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!