Browse Source

Merge branches 'develop' and 'master' of https://github.com/flipped-aurora/gin-vue-admin into develop

QM303176530 4 years ago
parent
commit
6ff5cfe512

+ 4 - 3
README-zh_CN.md

@@ -56,9 +56,9 @@ Gin-vue-admin 的成长离不开大家的支持,如果你愿意为 gin-vue-adm
 
 - [gin-vue-admin_v2.0_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v2_dev) (v2.0 不再兼容 v1.0)
 
-- [gin-vue-admin_v1.0_stable](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v1_stable) (v1.0 稳定版,会持续更新和维护)
+- [gin-vue-admin_v1.0_stable](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v1_stable) (v1.0停止维护)
 
-- [gin-vue-admin_v1.0_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v1_dev) (v1.0 稳定版,会持续更新和维护)
+- [gin-vue-admin_v1.0_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v1_dev) (v1.0停止维护)
 
 
 ## 2. 使用说明
@@ -254,6 +254,7 @@ swag init
 | [@1319612909](https://github.com/1319612909)  | 前端UI开发 |  杜 |
 | [@krank666](https://github.com/krank666)  | 前端开发 | 尹 |
 | [@chen-chen-up](https://github.com/chen-chen-up)  | 新手开发 | 宋 |
+| [@SliverHorn](https://github.com/SliverHorn)  | 社区管理员 | 赖 |
 
 ## 9. 捐赠
 
@@ -261,4 +262,4 @@ swag init
 
 ## 10. 商用注意事项
 
-如果您将此项目用于商业用途,请遵守apatch2.0协议并保留作者技术支持声明。
+如果您将此项目用于商业用途,请遵守Apache2.0协议并保留作者技术支持声明。

+ 5 - 4
README.md

@@ -53,15 +53,15 @@ We are excited that you are interested in contributing to gin-vue-admin. Before
 
 ### 1.3 Version list
 
-- master: 2.0 dev code, for prod
+- master: 2.0 code, for prod
 
 - develop: 2.0 dev code, for test
 
 - [gin-vue-admin_v2.0_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v2_dev) (v2.0 is no longer compatible with v1.0)
 
-- [gin-vue-admin_v1.0_stable](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v1_stable) (v1.0 is kept up to date and maintained
+- [gin-vue-admin_v1.0_stable](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v1_stable) (stop maintenance
 
-- [gin-vue-admin_v1.0_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v1_dev) (v1.0 is kept up to date and maintained
+- [gin-vue-admin_v1.0_dev](https://github.com/flipped-aurora/gin-vue-admin/tree/gin-vue-admin_v1_dev) (stop maintenance
 
 
 ## 2. Getting started
@@ -258,6 +258,7 @@ backend code file: model\dnModel\api.go
 | [@1319612909](https://github.com/1319612909)  | UI developer |  Du |
 | [@krank666](https://github.com/krank666)  | Frontend developer | Yin |
 | [@chen-chen-up](https://github.com/chen-chen-up)  | Novice developer | Song |
+| [@SliverHorn](https://github.com/SliverHorn)  | Community Administrator | Lai |
 
 ## 9. Donate
 
@@ -265,4 +266,4 @@ If you find this project useful, you can buy author a glass of juice :tropical_d
 
 ## 10. Commercial considerations
 
-If you use this project for commercial purposes, please comply with the apatch2.0 agreement and retain the author's technical support statement.
+If you use this project for commercial purposes, please comply with the Apache2.0 agreement and retain the author's technical support statement.

+ 26 - 0
server/core/install_plugs.go

@@ -0,0 +1,26 @@
+package core
+
+import (
+	"fmt"
+	"gin-vue-admin/global"
+	"gin-vue-admin/initialize"
+	"gin-vue-admin/middleware"
+	"github.com/gin-gonic/gin"
+	"github.com/piexlmax/gvaplug"
+)
+
+func InstallPlugs(route *gin.Engine) {
+	GvaPlugsGroupBase := route.Group("") // 纯净路由 插件可通用 传递给插件的0号位置 为了不让插件的自动路由出问题 这里建议为 ""
+	/**安装一个插件需要的步骤 start**/
+	GvaPlugsGroupMiddle := route.Group("") // 携带中间件的路由 传递给插件的1号位置 为了不让插件的自动路由出问题 这里建议为 ""
+	GvaPlugsGroupMiddle.Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
+	// 插件安装 暂时只是后台功能 添加model 添加路由 添加对数据库的操作  详细插件测试模板可看https://github.com/piexlmax/gvaplug  此处不建议投入生产
+	err := initialize.InstallPlug(global.GVA_DB, [2]*gin.RouterGroup{
+		GvaPlugsGroupBase,
+		GvaPlugsGroupMiddle,
+	}, gvaplug.GvaPlug{SomeConfig: "插件给用户提供的配置区域"})
+	if err != nil {
+		panic(fmt.Sprintf("插件安装失败: %v", err))
+	}
+	/**安装一个插件需要的步骤 end**/
+}

+ 1 - 6
server/core/server.go

@@ -4,7 +4,6 @@ import (
 	"fmt"
 	"gin-vue-admin/global"
 	"gin-vue-admin/initialize"
-	"github.com/piexlmax/gvaplug"
 	"net/http"
 	"time"
 )
@@ -17,11 +16,7 @@ func RunWindowsServer() {
 	Router := initialize.Routers()
 	Router.Static("/form-generator", "./resource/page")
 
-	// 插件安装 暂时只是后台功能 添加model 添加路由 添加对数据库的操作  详细插件测试模板可看https://github.com/piexlmax/gvaplug  此处不建议投入生产
-	err := initialize.InstallPlug(global.GVA_DB, Router, gvaplug.GvaPlug{})
-	if err != nil {
-		panic(fmt.Sprintf("插件安装失败: %v", err))
-	}
+	//InstallPlugs(Router)
 	// end 插件描述
 
 	address := fmt.Sprintf(":%d", global.GVA_CONFIG.System.Addr)

+ 52 - 56
server/db/qmplus.sql

@@ -1,7 +1,7 @@
 /*
  Navicat Premium Data Transfer
 
- Source Server         : pandora
+ Source Server         : qmplus
  Source Server Type    : MySQL
  Source Server Version : 50644
  Source Host           : localhost:3306
@@ -11,7 +11,7 @@
  Target Server Version : 50644
  File Encoding         : 65001
 
- Date: 14/05/2020 14:04:34
+ Date: 11/06/2020 09:29:47
 */
 
 SET NAMES utf8mb4;
@@ -166,10 +166,10 @@ CREATE TABLE `exa_customers`  (
   `created_at` timestamp(0) NULL DEFAULT NULL,
   `updated_at` timestamp(0) NULL DEFAULT NULL,
   `deleted_at` timestamp(0) NULL DEFAULT NULL,
-  `customer_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `customer_phone_data` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `sys_user_id` int(10) UNSIGNED NULL DEFAULT NULL,
-  `sys_user_authority_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+  `customer_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '客户名',
+  `customer_phone_data` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户手机号',
+  `sys_user_id` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '管理ID',
+  `sys_user_authority_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '管理角色ID',
   PRIMARY KEY (`id`) USING BTREE,
   INDEX `idx_exa_customers_deleted_at`(`deleted_at`) USING BTREE
 ) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
@@ -207,10 +207,10 @@ CREATE TABLE `exa_file_upload_and_downloads`  (
   `created_at` timestamp(0) NULL DEFAULT NULL,
   `updated_at` timestamp(0) NULL DEFAULT NULL,
   `deleted_at` timestamp(0) NULL DEFAULT NULL,
-  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `tag` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件名',
+  `url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件地址\r\n',
+  `tag` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件标签\r\n',
+  `key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '编号',
   PRIMARY KEY (`id`) USING BTREE,
   INDEX `idx_file_upload_and_downloads_deleted_at`(`deleted_at`) USING BTREE,
   INDEX `idx_exa_file_upload_and_downloads_deleted_at`(`deleted_at`) USING BTREE
@@ -252,7 +252,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 = 49 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+) ENGINE = InnoDB AUTO_INCREMENT = 51 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
 
 -- ----------------------------
 -- Records of jwt_blacklists
@@ -314,10 +314,10 @@ CREATE TABLE `sys_apis`  (
   `updated_at` timestamp(0) NULL DEFAULT NULL,
   `deleted_at` timestamp(0) NULL DEFAULT NULL,
   `authority_id` int(10) UNSIGNED NULL DEFAULT NULL,
-  `path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `api_group` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `method` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'POST',
+  `path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'api路径',
+  `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'api中文描述',
+  `api_group` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'api组',
+  `method` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'POST' COMMENT '方法',
   PRIMARY KEY (`id`) USING BTREE,
   INDEX `idx_apis_deleted_at`(`deleted_at`) USING BTREE,
   INDEX `idx_sys_apis_deleted_at`(`deleted_at`) USING BTREE
@@ -375,9 +375,9 @@ INSERT INTO `sys_apis` VALUES (47, '2020-04-20 15:14:25', '2020-04-20 15:14:25',
 -- ----------------------------
 DROP TABLE IF EXISTS `sys_authorities`;
 CREATE TABLE `sys_authorities`  (
-  `authority_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
-  `authority_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `parent_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+  `authority_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '角色ID',
+  `authority_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '角色名',
+  `parent_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '父角色ID',
   `created_at` datetime(0) NULL DEFAULT NULL,
   `updated_at` datetime(0) NULL DEFAULT NULL,
   `deleted_at` datetime(0) NULL DEFAULT NULL,
@@ -398,8 +398,8 @@ INSERT INTO `sys_authorities` VALUES ('9528', '测试角色', '0', '2020-04-04 1
 -- ----------------------------
 DROP TABLE IF EXISTS `sys_authority_menus`;
 CREATE TABLE `sys_authority_menus`  (
-  `sys_authority_authority_id` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
-  `sys_base_menu_id` int(10) UNSIGNED NOT NULL DEFAULT 0,
+  `sys_authority_authority_id` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COMMENT '角色ID',
+  `sys_base_menu_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '菜单ID',
   PRIMARY KEY (`sys_authority_authority_id`, `sys_base_menu_id`) USING BTREE,
   INDEX `sys_authority_authority_id`(`sys_authority_authority_id`) USING BTREE
 ) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Compact;
@@ -466,21 +466,21 @@ CREATE TABLE `sys_base_menus`  (
   `updated_at` timestamp(0) NULL DEFAULT NULL,
   `deleted_at` timestamp(0) NULL DEFAULT NULL,
   `menu_level` int(10) UNSIGNED NULL DEFAULT NULL,
-  `parent_id` int(10) UNSIGNED NULL DEFAULT NULL,
-  `path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `hidden` tinyint(1) NULL DEFAULT NULL,
-  `component` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `icon` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+  `parent_id` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '父菜单ID',
+  `path` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '路由path',
+  `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '路由name',
+  `hidden` tinyint(1) NULL DEFAULT NULL COMMENT '是否在列表隐藏',
+  `component` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '对应前端文件路径',
+  `title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '菜单名',
+  `icon` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '菜单图标',
   `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,
+  `sort` int(255) NULL DEFAULT NULL COMMENT '排序标记',
+  `keep_alive` tinyint(1) NULL DEFAULT NULL COMMENT '是否缓存',
+  `default_menu` tinyint(1) NULL DEFAULT NULL COMMENT '是否是基础路由(开发中)',
   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
-) ENGINE = InnoDB AUTO_INCREMENT = 47 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+) ENGINE = InnoDB AUTO_INCREMENT = 48 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
 
 -- ----------------------------
 -- Records of sys_base_menus
@@ -506,14 +506,15 @@ INSERT INTO `sys_base_menus` VALUES (40, '2020-03-29 21:35:10', '2020-05-09 17:4
 INSERT INTO `sys_base_menus` VALUES (41, '2020-03-29 21:36:26', '2020-05-09 17:41:29', NULL, 0, 38, 'formCreate', 'formCreate', 0, 'view/systemTools/formCreate/index.vue', '表单生成器', 'magic-stick', '表单生成器', 2, 0, 0);
 INSERT INTO `sys_base_menus` VALUES (42, '2020-04-02 14:19:36', '2020-05-09 17:41:29', NULL, 0, 38, 'system', 'system', 0, 'view/systemTools/system/system.vue', '系统配置', 's-operation', '系统配置', 3, 0, 0);
 INSERT INTO `sys_base_menus` VALUES (45, '2020-04-29 17:19:34', '2020-05-09 17:42:23', NULL, 0, 0, 'iconList', 'iconList', 0, 'view/iconList/index.vue', '图标集合', 'star-on', NULL, 2, 0, 0);
+INSERT INTO `sys_base_menus` VALUES (47, '2020-05-20 16:01:08', '2020-05-20 16:01:08', '2020-05-20 16:01:20', 0, 0, 'testtest/:id', 'testtest', 0, '阿瑟东', 'a\'s\'d', 'user-solid', NULL, 123, 0, 0);
 
 -- ----------------------------
 -- Table structure for sys_data_authority_id
 -- ----------------------------
 DROP TABLE IF EXISTS `sys_data_authority_id`;
 CREATE TABLE `sys_data_authority_id`  (
-  `sys_authority_authority_id` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
-  `data_authority_id` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
+  `sys_authority_authority_id` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COMMENT '角色ID',
+  `data_authority_id` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COMMENT '资源角色ID',
   PRIMARY KEY (`sys_authority_authority_id`, `data_authority_id`) USING BTREE,
   INDEX `sys_authority_authority_id`(`sys_authority_authority_id`) USING BTREE,
   INDEX `data_authority_id`(`data_authority_id`) USING BTREE
@@ -546,27 +547,22 @@ CREATE TABLE `sys_users`  (
   `created_at` timestamp(0) NULL DEFAULT NULL,
   `updated_at` timestamp(0) NULL DEFAULT NULL,
   `deleted_at` timestamp(0) NULL DEFAULT NULL,
-  `uuid` varbinary(255) NULL DEFAULT NULL,
-  `user_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `pass_word` 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 'QMPlusUser',
-  `header_img` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'http://www.henrongyi.top/avatar/lufu.jpg',
-  `authority_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '888',
-  `authority_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `phone_data` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `manager` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+  `uuid` varbinary(255) NULL DEFAULT NULL COMMENT '用户UUID',
+  `nick_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'QMPlusUser' COMMENT '用户昵称',
+  `header_img` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'http://www.henrongyi.top/avatar/lufu.jpg' COMMENT '用户头像',
+  `authority_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '888' COMMENT '用户角色ID',
+  `username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户登录名',
+  `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户登录密码',
   PRIMARY KEY (`id`) USING BTREE,
   INDEX `idx_users_deleted_at`(`deleted_at`) USING BTREE,
   INDEX `idx_sys_users_deleted_at`(`deleted_at`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
+) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
 
 -- ----------------------------
 -- Records of sys_users
 -- ----------------------------
-INSERT INTO `sys_users` VALUES (10, '2019-09-13 17:23:46', '2020-05-06 16:09:15', NULL, 0x63653064363638352D633135662D343132362D613562342D383930626339643233353664, NULL, NULL, '超级管理员', 'http://qmplusimg.henrongyi.top/15887525450B978439-F04A-4a09-A8D3-DE7DE2677142.png', '888', NULL, 'admin', 'e10adc3949ba59abbe56e057f20f883e', NULL, NULL);
-INSERT INTO `sys_users` VALUES (11, '2019-09-13 17:27:29', '2020-05-09 17:43:44', NULL, 0x66643665663739622D393434632D343838382D383337372D616265326432363038383538, NULL, NULL, 'QMPlusUser', 'http://qmplusimg.henrongyi.top/1572075907logo.png', '9528', NULL, 'a303176530', '3ec063004a6f31642261936a379fde3d', NULL, NULL);
+INSERT INTO `sys_users` VALUES (10, '2019-09-13 17:23:46', '2020-05-06 16:09:15', NULL, 0x63653064363638352D633135662D343132362D613562342D383930626339643233353664, '超级管理员', 'http://qmplusimg.henrongyi.top/15887525450B978439-F04A-4a09-A8D3-DE7DE2677142.png', '888', 'admin', 'e10adc3949ba59abbe56e057f20f883e');
+INSERT INTO `sys_users` VALUES (11, '2019-09-13 17:27:29', '2020-05-09 17:43:44', NULL, 0x66643665663739622D393434632D343838382D383337372D616265326432363038383538, 'QMPlusUser', 'http://qmplusimg.henrongyi.top/1572075907logo.png', '9528', 'a303176530', '3ec063004a6f31642261936a379fde3d');
 
 -- ----------------------------
 -- Table structure for sys_workflow_step_infos
@@ -577,12 +573,12 @@ CREATE TABLE `sys_workflow_step_infos`  (
   `created_at` timestamp(0) NULL DEFAULT NULL,
   `updated_at` timestamp(0) NULL DEFAULT NULL,
   `deleted_at` timestamp(0) NULL DEFAULT NULL,
-  `workflow_id` int(10) UNSIGNED NULL DEFAULT NULL,
-  `is_strat` tinyint(1) NULL DEFAULT NULL,
-  `step_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `step_no` double NULL DEFAULT NULL,
-  `step_authority_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `is_end` tinyint(1) NULL DEFAULT NULL,
+  `workflow_id` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '所属工作流ID',
+  `is_strat` tinyint(1) NULL DEFAULT NULL COMMENT '是否是开始流节点',
+  `step_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工作流节点名称',
+  `step_no` double NULL DEFAULT NULL COMMENT '步骤id (第几步)',
+  `step_authority_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '操作者级别id',
+  `is_end` tinyint(1) NULL DEFAULT NULL COMMENT '是否是完结流节点',
   `sys_workflow_id` int(10) UNSIGNED NULL DEFAULT NULL,
   PRIMARY KEY (`id`) USING BTREE,
   INDEX `idx_workflow_step_infos_deleted_at`(`deleted_at`) USING BTREE,
@@ -598,9 +594,9 @@ CREATE TABLE `sys_workflows`  (
   `created_at` timestamp(0) NULL DEFAULT NULL,
   `updated_at` timestamp(0) NULL DEFAULT NULL,
   `deleted_at` timestamp(0) NULL DEFAULT NULL,
-  `workflow_nick_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `workflow_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `workflow_description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+  `workflow_nick_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工作流中文名称',
+  `workflow_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工作流英文名称',
+  `workflow_description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工作流描述',
   PRIMARY KEY (`id`) USING BTREE,
   INDEX `idx_workflows_deleted_at`(`deleted_at`) USING BTREE,
   INDEX `idx_sys_workflows_deleted_at`(`deleted_at`) USING BTREE

+ 7 - 3
server/go.mod

@@ -13,11 +13,13 @@ require (
 	github.com/gin-gonic/gin v1.6.3
 	github.com/go-openapi/spec v0.19.7 // indirect
 	github.com/go-openapi/swag v0.19.8 // indirect
+	github.com/go-playground/validator/v10 v10.3.0 // indirect
 	github.com/go-redis/redis v6.15.7+incompatible
 	github.com/go-sql-driver/mysql v1.5.0 // indirect
-	github.com/golang/protobuf v1.3.5 // indirect
+	github.com/golang/protobuf v1.4.2 // indirect
 	github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 // indirect
 	github.com/jinzhu/gorm v1.9.12
+	github.com/json-iterator/go v1.1.10 // indirect
 	github.com/lestrrat/go-envload v0.0.0-20180220120943-6ed08b54a570 // indirect
 	github.com/lestrrat/go-file-rotatelogs v0.0.0-20180223000712-d3151e2a480f
 	github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042 // indirect
@@ -28,7 +30,7 @@ require (
 	github.com/onsi/gomega v1.4.3 // indirect
 	github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
 	github.com/pelletier/go-toml v1.6.0 // indirect
-	github.com/piexlmax/gvaplug v0.0.5
+	github.com/piexlmax/gvaplug v0.0.8
 	github.com/pkg/errors v0.9.1 // indirect
 	github.com/qiniu/api.v7 v7.2.5+incompatible
 	github.com/qiniu/x v7.0.8+incompatible // indirect
@@ -44,8 +46,10 @@ require (
 	github.com/unrolled/secure v1.0.7
 	golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59 // indirect
 	golang.org/x/net v0.0.0-20200320220750-118fecf932d8 // indirect
-	golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd // indirect
+	golang.org/x/sys v0.0.0-20200610111108-226ff32320da // indirect
 	golang.org/x/tools v0.0.0-20200324003944-a576cf524670 // indirect
+	google.golang.org/protobuf v1.24.0 // indirect
 	gopkg.in/ini.v1 v1.55.0 // indirect
+	gopkg.in/yaml.v2 v2.3.0 // indirect
 	qiniupkg.com/x v7.0.8+incompatible // indirect
 )

+ 9 - 11
server/initialize/plug.go

@@ -6,20 +6,18 @@ import (
 )
 
 type Plug interface {
-	InitRouter(*gin.Engine) error
+	InitRouter([2]*gin.RouterGroup) error
 	InitModel(*gorm.DB) error
 }
 
-func InstallPlug(db *gorm.DB, router *gin.Engine, p ...Plug) (err error) {
-	for _, v := range p {
-		err = v.InitModel(db)
-		if err != nil {
-			return err
-		}
-		err = v.InitRouter(router)
-		if err != nil {
-			return err
-		}
+func InstallPlug(db *gorm.DB, router [2]*gin.RouterGroup, p Plug) (err error) {
+	err = p.InitModel(db)
+	if err != nil {
+		return err
+	}
+	err = p.InitRouter(router)
+	if err != nil {
+		return err
 	}
 	return nil
 }

+ 9 - 9
server/model/sys_auto_code.go

@@ -5,17 +5,17 @@ type AutoCodeStruct struct {
 	StructName         string  `json:"structName"`
 	PackageName        string  `json:"packageName"`
 	Abbreviation       string  `json:"abbreviation"`
-	Description		   string `json:"description"`
+	Description        string  `json:"description"`
 	AutoCreateApiToSql bool    `json:"autoCreateApiToSql"`
 	Fields             []Field `json:"fields"`
 }
 
 type Field struct {
-	FieldName  string `json:"fieldName"`
-	FieldDesc  string `json:"fieldDesc"`
-	FieldType  string `json:"fieldType"`
-	FieldJson  string `json:"fieldJson"`
-	Comment    string `json:"comment"`
-	ColumnName string `json:"columnName"`
-	FieldSearchType  string `json:"fieldSearchType"`
-}
+	FieldName       string `json:"fieldName"`
+	FieldDesc       string `json:"fieldDesc"`
+	FieldType       string `json:"fieldType"`
+	FieldJson       string `json:"fieldJson"`
+	Comment         string `json:"comment"`
+	ColumnName      string `json:"columnName"`
+	FieldSearchType string `json:"fieldSearchType"`
+}

+ 0 - 1
server/model/sys_user.go

@@ -15,4 +15,3 @@ type SysUser struct {
 	Authority   SysAuthority `json:"authority" gorm:"ForeignKey:AuthorityId;AssociationForeignKey:AuthorityId;comment:'用户角色'"`
 	AuthorityId string       `json:"authorityId" gorm:"default:888;comment:'用户角色ID'"`
 }
-

+ 5 - 5
server/model/sys_workflow.go

@@ -7,8 +7,8 @@ import (
 // 工作流属性表
 type SysWorkflow struct {
 	gorm.Model
-	WorkflowNickName    string                `json:"workflowNickName" gorm:"comment:'工作流中文名称'"`    // 工作流名称
-	WorkflowName        string                `json:"workflowName" gorm:"comment:'工作流英文名称'"`        // 工作流英文id
+	WorkflowNickName    string                `json:"workflowNickName" gorm:"comment:'工作流中文名称'"`  // 工作流名称
+	WorkflowName        string                `json:"workflowName" gorm:"comment:'工作流英文名称'"`      // 工作流英文id
 	WorkflowDescription string                `json:"workflowDescription" gorm:"comment:'工作流描述'"` // 工作流描述
 	WorkflowStepInfo    []SysWorkflowStepInfo `json:"workflowStep" gorm:"comment:'工作流步骤'"`        // 工作流步骤
 }
@@ -17,9 +17,9 @@ type SysWorkflow struct {
 type SysWorkflowStepInfo struct {
 	gorm.Model
 	SysWorkflowID   uint    `json:"workflowID" gorm:"comment:'所属工作流ID'"`      // 所属工作流ID
-	IsStrat         bool    `json:"isStrat" gorm:"comment:'是否是开始流节点'"`         // 是否是开始流节点
+	IsStrat         bool    `json:"isStrat" gorm:"comment:'是否是开始流节点'"`        // 是否是开始流节点
 	StepName        string  `json:"stepName" gorm:"comment:'工作流节点名称'"`        // 工作流名称
-	StepNo          float64 `json:"stepNo" gorm:"comment:'步骤id (第几步)'"`          // 步骤id (第几步)
+	StepNo          float64 `json:"stepNo" gorm:"comment:'步骤id (第几步)'"`       // 步骤id (第几步)
 	StepAuthorityID string  `json:"stepAuthorityID" gorm:"comment:'操作者级别id'"` // 操作者级别id
-	IsEnd           bool    `json:"isEnd" gorm:"comment:'是否是完结流节点'"`           // 是否是完结流节点
+	IsEnd           bool    `json:"isEnd" gorm:"comment:'是否是完结流节点'"`          // 是否是完结流节点
 }

+ 6 - 6
server/model/sys_workflow_process.go

@@ -5,10 +5,10 @@ import "github.com/jinzhu/gorm"
 // 工作流流转表
 type SysWorkFlowProcess struct {
 	gorm.Model
-	ApplicationID  uint   `json:"applicationID" gorm:"comment:'当前工作流所属申请的ID'"`// 当前工作流所属申请的ID
-	CurrentNode    string `json:"currentNode" gorm:"comment:'当前进度节点'"`// 当前进度节点
-	HistoricalNode string `json:"historicalNode" gorm:"comment:'上一个进度节点'"`// 上一个进度节点
-	CurrentUser    string `json:"currentUser" gorm:"comment:'当前进度操作人'"`// 当前进度操作人
-	HistoricalUser string `json:"historicalUser" gorm:"comment:'上一个进度的操作人'"`// 上一个进度的操作人
-	State          bool   `json:"state" gorm:"comment:'状态 是否是正在进行的状态'"`// 状态 是否是正在进行的状态
+	ApplicationID  uint   `json:"applicationID" gorm:"comment:'当前工作流所属申请的ID'"` // 当前工作流所属申请的ID
+	CurrentNode    string `json:"currentNode" gorm:"comment:'当前进度节点'"`         // 当前进度节点
+	HistoricalNode string `json:"historicalNode" gorm:"comment:'上一个进度节点'"`     // 上一个进度节点
+	CurrentUser    string `json:"currentUser" gorm:"comment:'当前进度操作人'"`        // 当前进度操作人
+	HistoricalUser string `json:"historicalUser" gorm:"comment:'上一个进度的操作人'"`   // 上一个进度的操作人
+	State          bool   `json:"state" gorm:"comment:'状态 是否是正在进行的状态'"`        // 状态 是否是正在进行的状态
 }

+ 2 - 2
server/resource/template/te/service.go.tpl

@@ -61,7 +61,7 @@ func Get{{.StructName}}InfoList(info request.{{.StructName}}Search) (err error,
 	limit := info.PageSize
 	offset := info.PageSize * (info.Page - 1)
     // 创建db
-	db := global.GVA_DB
+	db := global.GVA_DB.Model(&model.{{.StructName}}{})
     var {{.Abbreviation}}s []model.{{.StructName}}
     // 如果有条件搜索 下方会自动创建搜索语句
         {{- range .Fields}}
@@ -89,7 +89,7 @@ func Get{{.StructName}}InfoList(info request.{{.StructName}}Search) (err error,
                 {{- end }}
         {{- end }}
     {{- end }}
-	err = db.Find(&{{.Abbreviation}}s).Count(&total).Error
+	err = db.Count(&total).Error
 	err = db.Limit(limit).Offset(offset).Find(&{{.Abbreviation}}s).Error
 	return err, {{.Abbreviation}}s, total
 }

+ 2 - 2
server/service/exa_customer.go

@@ -61,7 +61,7 @@ func GetExaCustomer(id uint) (err error, customer model.ExaCustomer) {
 func GetCustomerInfoList(sysUserAuthorityID string, info request.PageInfo) (err error, list interface{}, total int) {
 	limit := info.PageSize
 	offset := info.PageSize * (info.Page - 1)
-	db := global.GVA_DB
+	db := global.GVA_DB.Model(&model.SysAuthority{})
 	var a model.SysAuthority
 	a.AuthorityId = sysUserAuthorityID
 	err, auth := GetAuthorityInfo(a)
@@ -70,7 +70,7 @@ func GetCustomerInfoList(sysUserAuthorityID string, info request.PageInfo) (err
 		dataId = append(dataId, v.AuthorityId)
 	}
 	var CustomerList []model.ExaCustomer
-	err = db.Where("sys_user_authority_id in (?)", dataId).Find(&CustomerList).Count(&total).Error
+	err = db.Where("sys_user_authority_id in (?)", dataId).Count(&total).Error
 	if err != nil {
 		return err, CustomerList, total
 	} else {

+ 2 - 2
server/service/sys_api.go

@@ -49,7 +49,7 @@ func DeleteApi(api model.SysApi) (err error) {
 func GetAPIInfoList(api model.SysApi, info request.PageInfo, order string, desc bool) (err error, list interface{}, total int) {
 	limit := info.PageSize
 	offset := info.PageSize * (info.Page - 1)
-	db := global.GVA_DB
+	db := global.GVA_DB.Model(&model.SysApi{})
 	var apiList []model.SysApi
 
 	if api.Path != "" {
@@ -68,7 +68,7 @@ func GetAPIInfoList(api model.SysApi, info request.PageInfo, order string, desc
 		db = db.Where("api_group = ?", api.ApiGroup)
 	}
 
-	err = db.Find(&apiList).Count(&total).Error
+	err = db.Count(&total).Error
 
 	if err != nil {
 		return err, apiList, total

+ 2 - 2
server/service/sys_user.go

@@ -73,9 +73,9 @@ func ChangePassword(u *model.SysUser, newPassword string) (err error, userInter
 func GetUserInfoList(info request.PageInfo) (err error, list interface{}, total int) {
 	limit := info.PageSize
 	offset := info.PageSize * (info.Page - 1)
-	db := global.GVA_DB
+	db := global.GVA_DB.Model(&model.SysUser{})
 	var userList []model.SysUser
-	err = db.Find(&userList).Count(&total).Error
+	err = db.Count(&total).Error
 	err = db.Limit(limit).Offset(offset).Preload("Authority").Find(&userList).Error
 	return err, userList, total
 }

+ 4 - 22
server/utils/directory.go

@@ -1,8 +1,8 @@
 package utils
 
 import (
+	"gin-vue-admin/global"
 	"os"
-	"path/filepath"
 )
 
 // @title    PathExists
@@ -32,33 +32,15 @@ func CreateDir(dirs ...string) (err error) {
 	for _, v := range dirs {
 		exist, err := PathExists(v)
 		if err != nil {
-			// log.L.Info(fmt.Sprintf("get dir error![%v]\n", err))
 			return err
 		}
-		if exist {
-			// log.L.Info(fmt.Sprintf("has dir![%v]\n"+_dir))
-		} else {
-			// log.L.Info(fmt.Sprintf("no dir![%v]\n"+_dir))
-			// 创建文件夹
+		if !exist {
+			global.GVA_LOG.Debug("create directory ", v)
 			err = os.MkdirAll(v, os.ModePerm)
 			if err != nil {
-				// log.L.Error(fmt.Sprintf("mkdir error![%v]\n",err))
-			} else {
-				// log.L.Info("mkdir success!\n")
+				global.GVA_LOG.Error("create directory", v, " error:", err)
 			}
 		}
 	}
 	return err
 }
-
-// @title cwd
-// @description 获取当前工作目录
-// @return string
-
-func CWD() string {
-	path, err := os.Executable()
-	if err != nil {
-		return ""
-	}
-	return filepath.Dir(path)
-}

+ 123 - 94
web/src/view/superAdmin/authority/authority.vue

@@ -16,29 +16,48 @@
       <el-table-column fixed="right" label="操作" width="460">
         <template slot-scope="scope">
           <el-button @click="opdendrawer(scope.row)" size="small" type="primary">设置权限</el-button>
-          <el-button @click="addAuthority(scope.row.authorityId)" size="small" type="primary" icon="el-icon-plus">新增子角色</el-button>
-          <el-button @click="copyAuthority(scope.row)" size="small" type="primary" icon="el-icon-copy-document" >拷贝</el-button>
-          <el-button @click="editAuthority(scope.row)" size="small" type="primary" icon="el-icon-edit">编辑</el-button>
-          <el-button @click="deleteAuth(scope.row)" size="small" type="danger" icon="el-icon-delete">删除</el-button>
-
+          <el-button
+            @click="addAuthority(scope.row.authorityId)"
+            icon="el-icon-plus"
+            size="small"
+            type="primary"
+          >新增子角色</el-button>
+          <el-button
+            @click="copyAuthority(scope.row)"
+            icon="el-icon-copy-document"
+            size="small"
+            type="primary"
+          >拷贝</el-button>
+          <el-button
+            @click="editAuthority(scope.row)"
+            icon="el-icon-edit"
+            size="small"
+            type="primary"
+          >编辑</el-button>
+          <el-button
+            @click="deleteAuth(scope.row)"
+            icon="el-icon-delete"
+            size="small"
+            type="danger"
+          >删除</el-button>
         </template>
       </el-table-column>
     </el-table>
     <!-- 新增角色弹窗 -->
-    <el-dialog :visible.sync="dialogFormVisible" :title="dialogTitle">
+    <el-dialog :title="dialogTitle" :visible.sync="dialogFormVisible">
       <el-form :model="form" :rules="rules" ref="authorityForm">
-        <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 label="父级角色" prop="parentId">
+          <el-cascader
+            :disabled="dialogType=='add'"
+            :options="AuthorityOption"
+            :props="{ checkStrictly: true,label:'authorityName',value:'authorityId',disabled:'disabled',emitPath:false}"
+            :show-all-levels="false"
+            filterable
+            v-model="form.parentId"
+          ></el-cascader>
         </el-form-item>
         <el-form-item label="角色ID" prop="authorityId">
-          <el-input autocomplete="off" :disabled="dialogType=='edit'" v-model="form.authorityId"></el-input>
+          <el-input :disabled="dialogType=='edit'" autocomplete="off" 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>
@@ -51,15 +70,15 @@
     </el-dialog>
 
     <el-drawer :visible.sync="drawer" :with-header="false" size="40%" title="角色配置" v-if="drawer">
-      <el-tabs class="role-box" type="border-card" :before-leave="autoEnter">
+      <el-tabs :before-leave="autoEnter" class="role-box" type="border-card">
         <el-tab-pane label="角色菜单">
-          <Menus :row="activeRow" ref="menus"/>
+          <Menus :row="activeRow" ref="menus" />
         </el-tab-pane>
         <el-tab-pane label="角色api">
-          <apis :row="activeRow"  ref="apis"/>
+          <apis :row="activeRow" ref="apis" />
         </el-tab-pane>
         <el-tab-pane label="资源权限">
-          <Datas :authority="tableData" :row="activeRow"  ref="datas"/>
+          <Datas :authority="tableData" :row="activeRow" ref="datas" />
         </el-tab-pane>
       </el-tabs>
     </el-drawer>
@@ -74,7 +93,7 @@ import {
   deleteAuthority,
   createAuthority,
   updateAuthority,
-  copyAuthority 
+  copyAuthority
 } from '@/api/authority'
 
 import Menus from '@/view/superAdmin/authority/components/menus'
@@ -87,16 +106,18 @@ export default {
   mixins: [infoList],
   data() {
     return {
-      AuthorityOption:[{
-          authorityId:"0",
-          authorityName:"根角色"
-        }],
+      AuthorityOption: [
+        {
+          authorityId: '0',
+          authorityName: '根角色'
+        }
+      ],
       listApi: getAuthorityList,
       drawer: false,
-      dialogType:"add",
+      dialogType: 'add',
       activeRow: {},
       activeUserId: 0,
-      dialogTitle:"新增角色",
+      dialogTitle: '新增角色',
       dialogFormVisible: false,
       apiDialogFlag: false,
       copyForm: {},
@@ -124,10 +145,10 @@ export default {
     Datas
   },
   methods: {
-    autoEnter(activeName, oldActiveName){
-      const paneArr = ["menus","apis","datas"]
-      if(oldActiveName){
-        if(this.$refs[paneArr[oldActiveName]].needConfirm){
+    autoEnter(activeName, oldActiveName) {
+      const paneArr = ['menus', 'apis', 'datas']
+      if (oldActiveName) {
+        if (this.$refs[paneArr[oldActiveName]].needConfirm) {
           this.$refs[paneArr[oldActiveName]].enterAndNext()
           this.$refs[paneArr[oldActiveName]].needConfirm = false
         }
@@ -136,13 +157,13 @@ export default {
     // 拷贝角色
     copyAuthority(row) {
       this.setOptions()
-      this.dialogTitle = "拷贝角色"
-      this.dialogType = "copy"
-      for(let k in this.form) {
+      this.dialogTitle = '拷贝角色'
+      this.dialogType = 'copy'
+      for (let k in this.form) {
         this.form[k] = row[k]
       }
       this.copyForm = row
-      this.dialogFormVisible = true;
+      this.dialogFormVisible = true
     },
     opdendrawer(row) {
       this.drawer = true
@@ -174,8 +195,10 @@ export default {
     },
     // 初始化表单
     initForm() {
-      this.$refs.authorityForm.resetFields()
-      this.form =  {
+      if (this.$refs.authorityForm) {
+        this.$refs.authorityForm.resetFields()
+      }
+      this.form = {
         authorityId: '',
         authorityName: '',
         parentId: '0'
@@ -212,7 +235,7 @@ export default {
                   this.closeDialog()
                 }
               }
-              break;
+              break
             case 'edit':
               {
                 const res = await updateAuthority(this.form)
@@ -225,82 +248,88 @@ export default {
                   this.closeDialog()
                 }
               }
-              break;
-              case 'copy': {
-                const data = {
-                  "authority": {
-                      "authorityId": "string",
-                      "authorityName": "string",
-                      "datauthorityId": [],
-                      "parentId": "string",
-                  },
-                      "oldAuthorityId": 0
-                }
-                data.authority.authorityId = this.form.authorityId
-                data.authority.authorityName = this.form.authorityName
-                data.authority.parentId = this.form.parentId
-                data.authority.dataAuthorityId = this. copyForm.dataAuthorityId
-                data.oldAuthorityId = this.copyForm.authorityId
-                const res = await copyAuthority(data)
-                if(res.code == 0) {
-                  this.$message({
-                    type: 'success',
-                    message: '复制成功!'
-                  })
-                  this.getTableData()
-                }
+              break
+            case 'copy': {
+              const data = {
+                authority: {
+                  authorityId: 'string',
+                  authorityName: 'string',
+                  datauthorityId: [],
+                  parentId: 'string'
+                },
+                oldAuthorityId: 0
+              }
+              data.authority.authorityId = this.form.authorityId
+              data.authority.authorityName = this.form.authorityName
+              data.authority.parentId = this.form.parentId
+              data.authority.dataAuthorityId = this.copyForm.dataAuthorityId
+              data.oldAuthorityId = this.copyForm.authorityId
+              const res = await copyAuthority(data)
+              if (res.code == 0) {
+                this.$message({
+                  type: 'success',
+                  message: '复制成功!'
+                })
+                this.getTableData()
               }
+            }
           }
-          
+
           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&&item.children.length){
-          const option = {
-            authorityId:item.authorityId,
-            authorityName:item.authorityName,
-            disabled:disabled||item.authorityId == this.form.authorityId,
-            children:[]
+    setOptions() {
+      this.AuthorityOption = [
+        {
+          authorityId: '0',
+          authorityName: '根角色'
         }
-          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,
+      ]
+      this.setAuthorityOptions(this.tableData, this.AuthorityOption, false)
+    },
+    setAuthorityOptions(AuthorityData, optionsData, disabled) {
+      AuthorityData &&
+        AuthorityData.map(item => {
+          if (item.children && 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)
           }
-          optionsData.push(option)
-        }
-      })
+        })
     },
     // 增加角色
     addAuthority(parentId) {
       this.initForm()
-      this.dialogTitle = "新增角色"
-      this.dialogType = "add"
+      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.dialogTitle = '编辑角色'
+      this.dialogType = 'edit'
+      for (let key in this.form) {
         this.form[key] = row[key]
       }
       this.setOptions()