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/api/v1/sys_user.go b/server/api/v1/sys_user.go index 592123d9..146a5291 100644 --- a/server/api/v1/sys_user.go +++ b/server/api/v1/sys_user.go @@ -229,3 +229,22 @@ func SetUserAuthority(c *gin.Context) { response.OkWithMessage("修改成功", c) } } + +// @Tags SysUser +// @Summary 删除用户 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.SetUserAuth true "删除用户" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}" +// @Router /user/deleteUser [delete] +func DeleteUser(c *gin.Context) { + var reqId request.GetById + _ = c.ShouldBindJSON(&reqId) + err := service.DeleteUser(reqId.Id) + if err != nil { + response.FailWithMessage(fmt.Sprintf("删除失败,%v", err), c) + } else { + response.OkWithMessage("删除成功", c) + } +} diff --git a/server/db/qmplus.sql b/server/db/qmplus.sql index 85ed7bd4..6c5b0eac 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 17:48:50 */ 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,7 @@ 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; -- ---------------------------- -- Table structure for jwt_blacklists @@ -3894,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 = 47 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; -- ---------------------------- -- Records of jwt_blacklists @@ -3935,6 +3905,14 @@ 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'); +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 @@ -3953,7 +3931,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 +3977,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 @@ -4019,7 +3998,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); @@ -4104,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 @@ -4112,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-03-29 21:39:18', 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 (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 @@ -4232,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/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/router/sys_user.go b/server/router/sys_user.go index d59660a3..7c4369ca 100644 --- a/server/router/sys_user.go +++ b/server/router/sys_user.go @@ -13,5 +13,6 @@ func InitUserRouter(Router *gin.RouterGroup) { UserRouter.POST("uploadHeaderImg", v1.UploadHeaderImg) //上传头像 UserRouter.POST("getUserList", v1.GetUserList) // 分页获取用户列表 UserRouter.POST("setUserAuthority", v1.SetUserAuthority) //设置用户权限 + UserRouter.DELETE("deleteUser", v1.DeleteUser) //删除用户 } } 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..093699d7 100644 --- a/server/service/sys_base_menu.go +++ b/server/service/sys_base_menu.go @@ -32,10 +32,13 @@ 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) { + var oldMenu model.SysBaseMenu 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 @@ -44,7 +47,15 @@ func UpdateBaseMenu(menu model.SysBaseMenu) (err error) { upDateMap["title"] = menu.Title upDateMap["icon"] = menu.Icon upDateMap["sort"] = menu.Sort - err = global.GVA_DB.Where("id = ?", menu.ID).Find(&model.SysBaseMenu{}).Updates(upDateMap).Error + db := global.GVA_DB.Where("id = ?", menu.ID).Find(&oldMenu) + if oldMenu.Name != menu.Name { + notSame := global.GVA_DB.Where("id <> ? AND name = ?", menu.ID, menu.Name).First(&model.SysBaseMenu{}).RecordNotFound() + if !notSame { + global.GVA_LOG.Debug("存在相同name修改失败") + return errors.New("存在相同name修改失败") + } + } + err = db.Updates(upDateMap).Error global.GVA_LOG.Debug("菜单修改时候,关联菜单err:%v", err) return err } diff --git a/server/service/sys_menu.go b/server/service/sys_menu.go index a8c0aae7..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 = ?" - + 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 = ?" + 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/server/service/sys_user.go b/server/service/sys_user.go index b065507a..4c340860 100644 --- a/server/service/sys_user.go +++ b/server/service/sys_user.go @@ -95,6 +95,19 @@ func SetUserAuthority(uuid uuid.UUID, authorityId string) (err error) { return err } +// @title SetUserAuthority +// @description set the authority of a certain user, 设置一个用户的权限 +// @auth (2020/04/05 20:22) +// @param uuid UUID +// @param authorityId string +// @return err error + +func DeleteUser(id float64) (err error) { + var user model.SysUser + err = global.GVA_DB.Where("id = ?", id).Delete(&user).Error + return err +} + // @title UploadHeaderImg // @description upload avatar, 用户头像上传更新地址 // @auth (2020/04/05 20:22) 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/api/user.js b/web/src/api/user.js index fbe51f12..70b8d3fc 100644 --- a/web/src/api/user.js +++ b/web/src/api/user.js @@ -77,4 +77,21 @@ export const setUserAuthority = (data) => { method: 'post', data: data }) +} + + +// @Tags SysUser +// @Summary 删除用户 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.SetUserAuth true "删除用户" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}" +// @Router /user/deleteUser [delete] +export const deleteUser = (data) => { + return service({ + url: "/user/deleteUser", + method: 'delete', + data: 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/style/main.scss b/web/src/style/main.scss index 05116234..09bfe405 100644 --- a/web/src/style/main.scss +++ b/web/src/style/main.scss @@ -530,11 +530,12 @@ ol, li { list-style-type: none; } -.el-table__body-wrapper{ - tr{ - td{ - .cell{ - .el-button+.el-button{ + +.el-table__body-wrapper { + tr { + td { + .cell { + .el-button+.el-button { margin-left: 0; } } @@ -542,210 +543,204 @@ li { } } - // navbar -.aside{ -.el-scrollbar { - .el-scrollbar__view { - .el-menu-vertical{ - background-color: #001529; - } - .el-menu-item:hover i, - .el-menu-item:hover span{ - color:#fff; - } - li{ - background-color: #001529; - - ul{ - .el-menu-item{ - background-color: #000408; - height: 44px; - line-height: 44px; - } - - .is-active{ - background-color:#1890ff; - } - } - } - .el-submenu__title:hover{ - background-color: #001529; - } - .el-submenu__title:hover i, - .el-submenu__title:hover span{ - color:#fff; - } - - .el-menu--inline{ - border-left: 5px solid #2c3b41; - } - } - } -} - -// layout - .layout-cont{ - .main-cont{ - position: relative; - &.el-main { - background-color: #ecf0f5; - padding: 0; +.aside { + .el-scrollbar { + .el-scrollbar__view { + .el-menu-vertical { + background-color: #001529; } - .breadcrumb{ - background-color: #fff; - padding: 0 0 15px 15px; + .el-menu-item:hover i, + .el-menu-item:hover span { + color: #fff; + } + li { + background-color: #001529; + ul { + .el-menu-item { + background-color: #000408; + height: 44px; + line-height: 44px; + } + .is-active { + background-color: #1890ff; + } + } + } + .el-submenu__title:hover { + background-color: #001529; + } + .el-submenu__title:hover i, + .el-submenu__title:hover span { + color: #fff; + } + .el-menu--inline { + border-left: 5px solid #2c3b41; } } } +} - .admin-box { - padding: 15px 20px; - .el-button{ - padding: 7px 10px; - } - .el-input__inner{ - height: 30px; - line-height: 30px; +// layout +.layout-cont { + .main-cont { + position: relative; + &.el-main { + background-color: #ecf0f5; + padding: 0; } - .el-input__icon{ - line-height: 30px; + .breadcrumb { + background-color: #fff; + padding: 0 0 15px 15px; } } - .button-box{ - background: #fff; - border: 1px solid #ebeef5; - border-bottom: none; +} +.admin-box { + padding: 15px 20px; + .el-button { + padding: 7px 10px; } - - .search-term{ - background: #fff; - padding: 0 15px; - border-left: 1px solid #ebeef5; - border-right: 1px solid #ebeef5; + .el-input__inner { + height: 30px; + line-height: 30px; + } + .el-input__icon { + line-height: 30px; } - +} +.button-box { + background: #fff; + border: 1px solid #ebeef5; + border-bottom: none; +} + +.search-term { + background: #fff; + padding: 0 15px; + border-left: 1px solid #ebeef5; + border-right: 1px solid #ebeef5; +} // table -.has-gutter{ - tr{ - th{ +.has-gutter { + tr { + th { background-color: #fafafa; } } } -.el-table--striped{ - .el-table__body{ - tr.el-table__row--striped{ - td{ + +.el-table--striped { + .el-table__body { + tr.el-table__row--striped { + td { background: #fff!important; } } } -} -.el-table th, .el-table tr{ +} + +.el-table th, +.el-table tr { background-color: #fafafa; } -.el-pagination{ + +.el-pagination { .btn-prev, - .btn-next{ + .btn-next { border: 1px solid #ddd; border-radius: 4px; } - .el-pager{ - - - li{ + .el-pager { + li { color: #666; font-size: 12px; margin: 0 5px; border: 1px solid #ddd; border-radius: 4px; } - } + } } - - // el-form -.el-form{ +.el-form { background-color: #fff; padding: 10px 0; } -.el-row{ + +.el-row { padding: 10px 0; - .el-col>label{ - - line-height: 30px; - text-align: right; - width: 80%; - padding-right: 15px; - display: inline-block; - + .el-col>label { + line-height: 30px; + text-align: right; + width: 80%; + padding-right: 15px; + display: inline-block; } - - .line{ + .line { line-height: 30px; text-align: center; } } + // edit_container -.edit_container{ +.edit_container { background-color: #fff; padding: 15px; .el-button { margin: 15px 0; } } -.edit{ + +.edit { background-color: #fff; - padding: 15px; + padding: 15px; .el-button { margin: 15px 0; } } + // upload-demo .upload-demo, -.upload{ +.upload { background-color: #fff; - padding: 15px; - .el-upload-list__item-status-label{ + padding: 15px; + .el-upload-list__item-status-label { right: 0; left: 120px; } - .el-upload__tip{ + .el-upload__tip { margin: 10px 0; - } + } } // system -.system{ +.system { padding: 15px; - .el-input__inner{ + .el-input__inner { width: 80%; } } // 导航 #app { - .el-container{ + .el-container { position: relative; height: 100%; width: 100%; - } .el-container.mobile.openside { position: fixed; top: 0; } - .hideside{ - .aside{ + .hideside { + .aside { width: 54px!important; } } - .el-aside{ + .el-aside { -webkit-transition: width .2s; transition: width .2s; width: 220px; @@ -759,66 +754,57 @@ li { z-index: 1001; overflow: hidden; } - - .mobile.hideside{ - .el-aside{ + .mobile.hideside { + .el-aside { // pointer-events: none; -webkit-transition-duration: .2s; transition-duration: .2s; - -webkit-transform: translate3d(-210px,0,0); - transform: translate3d(-220px,0,0); + -webkit-transform: translate3d(-210px, 0, 0); + transform: translate3d(-220px, 0, 0); } - } - - .mobile{ - .el-aside{ + .mobile { + .el-aside { -webkit-transition: -webkit-transform .28s; transition: -webkit-transform .28s; transition: transform .28s; - transition: transform .28s,-webkit-transform .28s; + transition: transform .28s, -webkit-transform .28s; width: 210px!important } } - - - .el-container{ + .el-container { position: relative; height: 100%; width: 100%; - .el-aside{ + .el-aside { // transition: none; - .aside { + .aside { background: #000; - .el-menu{ + .el-menu { border-right: none; } } } } - - .main-cont.el-main{ + .main-cont.el-main { min-height: 100%; -webkit-transition: margin-left .28s; transition: margin-left .28s; margin-left: 220px; position: relative; } - - - .hideside{ - .main-cont.el-main{ + .hideside { + .main-cont.el-main { margin-left: 54px; } } - .mobile { - .main-cont.el-main{ + .mobile { + .main-cont.el-main { margin-left: 0px; } - } - .openside.mobile{ - .shadowBg{ + .openside.mobile { + .shadowBg { background: #000; opacity: .3; width: 100%; @@ -829,22 +815,39 @@ li { left: 0; } } - } -.el-menu--vertical{ - .el-menu{ + +.el-menu .el-menu--inline { + background: #2c3b41; +} + +.el-submenu .el-submenu { + background-color: #000408 !important; +} + +.aside .el-scrollbar .el-scrollbar__view .el-submenu__title:hover { + background-color: #000408 !important; +} + +.el-submenu { + .aside .el-scrollbar .el-scrollbar__view .el-submenu__title:hover { + background-color: #000408 !important; + } +} + +.el-menu--vertical { + .el-menu { margin-left: -8px; - background-color:rgb(48,65,86); - .el-menu-item{ - background-color:rgb(48,65,86); + background-color: rgb(48, 65, 86); + .el-menu-item { + background-color: rgb(48, 65, 86); } - .el-menu-item:focus, - .el-menu-item:hover{ + .el-menu-item:focus, + .el-menu-item:hover { background-color: #263445; color: #fff; } } } -// 导航***** - +// 导航***** \ No newline at end of file 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 @@ - - + 大文件上传 + + + 选择文件 + - 上传 - 上传文件 + 请上传不超过5MB的文件 + + + + + {{ item.name }} + {{percentage}}% + + + + + + + 此版本为先行体验功能测试版,样式美化和性能优化正在进行中,上传切片文件和合成的完整文件分别再QMPlusserver目录的breakpointDir文件夹和fileDir文件夹 - +#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 diff --git a/web/src/view/example/customer/customer.vue b/web/src/view/example/customer/customer.vue index ccb94f65..90c9d0d0 100644 --- a/web/src/view/example/customer/customer.vue +++ b/web/src/view/example/customer/customer.vue @@ -121,6 +121,10 @@ export default { }, closeDialog(){ this.dialogFormVisible = false + this.form = { + customerName:"", + customerPhoneData:"" + } }, async deleteCustomer(row){ this.visible = false @@ -149,7 +153,7 @@ export default { } if(res.code == 0){ - this.dialogFormVisible = false + this.closeDialog() this.getTableData() } }, @@ -157,6 +161,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/layout/index.vue b/web/src/view/layout/index.vue index 6098ff29..0b82d217 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..29ebc6f8 100644 --- a/web/src/view/superAdmin/api/api.vue +++ b/web/src/view/superAdmin/api/api.vue @@ -181,6 +181,12 @@ export default { }, initForm() { this.$refs.apiForm.resetFields() + this.form= { + path: '', + apiGroup: '', + method: '', + description: '' + } }, closeDialog() { this.initForm() @@ -253,7 +259,7 @@ export default { if (res.code == 0) { this.$message({ type: 'success', - message: '添加成功', + message: '编辑成功', showClose: true }) } @@ -285,6 +291,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/authority/authority.vue b/web/src/view/superAdmin/authority/authority.vue index 5cf9e9e9..09053280 100644 --- a/web/src/view/superAdmin/authority/authority.vue +++ b/web/src/view/superAdmin/authority/authority.vue @@ -16,19 +16,28 @@ 设置权限 - 删除角色 新增子角色 + 编辑角色 + 删除角色 + - - + + + - + @@ -62,7 +71,8 @@ import { getAuthorityList, deleteAuthority, - createAuthority + createAuthority, + updateAuthority } from '@/api/authority' import Menus from '@/view/superAdmin/authority/components/menus' @@ -75,8 +85,13 @@ export default { mixins: [infoList], data() { return { + AuthorityOption:[{ + authorityId:"0", + authorityName:"根角色" + }], listApi: getAuthorityList, drawer: false, + dialogType:"add", activeRow: {}, activeUserId: 0, dialogTitle:"新增角色", @@ -137,6 +152,11 @@ export default { // 初始化表单 initForm() { this.$refs.authorityForm.resetFields() + this.form = { + authorityId: '', + authorityName: '', + parentId: '0' + } }, // 关闭窗口 closeDialog() { @@ -156,28 +176,94 @@ 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 } }) }, + setOptions(){ + this.AuthorityOption = [{ + authorityId:"0", + authorityName:"根角色" + }] + this.setAuthorityOptions(this.tableData,this.AuthorityOption,false) + }, + setAuthorityOptions(AuthorityData,optionsData,disabled){ + AuthorityData&&AuthorityData.map(item=>{ + if(item.children.length){ + const option = { + authorityId:item.authorityId, + authorityName:item.authorityName, + disabled:disabled||item.authorityId == this.form.authorityId, + children:[] + } + this.setAuthorityOptions(item.children,option.children,disabled||item.authorityId == this.form.authorityId) + optionsData.push(option) + }else{ + const option = { + authorityId:item.authorityId, + authorityName:item.authorityName, + disabled:disabled||item.authorityId == this.form.authorityId, + } + optionsData.push(option) + } + }) + }, // 增加角色 addAuthority(parentId) { + this.dialogTitle = "新增角色" + this.dialogType = "add" this.form.parentId = parentId + this.setOptions() + this.dialogFormVisible = true + + }, + // 编辑角色 + editAuthority(row) { + this.setOptions() + this.dialogTitle = "编辑角色" + this.dialogType = "edit" + for(let key in this.form){ + this.form[key] = row[key] + } + this.setOptions() this.dialogFormVisible = true } }, - created() { + async created() { this.pageSize = 999 + await this.getTableData() } } diff --git a/web/src/view/superAdmin/menu/menu.vue b/web/src/view/superAdmin/menu/menu.vue index 4fce4fdb..76fd5881 100644 --- a/web/src/view/superAdmin/menu/menu.vue +++ b/web/src/view/superAdmin/menu/menu.vue @@ -47,7 +47,14 @@ - + + @@ -55,12 +62,18 @@ - + - + + + + + + + 新增菜单需要在角色管理内配置权限才可使用