diff --git a/data/magic-api/api/后台/安全/登录.ms b/data/magic-api/api/后台/安全/登录.ms index 0ccce94..cda5a77 100644 --- a/data/magic-api/api/后台/安全/登录.ms +++ b/data/magic-api/api/后台/安全/登录.ms @@ -5,7 +5,7 @@ "groupId" : "1952f25c81084e24b55b11385767dc38", "name" : "登录", "createTime" : null, - "updateTime" : 1641276726183, + "updateTime" : 1642080684959, "lock" : "0", "method" : "POST", "path" : "/login", @@ -17,7 +17,7 @@ "responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": \"565504aa-ecfa-4c0d-a22f-d35732672708\",\n \"timestamp\": 1641276642379,\n \"executeTime\": 13\n}", "description" : null, "requestBodyDefinition" : { - "name" : "", + "name" : "root", "value" : "", "description" : "", "required" : false, diff --git a/data/magic-api/api/后台/用户管理/所有机构.ms b/data/magic-api/api/后台/用户管理/所有机构.ms new file mode 100644 index 0000000..8f5c3d6 --- /dev/null +++ b/data/magic-api/api/后台/用户管理/所有机构.ms @@ -0,0 +1,246 @@ +{ + "properties" : { }, + "id" : "55ddadf56dfe433baae1b5c26580cf00", + "script" : null, + "groupId" : "4f0230049d7e4f39b1e0897cc0f46f9a", + "name" : "所有机构", + "createTime" : null, + "updateTime" : 1642085289368, + "lock" : "0", + "method" : "GET", + "path" : "/offices", + "parameters" : [ ], + "option" : "[]", + "requestBody" : "", + "headers" : [ ], + "paths" : [ ], + "responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": {\n \"list\": [{\n \"id\": \"4c37a80226134bce8bc91c8fc04a7d2f\",\n \"label\": \"马小东公司\",\n \"pid\": \"0\",\n \"children\": [{\n \"id\": \"81b5493cdb31477f9ceea85b2cd08f15\",\n \"label\": \"马小东子公司\",\n \"pid\": \"4c37a80226134bce8bc91c8fc04a7d2f\",\n \"children\": null\n }, {\n \"id\": \"31b365008f994e93850186126fce87cb\",\n \"label\": \"马小东子公司2\",\n \"pid\": \"4c37a80226134bce8bc91c8fc04a7d2f\",\n \"children\": null\n }]\n }, {\n \"id\": \"935126327e2a4f90b3f485f818f61ea5\",\n \"label\": \"吕金泽公司\",\n \"pid\": \"0\",\n \"children\": [{\n \"id\": \"1ae0299fc79b43c6b0ae2e14756ec41a\",\n \"label\": \"吕金泽子公司\",\n \"pid\": \"935126327e2a4f90b3f485f818f61ea5\",\n \"children\": null\n }]\n }],\n \"total\": 2\n },\n \"timestamp\": 1642085263335,\n \"executeTime\": 52\n}", + "description" : null, + "requestBodyDefinition" : null, + "responseBodyDefinition" : { + "name" : "", + "value" : "", + "description" : "", + "required" : false, + "dataType" : "Object", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ { + "name" : "code", + "value" : "200", + "description" : "", + "required" : false, + "dataType" : "Integer", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + }, { + "name" : "message", + "value" : "success", + "description" : "", + "required" : false, + "dataType" : "String", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + }, { + "name" : "data", + "value" : "", + "description" : "", + "required" : false, + "dataType" : "Object", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ { + "name" : "list", + "value" : "", + "description" : "", + "required" : false, + "dataType" : "Array", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ { + "name" : "", + "value" : "", + "description" : "", + "required" : false, + "dataType" : "Object", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ { + "name" : "id", + "value" : "4c37a80226134bce8bc91c8fc04a7d2f", + "description" : "", + "required" : false, + "dataType" : "String", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + }, { + "name" : "label", + "value" : "马小东公司", + "description" : "", + "required" : false, + "dataType" : "String", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + }, { + "name" : "pid", + "value" : "0", + "description" : "", + "required" : false, + "dataType" : "String", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + }, { + "name" : "children", + "value" : "", + "description" : "", + "required" : false, + "dataType" : "Array", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ { + "name" : "", + "value" : "", + "description" : "", + "required" : false, + "dataType" : "Object", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ { + "name" : "id", + "value" : "81b5493cdb31477f9ceea85b2cd08f15", + "description" : "", + "required" : false, + "dataType" : "String", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + }, { + "name" : "label", + "value" : "马小东子公司", + "description" : "", + "required" : false, + "dataType" : "String", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + }, { + "name" : "pid", + "value" : "4c37a80226134bce8bc91c8fc04a7d2f", + "description" : "", + "required" : false, + "dataType" : "String", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + }, { + "name" : "children", + "value" : "null", + "description" : "", + "required" : false, + "dataType" : "Object", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + } ] + } ] + } ] + } ] + }, { + "name" : "total", + "value" : "2", + "description" : "", + "required" : false, + "dataType" : "Integer", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + } ] + }, { + "name" : "timestamp", + "value" : "1642085263335", + "description" : "", + "required" : false, + "dataType" : "Long", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + }, { + "name" : "executeTime", + "value" : "52", + "description" : "", + "required" : false, + "dataType" : "Integer", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + } ] + }, + "optionMap" : { } +} +================================ +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 label,pid from sys_office where is_del = 0 order by sort'),'0') + +return { + list: list, + total: list.getLength() +} \ No newline at end of file diff --git a/data/magic-api/api/后台/组织机构/根据角色获取组织机构.ms b/data/magic-api/api/后台/组织机构/根据角色获取组织机构.ms new file mode 100644 index 0000000..7d4ea1b --- /dev/null +++ b/data/magic-api/api/后台/组织机构/根据角色获取组织机构.ms @@ -0,0 +1,98 @@ +{ + "properties" : { }, + "id" : "dd6fd96602cb4905b5c2d79f584ab0a0", + "script" : null, + "groupId" : "8295fc13678d4144bf7363c465247a50", + "name" : "根据角色获取组织机构", + "createTime" : null, + "updateTime" : 1642080922495, + "lock" : "0", + "method" : "GET", + "path" : "/by/role", + "parameters" : [ ], + "option" : "[]", + "requestBody" : "", + "headers" : [ ], + "paths" : [ ], + "responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": [],\n \"timestamp\": 1642080916671,\n \"executeTime\": 90\n}", + "description" : null, + "requestBodyDefinition" : null, + "responseBodyDefinition" : { + "name" : "", + "value" : "", + "description" : "", + "required" : false, + "dataType" : "Object", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ { + "name" : "code", + "value" : "200", + "description" : "", + "required" : false, + "dataType" : "Integer", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + }, { + "name" : "message", + "value" : "success", + "description" : "", + "required" : false, + "dataType" : "String", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + }, { + "name" : "data", + "value" : "", + "description" : "", + "required" : false, + "dataType" : "Array", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + }, { + "name" : "timestamp", + "value" : "1642080916671", + "description" : "", + "required" : false, + "dataType" : "Long", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + }, { + "name" : "executeTime", + "value" : "90", + "description" : "", + "required" : false, + "dataType" : "Object", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + } ] + }, + "optionMap" : { } +} +================================ +return db.select(""" + select office_id id from sys_role_office where role_id = #{roleId} +""").map(it => it.id) \ No newline at end of file diff --git a/data/magic-api/api/后台/菜单管理/根据角色获取菜单.ms b/data/magic-api/api/后台/菜单管理/根据角色获取菜单.ms index d612614..19567a4 100644 --- a/data/magic-api/api/后台/菜单管理/根据角色获取菜单.ms +++ b/data/magic-api/api/后台/菜单管理/根据角色获取菜单.ms @@ -4,8 +4,8 @@ "script" : null, "groupId" : "67b2ce258e24491194b74992958c74aa", "name" : "根据角色获取菜单", - "createTime" : 1634724871165, - "updateTime" : 1634724871165, + "createTime" : null, + "updateTime" : 1642080927004, "lock" : "0", "method" : "GET", "path" : "/by/role", @@ -26,7 +26,7 @@ "requestBody" : "", "headers" : [ ], "paths" : [ ], - "responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": [],\n \"timestamp\": 1634310952202,\n \"executeTime\": 9\n}", + "responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": [\"b1851d1b13594e71840103c11a37a669\", \"39be13ef6f0745568c80bf35202ddb2b\", \"414e5d31-fe05-4e69-9983-217c10b9740a\", \"d7e5280a2a8f4fb3b9e2f4a3e3093a38\", \"833b204d5f2c402190bfca677421cfeb\"],\n \"timestamp\": 1642080903333,\n \"executeTime\": 4\n}", "description" : null, "requestBodyDefinition" : null, "responseBodyDefinition" : { @@ -75,10 +75,22 @@ "validateType" : "", "error" : "", "expression" : "", - "children" : [ ] + "children" : [ { + "name" : "", + "value" : "b1851d1b13594e71840103c11a37a669", + "description" : "", + "required" : false, + "dataType" : "Object", + "type" : null, + "defaultValue" : null, + "validateType" : "", + "error" : "", + "expression" : "", + "children" : [ ] + } ] }, { "name" : "timestamp", - "value" : "1634310952202", + "value" : "1642080903333", "description" : "", "required" : false, "dataType" : "Long", @@ -90,10 +102,10 @@ "children" : [ ] }, { "name" : "executeTime", - "value" : "9", + "value" : "4", "description" : "", "required" : false, - "dataType" : "Integer", + "dataType" : "Object", "type" : null, "defaultValue" : null, "validateType" : "", @@ -106,5 +118,5 @@ } ================================ return db.select(""" - select sm.id,sm.name from sys_menu sm join sys_role_menu srm on sm.id = srm.menu_id and srm.role_id = #{roleId} where sm.is_del = 0 -""") \ No newline at end of file + select menu_id id from sys_role_menu where role_id = #{roleId} +""").map(it => it.id) \ No newline at end of file diff --git a/data/magic-api/api/后台/角色管理/保存.ms b/data/magic-api/api/后台/角色管理/保存.ms index 1696f53..cddf06e 100644 --- a/data/magic-api/api/后台/角色管理/保存.ms +++ b/data/magic-api/api/后台/角色管理/保存.ms @@ -5,7 +5,7 @@ "groupId" : "89130d496f6f467c88b22ae4a7f688eb", "name" : "保存", "createTime" : null, - "updateTime" : 1641215973180, + "updateTime" : 1642081039231, "lock" : "0", "method" : "POST", "path" : "/save", @@ -26,6 +26,9 @@ import '@get:/role/cache/delete' as cacheDelete var role = { + code, + permission, + descRibe, type, name, sort, @@ -39,4 +42,11 @@ if(id){ id = db.table("sys_role").primary("id").saveOrUpdate(role); for(menuId in menus.split(',')){ db.table("sys_role_menu").column("menu_id",menuId).column("role_id", id).insert(); -} \ No newline at end of file +} +if(offices && permission == 1){ + for(officeId in offices.split(',')){ + db.table("sys_role_office").column("office_id",officeId).column("role_id", id).insert(); + } +}else{ + db.table("sys_role_office").where().eq("role_id",id).delete() +} diff --git a/data/magic-api/api/后台/角色管理/列表.ms b/data/magic-api/api/后台/角色管理/列表.ms index 8be8a44..6a279b0 100644 --- a/data/magic-api/api/后台/角色管理/列表.ms +++ b/data/magic-api/api/后台/角色管理/列表.ms @@ -4,8 +4,8 @@ "script" : null, "groupId" : "89130d496f6f467c88b22ae4a7f688eb", "name" : "列表", - "createTime" : 1634724871177, - "updateTime" : 1634724871177, + "createTime" : null, + "updateTime" : 1642061119644, "lock" : "0", "method" : "GET", "path" : "/list", @@ -156,6 +156,6 @@ } ================================ return db.page(""" - select id, name from sys_role where is_del = 0 + select id, name, code, permission, desc_ribe from sys_role where is_del = 0 ?{name, and name like concat('%',#{name},'%')} """) \ No newline at end of file diff --git a/magic-boot-ui/src/api/menu.js b/magic-boot-ui/src/api/menu.js index 75b1ea4..2022acd 100644 --- a/magic-boot-ui/src/api/menu.js +++ b/magic-boot-ui/src/api/menu.js @@ -7,16 +7,6 @@ export function getMenuTree() { }) } -export function getMenusByRoleId(roleId) { - return request({ - url: 'menu/by/role', - method: 'get', - params: { - roleId - } - }) -} - export function getCurrentUserMenu() { return request({ url: 'menu/current/menus', diff --git a/magic-boot-ui/src/components/Psyduck/pd-tree.vue b/magic-boot-ui/src/components/Psyduck/pd-tree.vue new file mode 100644 index 0000000..79618f4 --- /dev/null +++ b/magic-boot-ui/src/components/Psyduck/pd-tree.vue @@ -0,0 +1,120 @@ + + + + diff --git a/magic-boot-ui/src/layout/components/Sidebar/index.vue b/magic-boot-ui/src/layout/components/Sidebar/index.vue index 450a275..86e19d0 100644 --- a/magic-boot-ui/src/layout/components/Sidebar/index.vue +++ b/magic-boot-ui/src/layout/components/Sidebar/index.vue @@ -7,7 +7,7 @@ - + { this.menuTree = res.data.list - this.deleteEmptyChildren(this.menuTree) + this.$treeTable.deleteEmptyChildren(this.menuTree) }) }, methods: { - deleteEmptyChildren(children) { - for(var i in children){ - var chi = children[i] - if(chi.children && chi.children.length == 0){ - delete chi.children - }else{ - this.deleteEmptyChildren(chi.children) - } - } - }, selectMenu(node) { if(node.url){ this.$router.push({ path: node.url }) diff --git a/magic-boot-ui/src/styles/common.css b/magic-boot-ui/src/styles/common.css index 8fd8c6a..8b12543 100644 --- a/magic-boot-ui/src/styles/common.css +++ b/magic-boot-ui/src/styles/common.css @@ -7,4 +7,7 @@ body { border: none; height: 1px; background: #F3F3F3; -} \ No newline at end of file +} +.toolbar-container{ + margin-bottom: 10px +} diff --git a/magic-boot-ui/src/views/system/menu/menu-list.vue b/magic-boot-ui/src/views/system/menu/menu-list.vue index 15e5bea..ec6e74e 100644 --- a/magic-boot-ui/src/views/system/menu/menu-list.vue +++ b/magic-boot-ui/src/views/system/menu/menu-list.vue @@ -209,9 +209,7 @@ export default { expand(){ this.refreshTable = false this.tableOptions.el["default-expand-all"] = !this.tableOptions.el["default-expand-all"] - this.$nextTick(() => { - this.refreshTable = true - }) + this.$nextTick(() => this.refreshTable = true) }, searchMenu() { var _this = this diff --git a/magic-boot-ui/src/views/system/role/role-assign-permissions.vue b/magic-boot-ui/src/views/system/role/role-assign-permissions.vue new file mode 100644 index 0000000..14b9fde --- /dev/null +++ b/magic-boot-ui/src/views/system/role/role-assign-permissions.vue @@ -0,0 +1,42 @@ + + + diff --git a/magic-boot-ui/src/views/system/role/role-list.vue b/magic-boot-ui/src/views/system/role/role-list.vue index 83d837b..dd3ff12 100644 --- a/magic-boot-ui/src/views/system/role/role-list.vue +++ b/magic-boot-ui/src/views/system/role/role-list.vue @@ -8,55 +8,94 @@ 搜索 - - 添加 + + 清空 + + + 添加 + + + + + + +