Browse Source

Merge branch 'gin-vue-admin_v2_dev' of https://github.com/flipped-aurora/gin-vue-admin into gin-vue-admin_v2_dev

main
klausY 5 years ago
parent
commit
1d9f3502e6
  1. 19
      server/api/v1/sys_authority.go
  2. 1
      server/api/v1/sys_menu.go
  3. 19
      server/api/v1/sys_user.go
  4. 97
      server/db/qmplus.sql
  5. 6
      server/model/sys_base_menu.go
  6. 1
      server/router/sys_authority.go
  7. 1
      server/router/sys_user.go
  8. 12
      server/service/sys_authority.go
  9. 15
      server/service/sys_base_menu.go
  10. 5
      server/service/sys_menu.go
  11. 13
      server/service/sys_user.go
  12. 15
      web/src/api/authority.js
  13. 17
      web/src/api/user.js
  14. 4
      web/src/components/mixins/infoList.js
  15. 307
      web/src/style/main.scss
  16. 121
      web/src/view/example/breakpoint/breakpoint.vue
  17. 9
      web/src/view/example/customer/customer.vue
  18. 3
      web/src/view/example/upload/upload.vue
  19. 7
      web/src/view/layout/index.vue
  20. 11
      web/src/view/superAdmin/api/api.vue
  21. 114
      web/src/view/superAdmin/authority/authority.vue
  22. 88
      web/src/view/superAdmin/menu/menu.vue
  23. 84
      web/src/view/superAdmin/user/user.vue

19
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

1
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)
}
}

19
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)
}
}

97
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;

6
server/model/sys_base_menu.go

@ -19,6 +19,8 @@ type SysBaseMenu struct {
}
type Meta struct {
Title string `json:"title"`
Icon string `json:"icon"`
KeepAlive bool `json:"keepAlive"`
DefaultMenu bool `json:"defaultMenu"`
Title string `json:"title"`
Icon string `json:"icon"`
}

1
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) //设置角色资源权限
}

1
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) //删除用户
}
}

12
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)

15
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
}

5
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
}

13
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)

15
web/src/api/authority.js

@ -60,3 +60,18 @@ export const setDataAuthority = (data) => {
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
})
}

17
web/src/api/user.js

@ -78,3 +78,20 @@ export const setUserAuthority = (data) => {
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
})
}

4
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()
}
}

