diff --git a/src/components/maintainer/index.vue b/src/components/maintainer/index.vue index bf72bac..a32aa21 100644 --- a/src/components/maintainer/index.vue +++ b/src/components/maintainer/index.vue @@ -131,17 +131,12 @@ export default { }, methods: { getMenu() { - // let parentMenus = getStore({ name: 'parent_menus' }); - // let childMenus = getStore({ name: 'child_menus' }); - // if (parentMenus && childMenus && parentMenus.length > 0 && childMenus.length > 0) { - // this.parentMenus = parentMenus; - // this.childMenus = childMenus; - // } else { - store.dispatch('getMenu').then(res => { - this.parentMenus = res.parents; - this.childMenus = res.childs; - }); - // } + this.parentMenus = getStore({ name: 'parent_menus' }); + this.childMenus = getStore({ name: 'child_menus' }); + store.dispatch('getMenu').then(res => { + this.parentMenus = res.parents; + this.childMenus = res.childs; + }); }, getChilds(parentId) { return this.childMenus.filter(v => v.parentid == parentId); @@ -171,9 +166,7 @@ export default { parentIds.push(v.id); }); } - console.log(parentIds); this.parentMenus = store.getters.parentMenus.filter(v1 => parentIds.filter(v2 => v1.id == v2).length > 0); - this.childMenus = store.getters.childMenus.filter(v1 => parentIds.filter(v2 => v1.parentid == v2).length > 0); } } },