菜单优化

This commit is contained in:
吕金泽
2022-01-07 01:08:42 +08:00
parent bbb1c5ccc7
commit 02cd4e7986
8 changed files with 162 additions and 82 deletions
@@ -4,11 +4,11 @@
"script" : null,
"groupId" : "67b2ce258e24491194b74992958c74aa",
"name" : "修改是否显示",
"createTime" : 1634724871168,
"updateTime" : 1634724871168,
"createTime" : null,
"updateTime" : 1641482987357,
"lock" : "0",
"method" : "GET",
"path" : "/change/show",
"path" : "/change",
"parameters" : [ ],
"option" : "[{\"name\":\"wrap_request_parameter\",\"value\":\"data\",\"description\":\"包装请求参数到一个变量中\"}]",
"requestBody" : "",
@@ -5,7 +5,7 @@
"groupId" : "67b2ce258e24491194b74992958c74aa",
"name" : "当前用户菜单",
"createTime" : null,
"updateTime" : 1641279378685,
"updateTime" : 1641482674575,
"lock" : "0",
"method" : "POST",
"path" : "/current/menus",
@@ -453,7 +453,8 @@ var menus = db.select("""
sm.is_show,
sm.url,
sm.sort,
sm.icon
sm.icon,
sm.keep_alive
from sys_menu sm where 1=1
?{userId != '1',
and sm.id in (
@@ -470,6 +471,7 @@ for(menu in menus){
menu.meta = {}
menu.meta.title = menu.name
menu.meta.icon = menu.icon
menu.meta.keepAlive = (menu.keepAlive == '1' ? true : false)
}
var nodes = menus.toMap(it => it.id)
nodes.each((key, node) => {
@@ -5,7 +5,7 @@
"groupId" : "67b2ce258e24491194b74992958c74aa",
"name" : "获取菜单tree",
"createTime" : null,
"updateTime" : 1641016870466,
"updateTime" : 1641483087321,
"lock" : "0",
"method" : "GET",
"path" : "/tree",
@@ -94,7 +94,7 @@
}
================================
var toTree = (list,pid) => select t.*,toTree(list,t.id) children from list t where t.pid = pid
var list = toTree(db.select('select id,name,pid,is_show,url,sort,permission,desc_ribe,icon from sys_menu where is_del = 0 order by sort'),'0')
var list = toTree(db.select('select id,name,pid,is_show,url,sort,permission,desc_ribe,icon,keep_alive from sys_menu where is_del = 0 order by sort'),'0')
return {
list: list,