307
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,122 +543,118 @@ 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;
@ -667,85 +664,83 @@ li {
}
}
// el-form
.el-form{
.el-form {
background-color: #fff;
padding: 10px 0;
}
.el-row{
padding: 10px 0;
.el-col>label{
line-height: 30px;
text-align: right;
width: 80%;
padding-right: 15px;
display: inline-block;
.el-row {
padding: 10px 0;
.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;
.el-button {
margin: 15px 0;
}
}
// upload-demo
.upload-demo,
.upload{
.upload {
background-color: #fff;
padding: 15px;
.el-upload-list__item-status-label{
.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 .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{
.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:hover {
background-color: #263445;
color: #fff;
}
}
}
// 导航*****
// 导航*****

121
web/src/view/example/breakpoint/breakpoint.vue

@ -1,17 +1,31 @@
<template>
<div class="hello">
<form id="fromCont" method="post">
<input @change="choseFile" id="file" multiple="multiple" type="file" />
<el-divider content-position="left">大文件上传</el-divider>
<form id="fromCont" method="post" >
<div class="fileUpload">
选择文件<input @change="choseFile" id="file" multiple="multiple" type="file" />
</div>
</form>
<el-button @click="getFile">上传</el-button>
<span
<el-button @click="getFile" :disabled="limitFileSize" type="primary" size="medium" class="uploadBtn">上传文件</el-button>
<div class="el-upload__tip">请上传不超过5MB的文件</div>
<div class="list">
<transition-group name="list" tag="p">
<div class="list-item" v-for="(item,i) in uploadList" :key="i" >
<i class="el-icon-document"></i>
<span>{{ item.name }}</span>
<span v-if="file" class="percentage" >{{percentage}}%</span>
<el-progress :show-text='false' :text-inside="false" :stroke-width="2" :percentage="percentage"></el-progress>
</div>
</transition-group>
</div>
<!-- <span
v-if="this.file"
>{{Math.floor(((this.formDataList.length-this.waitNum)/this.formDataList.length)*100)}}%</span>
<h2>此版本为先行体验功能测试版样式美化和性能优化正在进行中上传切片文件和合成的完整文件分别再QMPlusserver目录的breakpointDir文件夹和fileDir文件夹</h2>
>{{Math.floor(((this.formDataList.length-this.waitNum)/this.formDataList.length)*100)}}%</span> -->
<h2 class="tips">此版本为先行体验功能测试版样式美化和性能优化正在进行中上传切片文件和合成的完整文件分别再QMPlusserver目录的breakpointDir文件夹和fileDir文件夹</h2>
</div>
</template>
<script>
import SparkMD5 from 'spark-md5'
import axios from 'axios'
import {
@ -27,15 +41,25 @@ export default {
fileMd5: '',
formDataList: [],
waitUpLoad: [],
waitNum: 0
waitNum: 0,
limitFileSize: false,
percentage:0,
percentageFlage: true,
customColor: '#409eff',
uploadList:[]
}
},
created(){
},
methods: {
//
async choseFile(e) {
const fileR = new FileReader() // reader
const file = e.target.files[0] //
const maxSize = 5*1024*1024
this.file = file // file 便 func
if(file.size<maxSize){
fileR.readAsArrayBuffer(file) // ArrayBuffer
fileR.onload = async e => {
// arrayBuffer e dome e.target.result
@ -83,6 +107,10 @@ export default {
}
this.waitNum = this.waitUpLoad.length //
}
} else {
this.limitFileSize = true
this.$message('请上传小于5M文件')
}
},
getFile() {
//
@ -90,7 +118,14 @@ export default {
this.$message('请先上传文件')
return
}
this.percentage = Math.floor(((this.formDataList.length-this.waitNum)/this.formDataList.length)*100)
if(this.percentage == 100){
this.percentageFlage = false
}
this.sliceFile() //
if(this.percentage == 100){
this.uploadList.push(this.file)
}
},
sliceFile() {
this.waitUpLoad &&
@ -119,7 +154,7 @@ export default {
fileMd5: this.fileMd5
}
const res = await breakpointContinueFinish(params)
if (res.code == 0) {
if (res.success) {
//
const params = {
fileName: this.file.name,
@ -134,7 +169,7 @@ export default {
}
</script>
<style scoped>
<style lang='scss' scoped>
h3 {
margin: 40px 0 0;
}
@ -149,4 +184,70 @@ li {
a {
color: #42b983;
}
#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);
}
</style>

9
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()
}
}
</script>

3
web/src/view/example/upload/upload.vue

@ -145,6 +145,9 @@ export default {
downloadFile(row) {
downloadImage(row.url, row.name)
}
},
created(){
this.getTableData()
}
}
</script>

7
web/src/view/layout/index.vue

@ -67,7 +67,12 @@
:to="{ path: item.path }" 暂时注释不用-->
<HistoryComponent />
<transition mode="out-in" name="el-fade-in-linear">
<router-view class="admin-box"></router-view>
<keep-alive>
<router-view v-if="$route.meta.keepAlive" class="admin-box"></router-view>
</keep-alive>
</transition>
<transition mode="out-in" name="el-fade-in-linear">
<router-view v-if="!$route.meta.keepAlive" class="admin-box"></router-view>
</transition>
</el-main>
</el-container>

11
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()
}
}
</script>

114
web/src/view/superAdmin/authority/authority.vue

@ -16,19 +16,28 @@
<el-table-column fixed="right" label="操作" min-width="300">
<template slot-scope="scope">
<el-button @click="opdendrawer(scope.row)" size="small" type="text">设置权限</el-button>
<el-button @click="deleteAuth(scope.row)" size="small" type="text">删除角色</el-button>
<el-button @click="addAuthority(scope.row.authorityId)" size="small" type="text">新增子角色</el-button>
<el-button @click="editAuthority(scope.row)" size="small" type="text">编辑角色</el-button>
<el-button @click="deleteAuth(scope.row)" size="small" type="text">删除角色</el-button>
</template>
</el-table-column>
</el-table>
<!-- 新增角色弹窗 -->
<el-dialog :visible.sync="dialogFormVisible" :title="dialogTitle">
<el-form :model="form" :rules="rules" ref="authorityForm">
<el-form-item label="父级角色ID" prop="parentId">
<el-input autocomplete="off" disabled v-model="form.parentId"></el-input>
<el-form-item label="父级角色" prop="parentId">
<el-cascader
:disabled="dialogType=='add'"
v-model="form.parentId"
:options="AuthorityOption"
:show-all-levels="false"
:props="{ checkStrictly: true,label:'authorityName',value:'authorityId',disabled:'disabled',emitPath:false}"
filterable>
</el-cascader>
</el-form-item>
<el-form-item label="角色ID" prop="authorityId">
<el-input autocomplete="off" v-model="form.authorityId"></el-input>
<el-input autocomplete="off" :disabled="dialogType=='edit'" v-model="form.authorityId"></el-input>
</el-form-item>
<el-form-item label="角色姓名" prop="authorityName">
<el-input autocomplete="off" v-model="form.authorityName"></el-input>
@ -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()
}
}
</script>

88
web/src/view/superAdmin/menu/menu.vue

@ -47,7 +47,14 @@
</el-select>
</el-form-item>
<el-form-item label="父节点Id">
<el-input autocomplete="off" disabled v-model="form.parentId"></el-input>
<el-cascader
:disabled="!this.isEdit"
v-model="form.parentId"
:options="menuOption"
:show-all-levels="false"
:props="{ checkStrictly: true,label:'title',value:'ID',disabled:'disabled',emitPath:false}"
filterable>
</el-cascader>
</el-form-item>
<el-form-item label="文件路径" prop="component">
<el-input autocomplete="off" v-model="form.component"></el-input>
@ -55,12 +62,18 @@
<el-form-item label="展示名称" prop="meta.title">
<el-input autocomplete="off" v-model="form.meta.title"></el-input>
</el-form-item>
<el-form-item label="图标">
<el-form-item label="图标" prop="meta.icon">
<el-input autocomplete="off" v-model="form.meta.icon"></el-input>
</el-form-item>
<el-form-item label="排序标记">
<el-form-item label="排序标记" prop="sort">
<el-input autocomplete="off" v-model.number="form.sort"></el-input>
</el-form-item>
<el-form-item label="keepAlive" prop="meta.keepAlive">
<el-select placeholder="是否keepAlive缓存页面" v-model="form.meta.keepAlive">
<el-option :value="false" label="否"></el-option>
<el-option :value="true" label="是"></el-option>
</el-select>
</el-form-item>
</el-form>
<div class="warning">新增菜单需要在角色管理内配置权限才可使用</div>
<div class="dialog-footer" slot="footer">
@ -90,6 +103,12 @@ export default {
listApi: getMenuList,
dialogFormVisible: false,
dialogTitle:"新增菜单",
menuOption:[
{
ID:"0",
title:"根菜单"
}
],
form: {
ID: 0,
path: '',
@ -99,7 +118,9 @@ export default {
component: '',
meta: {
title: '',
icon: ''
icon: '',
defaultMenu:false,
keepAlive:false
}
},
rules: {
@ -115,6 +136,34 @@ export default {
}
},
methods: {
setOptions(){
this.menuOption = [{
ID:"0",
title:"根目录"
}]
this.setMenuOptions(this.tableData,this.menuOption,false)
},
setMenuOptions(menuData,optionsData,disabled){
menuData&&menuData.map(item=>{
if(item.children.length){
const option = {
title:item.meta.title,
ID:String(item.ID),
disabled:disabled||item.ID == this.form.ID,
children:[]
}
this.setMenuOptions(item.children,option.children,disabled||item.ID == this.form.ID)
optionsData.push(option)
}else{
const option = {
title:item.meta.title,
ID:String(item.ID),
disabled:disabled||item.ID == this.form.ID,
}
optionsData.push(option)
}
})
},
handleClose(done) {
this.initForm()
done()
@ -163,6 +212,20 @@ export default {
//
initForm() {
this.$refs.menuForm.resetFields()
this.form = {
ID: 0,
path: '',
name: '',
hidden: '',
parentId: '',
component: '',
meta: {
title: '',
icon: '',
defaultMenu:false,
keepAlive:""
}
}
},
//
closeDialog() {
@ -183,14 +246,9 @@ export default {
if (res.code == 0) {
this.$message({
type: 'success',
message: '添加成功!'
message: this.isEdit?'编辑成功':'添加成功!'
})
this.getTableData()
} else {
this.$message({
type: 'error',
message: '添加失败!'
})
}
this.initForm()
this.dialogFormVisible = false
@ -202,6 +260,7 @@ export default {
this.dialogTitle = "新增菜单"
this.form.parentId = String(id)
this.isEdit = false
this.setOptions()
this.dialogFormVisible = true
},
//
@ -209,12 +268,15 @@ export default {
this.dialogTitle = "编辑菜单"
const res = await getBaseMenuById({ id })
this.form = res.data.menu
this.dialogFormVisible = true
this.isEdit = true
}
this.setOptions()
this.dialogFormVisible = true
},
},
created() {
async created() {
this.pageSize = 999
await this.getTableData()
await this.getMenuList(this.tableData)
}
}
</script>

84
web/src/view/superAdmin/user/user.vue

@ -16,18 +16,29 @@
<el-table-column label="昵称" min-width="150" prop="nickName"></el-table-column>
<el-table-column label="用户角色" min-width="150">
<template slot-scope="scope">
<el-select
<el-cascader
@change="changeAuthority(scope.row)"
placeholder="请选择"
v-model="scope.row.authority.authorityId"
>
<el-option
:key="item.authorityId"
:label="item.authorityName"
:value="item.authorityId"
v-for="item in authOptions"
></el-option>
</el-select>
v-model="scope.row.authority.authorityId"
:options="authOptions"
:show-all-levels="false"
:props="{ checkStrictly: true,label:'authorityName',value:'authorityId',disabled:'disabled',emitPath:false}"
filterable>
</el-cascader>
</template>
</el-table-column>
<el-table-column label="操作" min-width="150">
<template slot-scope="scope">
<el-popover
placement="top"
width="160"
v-model="scope.row.visible">
<p>确定要删除此用户吗</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="scope.row.visible = false">取消</el-button>
<el-button type="primary" size="mini" @click="deleteUser(scope.row)">确定</el-button>
</div>
<el-button type="text" size="small" slot="reference">删除</el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
@ -67,14 +78,14 @@
</el-upload>
</el-form-item>
<el-form-item label="用户角色" label-width="80px" prop="authorityId">
<el-select placeholder="请选择" v-model="userInfo.authorityId">
<el-option
:key="item.authorityId"
:label="item.authorityName"
:value="item.authorityId"
v-for="item in authOptions"
></el-option>
</el-select>
<el-cascader
@change="changeAuthority(scope.row)"
v-model="userInfo.authorityId"
:options="authOptions"
:show-all-levels="false"
:props="{ checkStrictly: true,label:'authorityName',value:'authorityId',disabled:'disabled',emitPath:false}"
filterable>
</el-cascader>
</el-form-item>
</el-form>
<div class="dialog-footer" slot="footer">
@ -89,7 +100,7 @@
<script>
// mixins getTableData
const path = process.env.VUE_APP_BASE_API
import { getUserList, setUserAuthority, register } from '@/api/user'
import { getUserList, setUserAuthority, register, deleteUser } from '@/api/user'
import { getAuthorityList } from '@/api/authority'
import infoList from '@/components/mixins/infoList'
import { mapGetters } from 'vuex'
@ -127,6 +138,36 @@ export default {
...mapGetters('user', ['token'])
},
methods: {
setOptions(authData){
this.authOptions = []
this.setAuthorityOptions(authData,this.authOptions)
},
setAuthorityOptions(AuthorityData,optionsData){
AuthorityData&&AuthorityData.map(item=>{
if(item.children.length){
const option = {
authorityId:item.authorityId,
authorityName:item.authorityName,
children:[]
}
this.setAuthorityOptions(item.children,option.children)
optionsData.push(option)
}else{
const option = {
authorityId:item.authorityId,
authorityName:item.authorityName,
}
optionsData.push(option)
}
})
},
async deleteUser(row){
const res = await deleteUser({id:row.ID})
if(res.code == 0){
this.getTableData()
row.visible = false
}
},
async enterAddUserDialog() {
this.$refs.userForm.validate(async valid => {
if (valid) {
@ -160,8 +201,9 @@ export default {
}
},
async created() {
this.getTableData()
const res = await getAuthorityList({ page: 1, pageSize: 999 })
this.authOptions = res.data.list
this.setOptions(res.data.list)
}

Loading…
Cancel
Save