diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue index a029a89..0cad402 100644 --- a/src/views/system/menu/index.vue +++ b/src/views/system/menu/index.vue @@ -13,7 +13,7 @@ {{ node.label }} - + @@ -68,13 +68,13 @@ //加载树数据 async getMenu(){ this.menuloading = true - var res = await this.$api.system.index.get(); + var res = await this.$http.get('system/menu'); this.menuloading = false - this.menuList = res.data.menu; + this.menuList = res.data; }, //树点击 menuClick(data, node){ - var pid = node.level==1?undefined:node.parent.data.id; + var pid = node.level==1 ? undefined : node.parent.data.id; this.$refs.save.setData(data, pid) this.$refs.main.$el.scrollTop = 0 }, @@ -93,8 +93,8 @@ async add(node, data){ var newMenuName = "未命名" + newMenuIndex++; var newMenuData = { - parentId: data ? data.id : "", - name: newMenuName, + parentid: data ? data.id : 0, + name: "", path: "", component: "", meta:{ @@ -103,13 +103,19 @@ } } this.menuloading = true - var res = await this.$api.demo.post.post(newMenuData) + var res = await this.$http.post('system/menu/submit',newMenuData) this.menuloading = false - newMenuData.id = res.data + if(res.code !== 200){ + this.$message.warning(res.message); + return false; + } + + + newMenuData.id = res.data this.$refs.menu.append(newMenuData, node) this.$refs.menu.setCurrentKey(newMenuData.id) - var pid = node ? node.data.id : "" + var pid = node ? node.data.id : 0 this.$refs.save.setData(newMenuData, pid) }, //删除菜单 @@ -133,7 +139,7 @@ var reqData = { ids: CheckedNodes.map(item => item.id) } - var res = await this.$api.demo.post.post(reqData) + var res = await this.$http.post('system/menu/delete',reqData) this.menuloading = false if(res.code == 200){ diff --git a/src/views/system/menu/save.vue b/src/views/system/menu/save.vue index 4983060..f8c84a9 100644 --- a/src/views/system/menu/save.vue +++ b/src/views/system/menu/save.vue @@ -10,8 +10,8 @@ - - + + @@ -29,13 +29,13 @@ - + - + - - + +
子节点或详情页需要高亮的上级菜单路由地址
@@ -67,7 +67,7 @@

接口权限

- +