From 0b98e5391922c1b260a8295507dac70d6c71c8a1 Mon Sep 17 00:00:00 2001 From: "jinlan.du" Date: Tue, 14 Apr 2020 13:31:01 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E6=96=AD=E7=82=B9=E7=BB=AD=E4=BC=A0UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/example/breakpoint/breakpoint.vue | 123 ++++++++++++++++-- 1 file changed, 112 insertions(+), 11 deletions(-) diff --git a/web/src/view/example/breakpoint/breakpoint.vue b/web/src/view/example/breakpoint/breakpoint.vue index eae20342..0a2ea941 100644 --- a/web/src/view/example/breakpoint/breakpoint.vue +++ b/web/src/view/example/breakpoint/breakpoint.vue @@ -1,17 +1,31 @@ - +#fromCont{ + display: inline-block; +} +.fileUpload{ + padding: 4px 10px; + height: 20px; + line-height: 20px; + position: relative; + cursor: pointer; + color: #000; + border: 1px solid #c1c1c1; + border-radius: 4px; + overflow: hidden; + display: inline-block; + input{ + position: absolute; + font-size: 100px; + right: 0; + top: 0; + opacity: 0; + cursor: pointer; + } + +} + .fileName{ + display: inline-block; + vertical-align: top; + margin: 6px 15px 0 15px; + } + .uploadBtn{ + position: relative; + top: -10px; + margin-left: 15px; + } + .tips{ + margin-top: 30px; + font-size: 14px; + font-weight: 400; + color: #606266; + } + .el-divider{ + margin: 0 0 30px 0; + } + + .list{ + margin-top:15px; + } + .list-item { + display: block; + margin-right: 10px; + color: #606266; + line-height: 25px; + margin-bottom: 5px; + width: 40%; + .percentage{ + float: right; + } +} +.list-enter-active, .list-leave-active { + transition: all 1s; +} +.list-enter, .list-leave-to +/* .list-leave-active for below version 2.1.8 */ { + opacity: 0; + transform: translateY(-30px); +} + \ No newline at end of file From 46fa8e1a19366cd6a664a16ccd04a6f06fbe3af7 Mon Sep 17 00:00:00 2001 From: pixel <303176530@qq.com> Date: Wed, 15 Apr 2020 16:37:17 +0800 Subject: [PATCH 2/7] =?UTF-8?q?menu=E5=92=8Cauthority=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=88=B6=E7=BA=A7=E5=8F=98=E4=B8=BA=E9=80=89=E6=8B=A9=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/api/v1/sys_authority.go | 19 +++++++++++++ server/api/v1/sys_menu.go | 1 - server/db/qmplus.sql | 48 +++++++++------------------------ server/router/sys_authority.go | 1 + server/service/sys_authority.go | 12 +++++++++ server/service/sys_base_menu.go | 2 +- server/service/sys_menu.go | 4 +-- 7 files changed, 48 insertions(+), 39 deletions(-) diff --git a/server/api/v1/sys_authority.go b/server/api/v1/sys_authority.go index f96519f0..7ce4a2fa 100644 --- a/server/api/v1/sys_authority.go +++ b/server/api/v1/sys_authority.go @@ -49,6 +49,25 @@ func DeleteAuthority(c *gin.Context) { } } +// @Tags authority +// @Summary 设置角色资源权限 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body model.SysAuthority true "设置角色资源权限" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"设置成功"}" +// @Router /authority/updateAuthority [post] +func UpdateAuthority(c *gin.Context) { + var auth model.SysAuthority + _ = c.ShouldBindJSON(&auth) + err, authority := service.UpdateAuthority(auth) + if err != nil { + response.FailWithMessage(fmt.Sprintf("更新失败,%v", err), c) + } else { + response.OkWithData(resp.SysAuthorityResponse{authority}, c) + } +} + // @Tags authority // @Summary 分页获取角色列表 // @Security ApiKeyAuth diff --git a/server/api/v1/sys_menu.go b/server/api/v1/sys_menu.go index 1ce42523..bd421e18 100644 --- a/server/api/v1/sys_menu.go +++ b/server/api/v1/sys_menu.go @@ -84,7 +84,6 @@ func GetBaseMenuTree(c *gin.Context) { response.FailWithMessage(fmt.Sprintf("获取失败,%v", err), c) } else { response.OkWithData(resp.SysBaseMenusResponse{Menus: menus}, c) - } } diff --git a/server/db/qmplus.sql b/server/db/qmplus.sql index 85ed7bd4..2d1a94b9 100644 --- a/server/db/qmplus.sql +++ b/server/db/qmplus.sql @@ -11,7 +11,7 @@ Target Server Version : 50644 File Encoding : 65001 - Date: 13/04/2020 09:48:03 + Date: 15/04/2020 13:12:44 */ SET NAMES utf8mb4; @@ -125,6 +125,7 @@ INSERT INTO `casbin_rule` VALUES ('p', '888', '/authority/createAuthority', 'POS INSERT INTO `casbin_rule` VALUES ('p', '888', '/authority/deleteAuthority', 'POST', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '888', '/authority/getAuthorityList', 'POST', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '888', '/authority/setDataAuthority', 'POST', '', '', ''); +INSERT INTO `casbin_rule` VALUES ('p', '888', '/authority/updateAuthority', 'PUT', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/getMenu', 'POST', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/getMenuList', 'POST', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/addBaseMenu', 'POST', '', '', ''); @@ -154,28 +155,6 @@ INSERT INTO `casbin_rule` VALUES ('p', '888', '/customer/customer', 'DELETE', '' INSERT INTO `casbin_rule` VALUES ('p', '888', '/customer/customer', 'GET', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '888', '/customer/customerList', 'GET', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '888', '/autoCode/createTemp', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/base/login', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/base/register', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/api/createApi', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/api/getApiList', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/api/getApiById', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/api/deleteApi', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/api/updateApi', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/api/getAllApis', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/api/createApi', 'GET', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/authority/createAuthority', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/authority/deleteAuthority', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/authority/getAuthorityList', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/authority/setDataAuthority', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/menu/getMenu', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/menu/getMenuList', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/menu/addBaseMenu', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/menu/getBaseMenuTree', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/menu/addMenuAuthority', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/menu/getMenuAuthority', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/menu/deleteBaseMenu', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/menu/updateBaseMenu', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/menu/getBaseMenuById', 'POST', '', '', ''); -- ---------------------------- -- Table structure for ch_cities @@ -3835,7 +3814,7 @@ CREATE TABLE `exa_file_chunks` ( `file_chunk_number` int(11) NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE, INDEX `idx_exa_file_chunks_deleted_at`(`deleted_at`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; +) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; -- ---------------------------- -- Table structure for exa_file_upload_and_downloads @@ -3855,15 +3834,6 @@ CREATE TABLE `exa_file_upload_and_downloads` ( INDEX `idx_exa_file_upload_and_downloads_deleted_at`(`deleted_at`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; --- ---------------------------- --- Records of exa_file_upload_and_downloads --- ---------------------------- -INSERT INTO `exa_file_upload_and_downloads` VALUES (7, '2019-10-26 22:46:32', '2019-10-26 22:46:32', NULL, 'logo.png', 'http://qmplusimg.henrongyi.top/1572101191logo.png', 'png', '1572101191logo.png'); -INSERT INTO `exa_file_upload_and_downloads` VALUES (10, '2019-10-26 23:10:44', '2019-10-26 23:10:44', NULL, 'logo.png', 'http://qmplusimg.henrongyi.top/1572102643logo.png', 'png', '1572102643logo.png'); -INSERT INTO `exa_file_upload_and_downloads` VALUES (12, '2019-10-26 23:14:08', '2019-10-26 23:14:08', NULL, 'logo.png', 'http://qmplusimg.henrongyi.top/1572102846logo.png', 'png', '1572102846logo.png'); -INSERT INTO `exa_file_upload_and_downloads` VALUES (13, '2019-10-26 23:18:17', '2019-10-26 23:18:17', NULL, 'logo.png', 'http://qmplusimg.henrongyi.top/1572103096logo.png', 'png', '1572103096logo.png'); -INSERT INTO `exa_file_upload_and_downloads` VALUES (15, '2019-12-15 14:31:00', '2019-12-15 14:31:00', NULL, 'logo.png', 'http://qmplusimg.henrongyi.top/1576391451logo.png', 'png', '1576391451logo.png'); - -- ---------------------------- -- Table structure for exa_files -- ---------------------------- @@ -3880,7 +3850,14 @@ CREATE TABLE `exa_files` ( `is_finish` tinyint(1) NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE, INDEX `idx_exa_files_deleted_at`(`deleted_at`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; +) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; + +-- ---------------------------- +-- Records of exa_files +-- ---------------------------- +INSERT INTO `exa_files` VALUES (1, '2020-04-14 15:52:18', '2020-04-14 15:52:18', NULL, 'logo.png', '7022fdcb1562ff79cc36ce0644b86b8a', '', 1, 0); +INSERT INTO `exa_files` VALUES (2, '2020-04-14 15:53:00', '2020-04-14 15:53:00', NULL, 'index.html', '139ac05423499b520cbf402ceb663b6f', '', 1, 0); +INSERT INTO `exa_files` VALUES (3, '2020-04-14 16:07:43', '2020-04-14 16:07:43', NULL, 'favicon.ico', '7d34c388d92837200de70d3a90b49d3b', '', 1, 0); -- ---------------------------- -- Table structure for jwt_blacklists @@ -3953,7 +3930,7 @@ CREATE TABLE `sys_apis` ( PRIMARY KEY (`id`) USING BTREE, INDEX `idx_apis_deleted_at`(`deleted_at`) USING BTREE, INDEX `idx_sys_apis_deleted_at`(`deleted_at`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 46 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; +) ENGINE = InnoDB AUTO_INCREMENT = 47 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; -- ---------------------------- -- Records of sys_apis @@ -3999,6 +3976,7 @@ INSERT INTO `sys_apis` VALUES (42, '2020-02-25 15:36:48', '2020-02-25 15:37:16', INSERT INTO `sys_apis` VALUES (43, '2020-02-25 15:37:06', '2020-02-25 15:37:06', NULL, NULL, '/customer/customerList', '获取客户列表', 'customer', 'GET'); INSERT INTO `sys_apis` VALUES (44, '2020-03-12 14:36:54', '2020-03-12 14:56:50', NULL, NULL, '/casbin/casbinTest/:pathParam', 'RESTFUL模式测试', 'casbin', 'GET'); INSERT INTO `sys_apis` VALUES (45, '2020-03-29 23:01:28', '2020-03-29 23:01:28', NULL, NULL, '/autoCode/createTemp', '自动化代码', 'autoCode', 'POST'); +INSERT INTO `sys_apis` VALUES (46, '2020-04-15 12:46:58', '2020-04-15 12:46:58', NULL, NULL, '/authority/updateAuthority', '更新角色信息', 'authority', 'PUT'); -- ---------------------------- -- Table structure for sys_authorities diff --git a/server/router/sys_authority.go b/server/router/sys_authority.go index f93b794c..933f10e9 100644 --- a/server/router/sys_authority.go +++ b/server/router/sys_authority.go @@ -11,6 +11,7 @@ func InitAuthorityRouter(Router *gin.RouterGroup) { { AuthorityRouter.POST("createAuthority", v1.CreateAuthority) //创建角色 AuthorityRouter.POST("deleteAuthority", v1.DeleteAuthority) //删除角色 + AuthorityRouter.PUT("updateAuthority", v1.UpdateAuthority) //更新角色 AuthorityRouter.POST("getAuthorityList", v1.GetAuthorityList) //获取角色列表 AuthorityRouter.POST("setDataAuthority", v1.SetDataAuthority) //设置角色资源权限 } diff --git a/server/service/sys_authority.go b/server/service/sys_authority.go index 29b586d7..fc4de8a8 100644 --- a/server/service/sys_authority.go +++ b/server/service/sys_authority.go @@ -19,6 +19,18 @@ func CreateAuthority(auth model.SysAuthority) (err error, authority model.SysAut return err, auth } +// @title UpdateAuthority +// @description 更改一个角色 +// @auth (2020/04/05 20:22) +// @param auth model.SysAuthority +// @return error +// @return authority model.SysAuthority + +func UpdateAuthority(auth model.SysAuthority) (err error, authority model.SysAuthority) { + err = global.GVA_DB.Where("authority_id = ?", auth.AuthorityId).First(&model.SysAuthority{}).Updates(&auth).Error + return err, auth +} + // @title DeleteAuthority // @description 删除角色 // @auth (2020/04/05 20:22) diff --git a/server/service/sys_base_menu.go b/server/service/sys_base_menu.go index 453f851f..5de46cb5 100644 --- a/server/service/sys_base_menu.go +++ b/server/service/sys_base_menu.go @@ -32,7 +32,7 @@ func DeleteBaseMenu(id float64) (err error) { // @description 更新路由 // @auth (2020/04/05 20:22) // @param menu model.SysBaseMenu -// @return err error +// @return err errorgetMenu func UpdateBaseMenu(menu model.SysBaseMenu) (err error) { upDateMap := make(map[string]interface{}) diff --git a/server/service/sys_menu.go b/server/service/sys_menu.go index a8c0aae7..b3609a06 100644 --- a/server/service/sys_menu.go +++ b/server/service/sys_menu.go @@ -15,7 +15,7 @@ import ( // @return menus []model.SysMenu func GetMenuTree(authorityId string) (err error, menus []model.SysMenu) { - sql := "SELECT authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ? AND authority_menu.parent_id = ?" + sql := "SELECT authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ? AND authority_menu.parent_id = ? ORDER BY authority_menu.sort ASC" err = global.GVA_DB.Raw(sql, authorityId, 0).Scan(&menus).Error for i := 0; i < len(menus); i++ { @@ -127,7 +127,7 @@ func AddMenuAuthority(menus []model.SysBaseMenu, authorityId string) (err error) // @return menus []SysBaseMenu func GetMenuAuthority(authorityId string) (err error, menus []model.SysMenu) { - sql := "SELECT authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ?" + sql := "SELECT authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ? ORDER BY authority_menu.sort ASC" err = global.GVA_DB.Raw(sql, authorityId).Scan(&menus).Error return err, menus } From c472986f0b134e3450a75a90a961836906fe6fe3 Mon Sep 17 00:00:00 2001 From: pixel <303176530@qq.com> Date: Wed, 15 Apr 2020 16:37:53 +0800 Subject: [PATCH 3/7] =?UTF-8?q?menu=E5=92=8Cauthority=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=88=B6=E7=BA=A7=E5=8F=98=E4=B8=BA=E9=80=89=E6=8B=A9=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/db/qmplus.sql | 18 +-- web/src/api/authority.js | 15 +++ web/src/components/mixins/infoList.js | 4 - web/src/view/example/customer/customer.vue | 3 + web/src/view/example/upload/upload.vue | 3 + .../view/superAdmin/authority/authority.vue | 122 ++++++++++++++++-- web/src/view/superAdmin/menu/menu.vue | 61 ++++++++- web/src/view/superAdmin/user/user.vue | 13 ++ 8 files changed, 206 insertions(+), 33 deletions(-) diff --git a/server/db/qmplus.sql b/server/db/qmplus.sql index 2d1a94b9..9927cba8 100644 --- a/server/db/qmplus.sql +++ b/server/db/qmplus.sql @@ -11,7 +11,7 @@ Target Server Version : 50644 File Encoding : 65001 - Date: 15/04/2020 13:12:44 + Date: 15/04/2020 16:37:36 */ SET NAMES utf8mb4; @@ -3852,13 +3852,6 @@ CREATE TABLE `exa_files` ( INDEX `idx_exa_files_deleted_at`(`deleted_at`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; --- ---------------------------- --- Records of exa_files --- ---------------------------- -INSERT INTO `exa_files` VALUES (1, '2020-04-14 15:52:18', '2020-04-14 15:52:18', NULL, 'logo.png', '7022fdcb1562ff79cc36ce0644b86b8a', '', 1, 0); -INSERT INTO `exa_files` VALUES (2, '2020-04-14 15:53:00', '2020-04-14 15:53:00', NULL, 'index.html', '139ac05423499b520cbf402ceb663b6f', '', 1, 0); -INSERT INTO `exa_files` VALUES (3, '2020-04-14 16:07:43', '2020-04-14 16:07:43', NULL, 'favicon.ico', '7d34c388d92837200de70d3a90b49d3b', '', 1, 0); - -- ---------------------------- -- Table structure for jwt_blacklists -- ---------------------------- @@ -3871,7 +3864,7 @@ CREATE TABLE `jwt_blacklists` ( `jwt` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL, PRIMARY KEY (`id`) USING BTREE, INDEX `idx_jwt_blacklists_deleted_at`(`deleted_at`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 39 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; +) ENGINE = InnoDB AUTO_INCREMENT = 40 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; -- ---------------------------- -- Records of jwt_blacklists @@ -3912,6 +3905,7 @@ INSERT INTO `jwt_blacklists` VALUES (35, '2020-01-06 16:59:26', '2020-01-06 16:5 INSERT INTO `jwt_blacklists` VALUES (36, '2020-03-21 14:46:14', '2020-03-21 14:46:14', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg1Mzc3ODY3LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODQ3NzIwNjd9.DLhWhD1FdcWLyFLcXQynKJnenbVHrSiKhlDGFRzgo5k'); INSERT INTO `jwt_blacklists` VALUES (37, '2020-03-31 14:24:35', '2020-03-31 14:24:35', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg2MTM4MTA4LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODU1MzIzMDh9.Ro2F2dZLfOk2Z_OPRbweOuCpchr6HlHfQIF5qjfc8y4'); INSERT INTO `jwt_blacklists` VALUES (38, '2020-04-01 16:07:57', '2020-04-01 16:07:57', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg2MjQwNzQyLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODU2MzQ5NDJ9.9qaOFu7D5cq4vxTfLi4pyO_JGcKjVAEJIcoStJWJlYg'); +INSERT INTO `jwt_blacklists` VALUES (39, '2020-04-15 16:30:41', '2020-04-15 16:30:41', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg3MDk1Njg5LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODY0ODk4ODl9.-cNmRAyqhylZlzakwoFY08x7RnjI3CiWTiQc_Iabb-c'); -- ---------------------------- -- Table structure for sys_apis @@ -3997,7 +3991,7 @@ CREATE TABLE `sys_authorities` ( -- ---------------------------- -- Records of sys_authorities -- ---------------------------- -INSERT INTO `sys_authorities` VALUES ('888', '普通用户', '0', '2020-04-04 11:44:56', NULL, NULL); +INSERT INTO `sys_authorities` VALUES ('888', '普通用户', '0', '2020-04-04 11:44:56', '2020-04-15 13:15:24', NULL); INSERT INTO `sys_authorities` VALUES ('8881', '普通用户子角色', '888', '2020-04-04 11:44:56', NULL, NULL); INSERT INTO `sys_authorities` VALUES ('9528', '测试角色', '0', '2020-04-04 11:44:56', NULL, NULL); @@ -4098,14 +4092,14 @@ INSERT INTO `sys_base_menus` VALUES (5, '2019-09-19 22:13:18', '2019-12-12 16:57 INSERT INTO `sys_base_menus` VALUES (6, '2019-09-19 22:13:36', '2019-12-12 16:57:30', NULL, 0, 3, 'api', 'api', 0, 'view/superAdmin/api/api.vue', 'api管理', 's-platform', 'api管理', 3); INSERT INTO `sys_base_menus` VALUES (17, '2019-10-09 15:12:29', '2019-12-12 16:57:25', NULL, 0, 3, 'user', 'user', 0, 'view/superAdmin/user/user.vue', '用户管理', 'coordinate', '用户管理', 4); INSERT INTO `sys_base_menus` VALUES (18, '2019-10-15 22:27:22', '2019-12-12 16:51:33', NULL, 0, 0, 'person', 'person', 1, 'view/person/person.vue', '个人信息', 'user-solid', '个人信息', 4); -INSERT INTO `sys_base_menus` VALUES (19, '2019-10-20 11:14:42', '2020-03-29 21:39:18', NULL, 0, 0, 'example', 'example', 0, 'view/example/index.vue', '示例文件', 's-management', '示例文件', 6); +INSERT INTO `sys_base_menus` VALUES (19, '2019-10-20 11:14:42', '2020-04-15 16:35:28', NULL, 0, 0, 'example', 'example', 0, 'view/example/index.vue', '示例文件', 's-management', '示例文件', 6); INSERT INTO `sys_base_menus` VALUES (20, '2019-10-20 11:18:11', '2019-10-20 11:18:11', NULL, 0, 19, 'table', 'table', 0, 'view/example/table/table.vue', '表格示例', 's-order', '表格示例', 1); INSERT INTO `sys_base_menus` VALUES (21, '2019-10-20 11:19:52', '2019-12-12 16:58:15', NULL, 0, 19, 'form', 'form', 0, 'view/example/form/form.vue', '表单示例', 'document', '表单示例', 2); INSERT INTO `sys_base_menus` VALUES (22, '2019-10-20 11:22:19', '2019-12-12 16:58:20', NULL, 0, 19, 'rte', 'rte', 0, 'view/example/rte/rte.vue', '富文本编辑器', 'reading', '富文本编辑器', 3); INSERT INTO `sys_base_menus` VALUES (23, '2019-10-20 11:23:39', '2019-12-12 16:58:23', NULL, 0, 19, 'excel', 'excel', 0, 'view/example/excel/excel.vue', 'excel导入导出', 's-marketing', 'excel导入导出', 4); INSERT INTO `sys_base_menus` VALUES (26, '2019-10-20 11:27:02', '2019-12-12 16:58:27', NULL, 0, 19, 'upload', 'upload', 0, 'view/example/upload/upload.vue', '上传下载', 'upload', '上传下载', 5); INSERT INTO `sys_base_menus` VALUES (33, '2020-02-17 16:20:47', '2020-02-24 19:45:40', NULL, 0, 19, 'breakpoint', 'breakpoint', 0, 'view/example/breakpoint/breakpoint.vue', '断点续传', 'upload', '断点续传', 6); -INSERT INTO `sys_base_menus` VALUES (34, '2020-02-24 19:48:37', '2020-03-27 20:10:02', NULL, 0, 19, 'customer', 'customer', 0, 'view/example/customer/customer.vue', '客户列表(资源示例)', 's-custom', '客户列表(资源示例)', 7); +INSERT INTO `sys_base_menus` VALUES (34, '2020-02-24 19:48:37', '2020-04-15 16:26:21', NULL, 0, 19, 'customer', 'customer', 0, 'view/example/customer/customer.vue', '客户列表(资源示例)', 's-custom', '客户列表(资源示例)', 7); INSERT INTO `sys_base_menus` VALUES (38, '2020-03-29 21:31:03', '2020-03-29 21:31:03', NULL, 0, 0, 'systemTools', 'systemTools', 0, 'view/systemTools/index.vue', '系统工具', 's-cooperation', '系统工具', 5); INSERT INTO `sys_base_menus` VALUES (40, '2020-03-29 21:35:10', '2020-03-29 21:35:10', NULL, 0, 38, 'autoCode', 'autoCode', 0, 'view/systemTools/autoCode/index.vue', '代码生成器', 'cpu', '代码生成器', 1); INSERT INTO `sys_base_menus` VALUES (41, '2020-03-29 21:36:26', '2020-03-29 21:36:26', NULL, 0, 38, 'formCreate', 'formCreate', 0, 'view/systemTools/formCreate/index.vue', '表单生成器', 'magic-stick', '表单生成器', 2); diff --git a/web/src/api/authority.js b/web/src/api/authority.js index f900f602..c1463df0 100644 --- a/web/src/api/authority.js +++ b/web/src/api/authority.js @@ -59,4 +59,19 @@ export const setDataAuthority = (data) => { method: 'post', data }) +} + +// @Summary 修改角色 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body model.SysAuthority true "修改角色" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"设置成功"}" +// @Router /authority/setDataAuthority [post] +export const updateAuthority = (data) => { + return service({ + url: "/authority/updateAuthority", + method: 'put', + data + }) } \ No newline at end of file diff --git a/web/src/components/mixins/infoList.js b/web/src/components/mixins/infoList.js index ee820ef4..ed0e303a 100644 --- a/web/src/components/mixins/infoList.js +++ b/web/src/components/mixins/infoList.js @@ -24,9 +24,5 @@ export default { this.page = table.data.page this.pageSize = table.data.pageSize } - }, - mounted() { - this.getTableData() } - } \ No newline at end of file diff --git a/web/src/view/example/customer/customer.vue b/web/src/view/example/customer/customer.vue index ccb94f65..c8ba6b18 100644 --- a/web/src/view/example/customer/customer.vue +++ b/web/src/view/example/customer/customer.vue @@ -157,6 +157,9 @@ export default { this.type = "create" this.dialogFormVisible = true } + }, + created(){ + this.getTableData() } } diff --git a/web/src/view/example/upload/upload.vue b/web/src/view/example/upload/upload.vue index 78d14868..f1d96e28 100644 --- a/web/src/view/example/upload/upload.vue +++ b/web/src/view/example/upload/upload.vue @@ -145,6 +145,9 @@ export default { downloadFile(row) { downloadImage(row.url, row.name) } + }, + created(){ + this.getTableData() } } \ No newline at end of file diff --git a/web/src/view/superAdmin/authority/authority.vue b/web/src/view/superAdmin/authority/authority.vue index 5cf9e9e9..56cfde31 100644 --- a/web/src/view/superAdmin/authority/authority.vue +++ b/web/src/view/superAdmin/authority/authority.vue @@ -16,19 +16,34 @@ - - + + + + - + @@ -62,7 +77,8 @@ import { getAuthorityList, deleteAuthority, - createAuthority + createAuthority, + updateAuthority } from '@/api/authority' import Menus from '@/view/superAdmin/authority/components/menus' @@ -75,8 +91,13 @@ export default { mixins: [infoList], data() { return { + AuthorityOption:[{ + authorityId:"0", + authorityName:"根角色" + }], listApi: getAuthorityList, drawer: false, + dialogType:"add", activeRow: {}, activeUserId: 0, dialogTitle:"新增角色", @@ -137,6 +158,11 @@ export default { // 初始化表单 initForm() { this.$refs.authorityForm.resetFields() + this.form = { + authorityId: '', + authorityName: '', + parentId: '0' + } }, // 关闭窗口 closeDialog() { @@ -156,28 +182,96 @@ export default { } this.$refs.authorityForm.validate(async valid => { if (valid) { - const res = await createAuthority(this.form) - if (res.code == 0) { - this.$message({ - type: 'success', - message: '添加成功!' - }) - this.getTableData() - this.closeDialog() + switch (this.dialogType) { + case 'add': + { + const res = await createAuthority(this.form) + if (res.code == 0) { + this.$message({ + type: 'success', + message: '添加成功!' + }) + this.getTableData() + this.closeDialog() + } + } + break; + case 'edit': + { + const res = await updateAuthority(this.form) + if (res.code == 0) { + this.$message({ + type: 'success', + message: '添加成功!' + }) + this.getTableData() + this.closeDialog() + } + } + break; + default: + break; } + this.initForm() this.dialogFormVisible = false } }) }, + getAuthorityList(AuthorityData){ + AuthorityData.map(item=>{ + this.AuthorityOption.push({ + authorityId:item.authorityId, + authorityName:item.authorityName + }) + if(item.children){ + this.getAuthorityList(item.children) + } + }) + }, + findAuthoritySelf(authority,authData,outData){ + authData.some(item=>{ + if(item.authorityId == authority.authorityId){ + outData.push(item) + return true + } + this.findAuthoritySelf(authority,item.children,outData) + }) + }, + findAllChild(authority,array){ + authority&&authority.map(item=>{ + array.push(item.authorityId) + this.findAllChild(item.children,array) + }) + }, + canSelect(authority){ + const array = [] + const arrayIds = [] + this.findAuthoritySelf({authorityId:this.form.authorityId},this.tableData,array) + this.findAllChild(array,arrayIds) + return arrayIds.indexOf(authority.authorityId)>-1 + }, // 增加角色 addAuthority(parentId) { + this. dialogTitle = "新增角色" + this.dialogType = "add" this.form.parentId = parentId this.dialogFormVisible = true + }, + // 增加角色 + editAuthority(row) { + this. dialogTitle = "编辑角色" + this.dialogType = "edit" + for(let key in this.form){ + this.form[key] = row[key] + } + this.dialogFormVisible = true } }, - created() { + async created() { this.pageSize = 999 + await this.getTableData() + this.getAuthorityList(this.tableData) } } diff --git a/web/src/view/superAdmin/menu/menu.vue b/web/src/view/superAdmin/menu/menu.vue index 4fce4fdb..76c3270f 100644 --- a/web/src/view/superAdmin/menu/menu.vue +++ b/web/src/view/superAdmin/menu/menu.vue @@ -47,7 +47,21 @@ - + + + + @@ -90,6 +104,12 @@ export default { listApi: getMenuList, dialogFormVisible: false, dialogTitle:"新增菜单", + menuOption:[ + { + ID:"0", + title:"根菜单" + } + ], form: { ID: 0, path: '', @@ -211,10 +231,45 @@ export default { this.form = res.data.menu this.dialogFormVisible = true this.isEdit = true - } + }, + getMenuList(MenuData){ + MenuData.map(item=>{ + this.menuOption.push({ + ID:String(item.ID), + title:item.meta.title + }) + if(item.children){ + this.getMenuList(item.children) + } + }) + }, + findAuthoritySelf(mune,muneData,outData){ + muneData&&muneData.some(item=>{ + if(item.ID == mune.ID){ + outData.push(item) + return true + } + this.findAuthoritySelf(mune,item.children,outData) + }) + }, + findAllChild(menu,array){ + menu&&menu.map(item=>{ + array.push(String(item.ID)) + this.findAllChild(item.children,array) + }) + }, + canSelect(authority){ + const array = [] + const arrayIds = [] + this.findAuthoritySelf({ID:this.form.ID},this.tableData,array) + this.findAllChild(array,arrayIds) + return arrayIds.indexOf(authority.ID)>-1 + }, }, - created() { + async created() { this.pageSize = 999 + await this.getTableData() + await this.getMenuList(this.tableData) } } diff --git a/web/src/view/superAdmin/user/user.vue b/web/src/view/superAdmin/user/user.vue index a81456d2..8e0613cc 100644 --- a/web/src/view/superAdmin/user/user.vue +++ b/web/src/view/superAdmin/user/user.vue @@ -127,6 +127,17 @@ export default { ...mapGetters('user', ['token']) }, methods: { + getAuthorityList(AuthorityData){ + AuthorityData.map(item=>{ + this.authOptions.push({ + authorityId:item.authorityId, + authorityName:item.authorityName + }) + if(item.children){ + this.getAuthorityList(item.children) + } + }) + }, async enterAddUserDialog() { this.$refs.userForm.validate(async valid => { if (valid) { @@ -160,8 +171,10 @@ export default { } }, async created() { + this.getTableData() const res = await getAuthorityList({ page: 1, pageSize: 999 }) this.authOptions = res.data.list + } From 1f87643c0b4f24814c723cd816969e5befee0f5d Mon Sep 17 00:00:00 2001 From: pixel <303176530@qq.com> Date: Wed, 15 Apr 2020 17:49:30 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E6=8F=90=E4=BE=9B=E4=BA=86keepalive?= =?UTF-8?q?=E6=94=AF=E6=8C=81=20=E9=9C=80=E8=A6=81=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E6=96=B0=E7=9A=84=E6=95=B0=E6=8D=AE=E5=BA=93=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/db/qmplus.sql | 55 ++++++++++++++++----------- server/model/sys_base_menu.go | 8 ++-- server/service/sys_base_menu.go | 2 + server/service/sys_menu.go | 5 +-- web/src/view/layout/index.vue | 7 +++- web/src/view/superAdmin/api/api.vue | 3 ++ web/src/view/superAdmin/menu/menu.vue | 14 +++++-- 7 files changed, 61 insertions(+), 33 deletions(-) diff --git a/server/db/qmplus.sql b/server/db/qmplus.sql index 9927cba8..6c5b0eac 100644 --- a/server/db/qmplus.sql +++ b/server/db/qmplus.sql @@ -11,7 +11,7 @@ Target Server Version : 50644 File Encoding : 65001 - Date: 15/04/2020 16:37:36 + Date: 15/04/2020 17:48:50 */ SET NAMES utf8mb4; @@ -3864,7 +3864,7 @@ CREATE TABLE `jwt_blacklists` ( `jwt` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL, PRIMARY KEY (`id`) USING BTREE, INDEX `idx_jwt_blacklists_deleted_at`(`deleted_at`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 40 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; +) ENGINE = InnoDB AUTO_INCREMENT = 47 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; -- ---------------------------- -- Records of jwt_blacklists @@ -3906,6 +3906,13 @@ INSERT INTO `jwt_blacklists` VALUES (36, '2020-03-21 14:46:14', '2020-03-21 14:4 INSERT INTO `jwt_blacklists` VALUES (37, '2020-03-31 14:24:35', '2020-03-31 14:24:35', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg2MTM4MTA4LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODU1MzIzMDh9.Ro2F2dZLfOk2Z_OPRbweOuCpchr6HlHfQIF5qjfc8y4'); INSERT INTO `jwt_blacklists` VALUES (38, '2020-04-01 16:07:57', '2020-04-01 16:07:57', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg2MjQwNzQyLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODU2MzQ5NDJ9.9qaOFu7D5cq4vxTfLi4pyO_JGcKjVAEJIcoStJWJlYg'); INSERT INTO `jwt_blacklists` VALUES (39, '2020-04-15 16:30:41', '2020-04-15 16:30:41', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg3MDk1Njg5LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODY0ODk4ODl9.-cNmRAyqhylZlzakwoFY08x7RnjI3CiWTiQc_Iabb-c'); +INSERT INTO `jwt_blacklists` VALUES (40, '2020-04-15 16:39:26', '2020-04-15 16:39:26', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg3NTQ0MjUwLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODY5Mzg0NTB9.smVP-Rl1EkAuUVqXW7z0mpxA5O86vXj0oH4FukG-NVA'); +INSERT INTO `jwt_blacklists` VALUES (41, '2020-04-15 17:08:06', '2020-04-15 17:08:06', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg3NTQ0NzgxLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODY5Mzg5ODF9.OMZ08Y8aPuj40-NGEQ402LyRFBpkLWzzaqD3_tvj1h8'); +INSERT INTO `jwt_blacklists` VALUES (42, '2020-04-15 17:08:28', '2020-04-15 17:08:28', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg3NTQ2NDk0LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODY5NDA2OTR9.9lsoTbZrwhZ8kMXiH-Ta3A4h_yp7SwLj57mo_u5mrk4'); +INSERT INTO `jwt_blacklists` VALUES (43, '2020-04-15 17:10:24', '2020-04-15 17:10:24', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg3NTQ2NTE1LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODY5NDA3MTV9.5SrUrUmd4YhzlGmSpA9xJW_wbjV6yI6ty_NriIceOQo'); +INSERT INTO `jwt_blacklists` VALUES (44, '2020-04-15 17:11:43', '2020-04-15 17:11:43', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg3NTQ2NjI5LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODY5NDA4Mjl9.SFiomEpOshboOe0JGDa1HlJt5aQIF7IeyOsoDwl1o8E'); +INSERT INTO `jwt_blacklists` VALUES (45, '2020-04-15 17:12:54', '2020-04-15 17:12:54', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg3NTQ2NzE4LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODY5NDA5MTh9.xrwEknZQN2J3poarMTQvb7mX1Icicz2_f60kw36g9og'); +INSERT INTO `jwt_blacklists` VALUES (46, '2020-04-15 17:14:47', '2020-04-15 17:14:47', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg3NTQ2Nzg5LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODY5NDA5ODl9.3jbdl1N0KA8ExFMWXHi3ha4aESKq8yDKDgpSH4Xdsnk'); -- ---------------------------- -- Table structure for sys_apis @@ -4076,6 +4083,8 @@ CREATE TABLE `sys_base_menus` ( `icon` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `nick_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `sort` int(255) NULL DEFAULT NULL, + `keep_alive` tinyint(1) NULL DEFAULT NULL, + `default_menu` tinyint(1) NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE, INDEX `idx_base_menus_deleted_at`(`deleted_at`) USING BTREE, INDEX `idx_sys_base_menus_deleted_at`(`deleted_at`) USING BTREE @@ -4084,26 +4093,26 @@ CREATE TABLE `sys_base_menus` ( -- ---------------------------- -- Records of sys_base_menus -- ---------------------------- -INSERT INTO `sys_base_menus` VALUES (1, '2019-09-19 22:05:18', '2020-04-07 21:48:04', NULL, 0, 0, 'dashboard', 'dashboard', 0, 'view/dashboard/index.vue', '仪表盘', 'setting', '仪表盘', 1); -INSERT INTO `sys_base_menus` VALUES (2, '2019-09-19 22:06:17', '2020-03-27 20:33:58', NULL, 0, 0, 'test', 'test', 0, 'view/test/index.vue', '测试菜单', 'info', '测试菜单', 2); -INSERT INTO `sys_base_menus` VALUES (3, '2019-09-19 22:06:38', '2019-12-12 16:51:31', NULL, 0, 0, 'admin', 'superAdmin', 0, 'view/superAdmin/index.vue', '超级管理员', 'user-solid', '超级管理员', 3); -INSERT INTO `sys_base_menus` VALUES (4, '2019-09-19 22:11:53', '2019-09-19 22:11:53', NULL, 0, 3, 'authority', 'authority', 0, 'view/superAdmin/authority/authority.vue', '角色管理', 's-custom', '角色管理', 1); -INSERT INTO `sys_base_menus` VALUES (5, '2019-09-19 22:13:18', '2019-12-12 16:57:20', NULL, 0, 3, 'menu', 'menu', 0, 'view/superAdmin/menu/menu.vue', '菜单管理', 's-order', '菜单管理', 2); -INSERT INTO `sys_base_menus` VALUES (6, '2019-09-19 22:13:36', '2019-12-12 16:57:30', NULL, 0, 3, 'api', 'api', 0, 'view/superAdmin/api/api.vue', 'api管理', 's-platform', 'api管理', 3); -INSERT INTO `sys_base_menus` VALUES (17, '2019-10-09 15:12:29', '2019-12-12 16:57:25', NULL, 0, 3, 'user', 'user', 0, 'view/superAdmin/user/user.vue', '用户管理', 'coordinate', '用户管理', 4); -INSERT INTO `sys_base_menus` VALUES (18, '2019-10-15 22:27:22', '2019-12-12 16:51:33', NULL, 0, 0, 'person', 'person', 1, 'view/person/person.vue', '个人信息', 'user-solid', '个人信息', 4); -INSERT INTO `sys_base_menus` VALUES (19, '2019-10-20 11:14:42', '2020-04-15 16:35:28', NULL, 0, 0, 'example', 'example', 0, 'view/example/index.vue', '示例文件', 's-management', '示例文件', 6); -INSERT INTO `sys_base_menus` VALUES (20, '2019-10-20 11:18:11', '2019-10-20 11:18:11', NULL, 0, 19, 'table', 'table', 0, 'view/example/table/table.vue', '表格示例', 's-order', '表格示例', 1); -INSERT INTO `sys_base_menus` VALUES (21, '2019-10-20 11:19:52', '2019-12-12 16:58:15', NULL, 0, 19, 'form', 'form', 0, 'view/example/form/form.vue', '表单示例', 'document', '表单示例', 2); -INSERT INTO `sys_base_menus` VALUES (22, '2019-10-20 11:22:19', '2019-12-12 16:58:20', NULL, 0, 19, 'rte', 'rte', 0, 'view/example/rte/rte.vue', '富文本编辑器', 'reading', '富文本编辑器', 3); -INSERT INTO `sys_base_menus` VALUES (23, '2019-10-20 11:23:39', '2019-12-12 16:58:23', NULL, 0, 19, 'excel', 'excel', 0, 'view/example/excel/excel.vue', 'excel导入导出', 's-marketing', 'excel导入导出', 4); -INSERT INTO `sys_base_menus` VALUES (26, '2019-10-20 11:27:02', '2019-12-12 16:58:27', NULL, 0, 19, 'upload', 'upload', 0, 'view/example/upload/upload.vue', '上传下载', 'upload', '上传下载', 5); -INSERT INTO `sys_base_menus` VALUES (33, '2020-02-17 16:20:47', '2020-02-24 19:45:40', NULL, 0, 19, 'breakpoint', 'breakpoint', 0, 'view/example/breakpoint/breakpoint.vue', '断点续传', 'upload', '断点续传', 6); -INSERT INTO `sys_base_menus` VALUES (34, '2020-02-24 19:48:37', '2020-04-15 16:26:21', NULL, 0, 19, 'customer', 'customer', 0, 'view/example/customer/customer.vue', '客户列表(资源示例)', 's-custom', '客户列表(资源示例)', 7); -INSERT INTO `sys_base_menus` VALUES (38, '2020-03-29 21:31:03', '2020-03-29 21:31:03', NULL, 0, 0, 'systemTools', 'systemTools', 0, 'view/systemTools/index.vue', '系统工具', 's-cooperation', '系统工具', 5); -INSERT INTO `sys_base_menus` VALUES (40, '2020-03-29 21:35:10', '2020-03-29 21:35:10', NULL, 0, 38, 'autoCode', 'autoCode', 0, 'view/systemTools/autoCode/index.vue', '代码生成器', 'cpu', '代码生成器', 1); -INSERT INTO `sys_base_menus` VALUES (41, '2020-03-29 21:36:26', '2020-03-29 21:36:26', NULL, 0, 38, 'formCreate', 'formCreate', 0, 'view/systemTools/formCreate/index.vue', '表单生成器', 'magic-stick', '表单生成器', 2); -INSERT INTO `sys_base_menus` VALUES (42, '2020-04-02 14:19:36', '2020-04-02 14:20:16', NULL, 0, 38, 'system', 'system', 0, 'view/systemTools/system/system.vue', '系统配置', 's-operation', '系统配置', 3); +INSERT INTO `sys_base_menus` VALUES (1, '2019-09-19 22:05:18', '2020-04-07 21:48:04', NULL, 0, 0, 'dashboard', 'dashboard', 0, 'view/dashboard/index.vue', '仪表盘', 'setting', '仪表盘', 1, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (2, '2019-09-19 22:06:17', '2020-04-15 17:22:51', NULL, 0, 0, 'test', 'test', 0, 'view/test/index.vue', '测试菜单', 'info', '测试菜单', 2, 0, 0); +INSERT INTO `sys_base_menus` VALUES (3, '2019-09-19 22:06:38', '2019-12-12 16:51:31', NULL, 0, 0, 'admin', 'superAdmin', 0, 'view/superAdmin/index.vue', '超级管理员', 'user-solid', '超级管理员', 3, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (4, '2019-09-19 22:11:53', '2019-09-19 22:11:53', NULL, 0, 3, 'authority', 'authority', 0, 'view/superAdmin/authority/authority.vue', '角色管理', 's-custom', '角色管理', 1, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (5, '2019-09-19 22:13:18', '2019-12-12 16:57:20', NULL, 0, 3, 'menu', 'menu', 0, 'view/superAdmin/menu/menu.vue', '菜单管理', 's-order', '菜单管理', 2, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (6, '2019-09-19 22:13:36', '2020-04-15 17:37:39', NULL, 0, 3, 'api', 'api', 0, 'view/superAdmin/api/api.vue', 'api管理', 's-platform', 'api管理', 3, 1, 0); +INSERT INTO `sys_base_menus` VALUES (17, '2019-10-09 15:12:29', '2019-12-12 16:57:25', NULL, 0, 3, 'user', 'user', 0, 'view/superAdmin/user/user.vue', '用户管理', 'coordinate', '用户管理', 4, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (18, '2019-10-15 22:27:22', '2019-12-12 16:51:33', NULL, 0, 0, 'person', 'person', 1, 'view/person/person.vue', '个人信息', 'user-solid', '个人信息', 4, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (19, '2019-10-20 11:14:42', '2020-04-15 16:35:28', NULL, 0, 0, 'example', 'example', 0, 'view/example/index.vue', '示例文件', 's-management', '示例文件', 6, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (20, '2019-10-20 11:18:11', '2019-10-20 11:18:11', NULL, 0, 19, 'table', 'table', 0, 'view/example/table/table.vue', '表格示例', 's-order', '表格示例', 1, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (21, '2019-10-20 11:19:52', '2019-12-12 16:58:15', NULL, 0, 19, 'form', 'form', 0, 'view/example/form/form.vue', '表单示例', 'document', '表单示例', 2, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (22, '2019-10-20 11:22:19', '2019-12-12 16:58:20', NULL, 0, 19, 'rte', 'rte', 0, 'view/example/rte/rte.vue', '富文本编辑器', 'reading', '富文本编辑器', 3, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (23, '2019-10-20 11:23:39', '2019-12-12 16:58:23', NULL, 0, 19, 'excel', 'excel', 0, 'view/example/excel/excel.vue', 'excel导入导出', 's-marketing', 'excel导入导出', 4, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (26, '2019-10-20 11:27:02', '2019-12-12 16:58:27', NULL, 0, 19, 'upload', 'upload', 0, 'view/example/upload/upload.vue', '上传下载', 'upload', '上传下载', 5, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (33, '2020-02-17 16:20:47', '2020-02-24 19:45:40', NULL, 0, 19, 'breakpoint', 'breakpoint', 0, 'view/example/breakpoint/breakpoint.vue', '断点续传', 'upload', '断点续传', 6, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (34, '2020-02-24 19:48:37', '2020-04-15 16:26:21', NULL, 0, 19, 'customer', 'customer', 0, 'view/example/customer/customer.vue', '客户列表(资源示例)', 's-custom', '客户列表(资源示例)', 7, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (38, '2020-03-29 21:31:03', '2020-03-29 21:31:03', NULL, 0, 0, 'systemTools', 'systemTools', 0, 'view/systemTools/index.vue', '系统工具', 's-cooperation', '系统工具', 5, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (40, '2020-03-29 21:35:10', '2020-03-29 21:35:10', NULL, 0, 38, 'autoCode', 'autoCode', 0, 'view/systemTools/autoCode/index.vue', '代码生成器', 'cpu', '代码生成器', 1, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (41, '2020-03-29 21:36:26', '2020-03-29 21:36:26', NULL, 0, 38, 'formCreate', 'formCreate', 0, 'view/systemTools/formCreate/index.vue', '表单生成器', 'magic-stick', '表单生成器', 2, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (42, '2020-04-02 14:19:36', '2020-04-02 14:20:16', NULL, 0, 38, 'system', 'system', 0, 'view/systemTools/system/system.vue', '系统配置', 's-operation', '系统配置', 3, NULL, NULL); -- ---------------------------- -- Table structure for sys_data_authority_id @@ -4204,6 +4213,6 @@ INSERT INTO `sys_workflows` VALUES (8, '2019-12-09 15:20:21', '2019-12-09 15:20: -- View structure for authority_menu -- ---------------------------- DROP VIEW IF EXISTS `authority_menu`; -CREATE ALGORITHM = UNDEFINED DEFINER = `root`@`localhost` SQL SECURITY DEFINER VIEW `authority_menu` AS select `sys_base_menus`.`id` AS `id`,`sys_base_menus`.`created_at` AS `created_at`,`sys_base_menus`.`updated_at` AS `updated_at`,`sys_base_menus`.`deleted_at` AS `deleted_at`,`sys_base_menus`.`menu_level` AS `menu_level`,`sys_base_menus`.`parent_id` AS `parent_id`,`sys_base_menus`.`path` AS `path`,`sys_base_menus`.`name` AS `name`,`sys_base_menus`.`hidden` AS `hidden`,`sys_base_menus`.`component` AS `component`,`sys_base_menus`.`title` AS `title`,`sys_base_menus`.`icon` AS `icon`,`sys_base_menus`.`nick_name` AS `nick_name`,`sys_base_menus`.`sort` AS `sort`,`sys_authority_menus`.`sys_authority_authority_id` AS `authority_id`,`sys_authority_menus`.`sys_base_menu_id` AS `menu_id` from (`sys_authority_menus` join `sys_base_menus` on((`sys_authority_menus`.`sys_base_menu_id` = `sys_base_menus`.`id`))); +CREATE ALGORITHM = UNDEFINED DEFINER = `root`@`localhost` SQL SECURITY DEFINER VIEW `authority_menu` AS select `sys_base_menus`.`id` AS `id`,`sys_base_menus`.`created_at` AS `created_at`,`sys_base_menus`.`updated_at` AS `updated_at`,`sys_base_menus`.`deleted_at` AS `deleted_at`,`sys_base_menus`.`menu_level` AS `menu_level`,`sys_base_menus`.`parent_id` AS `parent_id`,`sys_base_menus`.`path` AS `path`,`sys_base_menus`.`name` AS `name`,`sys_base_menus`.`hidden` AS `hidden`,`sys_base_menus`.`component` AS `component`,`sys_base_menus`.`title` AS `title`,`sys_base_menus`.`icon` AS `icon`,`sys_base_menus`.`nick_name` AS `nick_name`,`sys_base_menus`.`sort` AS `sort`,`sys_authority_menus`.`sys_authority_authority_id` AS `authority_id`,`sys_authority_menus`.`sys_base_menu_id` AS `menu_id`,`sys_base_menus`.`keep_alive` AS `keep_alive`,`sys_base_menus`.`default_menu` AS `default_menu` from (`sys_authority_menus` join `sys_base_menus` on((`sys_authority_menus`.`sys_base_menu_id` = `sys_base_menus`.`id`))); SET FOREIGN_KEY_CHECKS = 1; diff --git a/server/model/sys_base_menu.go b/server/model/sys_base_menu.go index d17223f5..81c71173 100644 --- a/server/model/sys_base_menu.go +++ b/server/model/sys_base_menu.go @@ -19,6 +19,8 @@ type SysBaseMenu struct { } type Meta struct { - Title string `json:"title"` - Icon string `json:"icon"` -} \ No newline at end of file + KeepAlive bool `json:"keepAlive"` + DefaultMenu bool `json:"defaultMenu"` + Title string `json:"title"` + Icon string `json:"icon"` +} diff --git a/server/service/sys_base_menu.go b/server/service/sys_base_menu.go index 5de46cb5..48cdb71d 100644 --- a/server/service/sys_base_menu.go +++ b/server/service/sys_base_menu.go @@ -36,6 +36,8 @@ func DeleteBaseMenu(id float64) (err error) { func UpdateBaseMenu(menu model.SysBaseMenu) (err error) { upDateMap := make(map[string]interface{}) + upDateMap["keep_alive"] = menu.KeepAlive + upDateMap["default_menu"] = menu.DefaultMenu upDateMap["parent_id"] = menu.ParentId upDateMap["path"] = menu.Path upDateMap["name"] = menu.Name diff --git a/server/service/sys_menu.go b/server/service/sys_menu.go index b3609a06..6c9bd140 100644 --- a/server/service/sys_menu.go +++ b/server/service/sys_menu.go @@ -15,8 +15,7 @@ import ( // @return menus []model.SysMenu func GetMenuTree(authorityId string) (err error, menus []model.SysMenu) { - sql := "SELECT authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ? AND authority_menu.parent_id = ? ORDER BY authority_menu.sort ASC" - + sql := "SELECT authority_menu.keep_alive,authority_menu.default_menu,authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ? AND authority_menu.parent_id = ? ORDER BY authority_menu.sort ASC" err = global.GVA_DB.Raw(sql, authorityId, 0).Scan(&menus).Error for i := 0; i < len(menus); i++ { err = getChildrenList(&menus[i], sql) @@ -127,7 +126,7 @@ func AddMenuAuthority(menus []model.SysBaseMenu, authorityId string) (err error) // @return menus []SysBaseMenu func GetMenuAuthority(authorityId string) (err error, menus []model.SysMenu) { - sql := "SELECT authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ? ORDER BY authority_menu.sort ASC" + sql := "SELECT authority_menu.keep_alive,authority_menu.default_menu,authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ? ORDER BY authority_menu.sort ASC" err = global.GVA_DB.Raw(sql, authorityId).Scan(&menus).Error return err, menus } diff --git a/web/src/view/layout/index.vue b/web/src/view/layout/index.vue index 35632400..e504da6f 100644 --- a/web/src/view/layout/index.vue +++ b/web/src/view/layout/index.vue @@ -67,7 +67,12 @@ :to="{ path: item.path }" 暂时注释不用--> - + + + + + + diff --git a/web/src/view/superAdmin/api/api.vue b/web/src/view/superAdmin/api/api.vue index 98d383fc..3ff51df1 100644 --- a/web/src/view/superAdmin/api/api.vue +++ b/web/src/view/superAdmin/api/api.vue @@ -285,6 +285,9 @@ export default { const target = methodOptions.filter(item => item.value === value)[0] return target && `${target.type}` } + }, + created(){ + this.getTableData() } } diff --git a/web/src/view/superAdmin/menu/menu.vue b/web/src/view/superAdmin/menu/menu.vue index 76c3270f..aa328417 100644 --- a/web/src/view/superAdmin/menu/menu.vue +++ b/web/src/view/superAdmin/menu/menu.vue @@ -69,12 +69,18 @@ - + - + + + + + + +
新增菜单需要在角色管理内配置权限才可使用