From 4067085d2bd074fbe697a678e9067fd73e5530ae Mon Sep 17 00:00:00 2001 From: Viviman Date: Tue, 6 Dec 2022 16:53:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +- conf/app.conf | 5 +- controllers/admin/DeptController.go | 41 +++-- controllers/admin/DictController.go | 32 ++-- controllers/admin/DictDetailController.go | 32 ++-- controllers/admin/JobController.go | 39 ++-- controllers/admin/LoginController.go | 28 +-- controllers/admin/MenuController.go | 47 +++-- controllers/admin/RoleController.go | 54 ++++-- controllers/admin/ToolsController.go | 4 +- controllers/admin/UserController.go | 87 ++++++--- controllers/vivib/LiCaiController.go | 135 ++++++++++++++ main.go | 1 - models/SysDept.go | 4 +- redis/pool.go | 9 +- routers/router.go | 11 +- sql/{yshop_go.sql => viviman_go.sql} | 0 untils/tools.go | 8 +- web/.eslintignore | 3 +- web/src/api/vivib/licai.js | 50 ++++++ web/src/layout/components/AppMain.vue | 2 +- web/src/layout/components/Navbar.vue | 2 +- web/src/layout/components/Settings/index.vue | 2 +- web/src/layout/components/Sidebar/Logo.vue | 2 +- .../layout/components/TagsView/ScrollPane.vue | 2 +- web/src/layout/components/TagsView/index.vue | 2 +- web/src/layout/index.vue | 2 +- web/src/views/components/icons/index.vue | 2 +- web/src/views/dashboard/OrderCount.vue | 2 +- web/src/views/features/401.vue | 2 +- web/src/views/vivib/licai/index.vue | 94 ++++++++++ web/src/views/vivib/licai/licaiJs.js | 170 ++++++++++++++++++ 32 files changed, 732 insertions(+), 145 deletions(-) create mode 100644 controllers/vivib/LiCaiController.go rename sql/{yshop_go.sql => viviman_go.sql} (100%) create mode 100644 web/src/api/vivib/licai.js create mode 100644 web/src/views/vivib/licai/index.vue create mode 100644 web/src/views/vivib/licai/licaiJs.js diff --git a/.gitignore b/.gitignore index c0d40f2..df39b11 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ yshop.tar.gz /desc/ /web/node_modules/ go.sum -lastupdate.tmp \ No newline at end of file +lastupdate.tmp +/static/upload/ diff --git a/conf/app.conf b/conf/app.conf index 94cd620..d67af79 100644 --- a/conf/app.conf +++ b/conf/app.conf @@ -11,17 +11,18 @@ ignore_urls = "/admin/auth/login,/admin/auth/captcha" [dev] #数据库配置 -mysqluser = "beego" +mysqluser = "hy_qggwy" mysqlpass = "Asdfghjklm123." mysqlhost = "nas.viviman.top" mysqlport = 35017 -mysqldb = "beego_demo01" +mysqldb = "viviman" db_max_idle_conn = 30 db_max_open_open = 100 maxmemory = 1<<22 #redis redis_host = nas.viviman.top:20017 +redis_db = 2 redis_pwd = #日志等级 debug diff --git a/controllers/admin/DeptController.go b/controllers/admin/DeptController.go index 2f57f78..86ab9f1 100644 --- a/controllers/admin/DeptController.go +++ b/controllers/admin/DeptController.go @@ -9,7 +9,7 @@ import ( "viviman.top/vo" ) -// 部门api +// DeptController 部门api type DeptController struct { controllers.BaseController } @@ -21,7 +21,7 @@ func (c *DeptController) URLMapping() { c.Mapping("Delete", c.Delete) } -// @Title 获取部门列表 +// GetAll @Title获取部门列表 // @Description 获取部门列表 // @Success 200 {object} controllers.Result // @router / [get] @@ -30,17 +30,22 @@ func (c *DeptController) GetAll() { enabled, _ := c.GetInt8("enabled", -1) list := models.GetAllDepts(name, enabled) c.Data["json"] = controllers.SuccessData(vo.ResultList{Content: list, TotalElements: 0}) - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 添加部门 +// Post @Title添加部门 // @Description 添加部门 // @Success 200 {object} controllers.Result // @router / [post] func (c *DeptController) Post() { var model models.SysDept valid := validation.Validation{} - json.Unmarshal(c.Ctx.Input.RequestBody, &model) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &model) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } b, _ := valid.Valid(&model) if !b { for _, err := range valid.Errors { @@ -52,17 +57,22 @@ func (c *DeptController) Post() { c.Data["json"] = controllers.ErrMsg(e.Error()) } c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 修改部门 +// Put @Title修改部门 // @Description 修改部门 // @Success 200 {object} controllers.Result // @router / [put] func (c *DeptController) Put() { var model models.SysDept valid := validation.Validation{} - json.Unmarshal(c.Ctx.Input.RequestBody, &model) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &model) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } b, _ := valid.Valid(&model) if !b { for _, err := range valid.Errors { @@ -74,21 +84,26 @@ func (c *DeptController) Put() { c.Data["json"] = controllers.ErrMsg(e.Error()) } c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 删除部门 +// Delete @Title 删除部门 // @Description 删除部门 // @Success 200 {object} controllers.Result // @router / [delete] func (c *DeptController) Delete() { var ids []int64 - json.Unmarshal(c.Ctx.Input.RequestBody, &ids) - logs.Info(ids) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &ids) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } + logs.Info("获取对象:{}", ids) e := models.DelByDept(ids) if e != nil { c.Data["json"] = controllers.ErrMsg(e.Error()) } c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } diff --git a/controllers/admin/DictController.go b/controllers/admin/DictController.go index d571e87..0caf3c5 100644 --- a/controllers/admin/DictController.go +++ b/controllers/admin/DictController.go @@ -8,7 +8,7 @@ import ( "viviman.top/vo" ) -// 字典api +// DictController 字典api type DictController struct { controllers.BaseController } @@ -21,24 +21,29 @@ func (c *DictController) URLMapping() { //c.Mapping("Delete", c.Delete) } -// @Title 获取字典列表 +// GetAll @Title获取字典列表 // @Description 获取字典列表 // @Success 200 {object} controllers.Result // @router / [get] func (c *DictController) GetAll() { total, list := models.GetAllDict(c.GetParams()) c.Data["json"] = controllers.SuccessData(vo.ResultList{Content: list, TotalElements: total}) - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 添加字典 +// Post @Title添加字典 // @Description 添加字典 // @Success 200 {object} controllers.Result // @router / [post] func (c *DictController) Post() { var dictModel models.SysDict valid := validation.Validation{} - json.Unmarshal(c.Ctx.Input.RequestBody, &dictModel) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &dictModel) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } b, _ := valid.Valid(&dictModel) if !b { for _, err := range valid.Errors { @@ -50,17 +55,22 @@ func (c *DictController) Post() { c.Data["json"] = controllers.ErrMsg(e.Error()) } c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 修改字典 +// Put @Title修改字典 // @Description 修改字典 // @Success 200 {object} controllers.Result // @router / [put] func (c *DictController) Put() { var dictModel models.SysDict valid := validation.Validation{} - json.Unmarshal(c.Ctx.Input.RequestBody, &dictModel) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &dictModel) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } b, _ := valid.Valid(&dictModel) if !b { for _, err := range valid.Errors { @@ -72,10 +82,10 @@ func (c *DictController) Put() { c.Data["json"] = controllers.ErrMsg(e.Error()) } c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 删除字典 +// Delete @Title删除字典 // @Description 删除字典 // @Success 200 {object} controllers.Result // @router /:id [delete] @@ -86,5 +96,5 @@ func (c *DictController) Delete() { c.Data["json"] = controllers.ErrMsg(e.Error()) } c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } diff --git a/controllers/admin/DictDetailController.go b/controllers/admin/DictDetailController.go index d3ca366..f05e1e2 100644 --- a/controllers/admin/DictDetailController.go +++ b/controllers/admin/DictDetailController.go @@ -9,7 +9,7 @@ import ( "viviman.top/vo" ) -// 字典详情api +// DictDetailController 字典详情api type DictDetailController struct { controllers.BaseController } @@ -21,7 +21,7 @@ func (c *DictDetailController) URLMapping() { c.Mapping("Delete", c.Delete) } -// @Title 获取字典详情列表 +// GetAll @Title获取字典详情列表 // @Description 获取字典详情列表 // @Success 200 {object} controllers.Result // @router / [get] @@ -30,17 +30,22 @@ func (c *DictDetailController) GetAll() { dictName := c.GetString("dictName") total, list := models.GetAllDictDetail(c.GetParams(), dictId, dictName) c.Data["json"] = controllers.SuccessData(vo.ResultList{Content: list, TotalElements: total}) - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 添加字典详情 +// Post @Title添加字典详情 // @Description 添加字典详情 // @Success 200 {object} controllers.Result // @router / [post] func (c *DictDetailController) Post() { var model models.SysDictDetail valid := validation.Validation{} - json.Unmarshal(c.Ctx.Input.RequestBody, &model) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &model) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } logs.Info(model) b, _ := valid.Valid(&model) if !b { @@ -53,17 +58,22 @@ func (c *DictDetailController) Post() { c.Data["json"] = controllers.ErrMsg(e.Error()) } c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 修改字典详情 +// Put @Title修改字典详情 // @Description 修改字典详情 // @Success 200 {object} controllers.Result // @router / [put] func (c *DictDetailController) Put() { var model models.SysDictDetail valid := validation.Validation{} - json.Unmarshal(c.Ctx.Input.RequestBody, &model) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &model) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } b, _ := valid.Valid(&model) if !b { for _, err := range valid.Errors { @@ -75,10 +85,10 @@ func (c *DictDetailController) Put() { c.Data["json"] = controllers.ErrMsg(e.Error()) } c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 删除字典详情 +// Delete @Title删除字典详情 // @Description 删除字典详情 // @Success 200 {object} controllers.Result // @router /:id [delete] @@ -89,5 +99,5 @@ func (c *DictDetailController) Delete() { c.Data["json"] = controllers.ErrMsg(e.Error()) } c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } diff --git a/controllers/admin/JobController.go b/controllers/admin/JobController.go index 1c91665..eea52e9 100644 --- a/controllers/admin/JobController.go +++ b/controllers/admin/JobController.go @@ -9,7 +9,7 @@ import ( "viviman.top/vo" ) -// 岗位api +// JobController 岗位api type JobController struct { controllers.BaseController } @@ -21,7 +21,7 @@ func (c *JobController) URLMapping() { c.Mapping("Delete", c.Delete) } -// @Title 岗位列表 +// GetAll @Title 岗位列表 // @Description 岗位列表 // @Success 200 {object} controllers.Result // @router / [get] @@ -29,17 +29,22 @@ func (c *JobController) GetAll() { enabled, _ := c.GetInt64("enabled", -1) total, list := models.GetAllJob(c.GetParams(), enabled) c.Data["json"] = controllers.SuccessData(vo.ResultList{Content: list, TotalElements: total}) - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 岗位添加 +// Post @Title 岗位添加 // @Description 岗位添加 // @Success 200 {object} controllers.Result // @router / [post] func (c *JobController) Post() { var model models.SysJob valid := validation.Validation{} - json.Unmarshal(c.Ctx.Input.RequestBody, &model) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &model) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } b, _ := valid.Valid(&model) if !b { for _, err := range valid.Errors { @@ -51,17 +56,22 @@ func (c *JobController) Post() { c.Data["json"] = controllers.ErrMsg(e.Error()) } c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 岗位修改 +// Put @Title 岗位修改 // @Description 岗位修改 // @Success 200 {object} controllers.Result // @router / [put] func (c *JobController) Put() { var model models.SysJob valid := validation.Validation{} - json.Unmarshal(c.Ctx.Input.RequestBody, &model) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &model) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } b, _ := valid.Valid(&model) if !b { for _, err := range valid.Errors { @@ -73,21 +83,26 @@ func (c *JobController) Put() { c.Data["json"] = controllers.ErrMsg(e.Error()) } c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 岗位删除 +// Delete @Title 岗位删除 // @Description 岗位删除 // @Success 200 {object} controllers.Result // @router / [delete] func (c *JobController) Delete() { var ids []int64 - json.Unmarshal(c.Ctx.Input.RequestBody, &ids) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &ids) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } logs.Info(ids) e := models.DelByJob(ids) if e != nil { c.Data["json"] = controllers.ErrMsg(e.Error()) } c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } diff --git a/controllers/admin/LoginController.go b/controllers/admin/LoginController.go index 926de8c..5db1c3f 100644 --- a/controllers/admin/LoginController.go +++ b/controllers/admin/LoginController.go @@ -15,7 +15,7 @@ import ( "viviman.top/vo" ) -// 登录api +// LoginController 登录api type LoginController struct { controllers.BaseController } @@ -36,7 +36,7 @@ func (c *LoginController) URLMapping() { c.Mapping("Logout", c.Logout) } -// @Title 登录 +// Login @Title 登录验证 // @Description 登录 // @Success 200 {object} controllers.Result // @router /login [post] @@ -52,7 +52,7 @@ func (c *LoginController) Login() { //校验验证码 if !store.Verify(authUser.Id, authUser.Code, true) { c.Data["json"] = controllers.ErrMsg("验证码不对") - c.ServeJSON() + _ = c.ServeJSON() } if e != nil { c.Data["json"] = controllers.ErrMsg("用户不存在") @@ -72,19 +72,19 @@ func (c *LoginController) Login() { c.Data["json"] = controllers.ErrMsg(err.Error()) } - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 获取用户信息 +// Info @Title获取用户信息 // @Description 获取用户信息 // @Success 200 {object} controllers.Result // @router /info [get] func (c *LoginController) Info() { c.Data["json"] = controllers.SuccessData(jwt.GetAdminDetailUser(c.Ctx.Input)) - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 退出登录 +// Logout @Title退出登录 // @Description 退出登录 // @Success 200 {object} controllers.Result // @router /logout [delete] @@ -95,18 +95,18 @@ func (c *LoginController) Logout() { } else { c.Data["json"] = controllers.SuccessData("退出成功") } - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 获取验证码 +// Captcha @Title 获取验证码 // @Description 获取验证码 // @router /captcha [get] func (c *LoginController) Captcha() { GenerateCaptcha(c.Ctx) - c.ServeJSON() + _ = c.ServeJSON() } -// 生成图形化验证码 ctx *context.Context +// GenerateCaptcha 生成图形化验证码 ctx *context.Context func GenerateCaptcha(ctx *context.Context) { var driver base64Captcha.Driver var driverString base64Captcha.DriverMath @@ -140,5 +140,9 @@ func GenerateCaptcha(ctx *context.Context) { Base64Blob: b64s, } - ctx.Output.JSON(controllers.SuccessData(captchaResult), true, true) + err = ctx.Output.JSON(controllers.SuccessData(captchaResult), true, true) + if err != nil { + logs.Error("输出时,发生异常!") + return + } } diff --git a/controllers/admin/MenuController.go b/controllers/admin/MenuController.go index 4f03a6f..d1d51c7 100644 --- a/controllers/admin/MenuController.go +++ b/controllers/admin/MenuController.go @@ -9,7 +9,7 @@ import ( "viviman.top/vo" ) -// 菜单api +// MenuController 菜单api type MenuController struct { controllers.BaseController } @@ -22,7 +22,7 @@ func (c *MenuController) URLMapping() { c.Mapping("Delete", c.Delete) } -// @Title 菜单列表 +// GetAll @Title 菜单列表 // @Description 菜单列表 // @Success 200 {object} controllers.Result // @router / [get] @@ -30,17 +30,22 @@ func (c *MenuController) GetAll() { name := c.GetString("blurry") menus := models.GetAllMenus(name) c.Data["json"] = controllers.SuccessData(vo.ResultList{Content: menus, TotalElements: 0}) - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 菜单添加 +// Post @Title 菜单添加 // @Description 菜单添加 // @Success 200 {object} controllers.Result // @router / [post] func (c *MenuController) Post() { var model models.SysMenu valid := validation.Validation{} - json.Unmarshal(c.Ctx.Input.RequestBody, &model) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &model) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } b, _ := valid.Valid(&model) if !b { for _, err := range valid.Errors { @@ -52,17 +57,22 @@ func (c *MenuController) Post() { c.Data["json"] = controllers.ErrMsg(e.Error()) } c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 菜单修改 +// Put @Title 菜单修改 // @Description 菜单修改 // @Success 200 {object} controllers.Result // @router / [put] func (c *MenuController) Put() { var model models.SysMenu valid := validation.Validation{} - json.Unmarshal(c.Ctx.Input.RequestBody, &model) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &model) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } b, _ := valid.Valid(&model) if !b { for _, err := range valid.Errors { @@ -74,25 +84,30 @@ func (c *MenuController) Put() { c.Data["json"] = controllers.ErrMsg(e.Error()) } c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 菜单删除 +// Delete @Title 菜单删除 // @Description 菜单删除 // @Success 200 {object} controllers.Result // @router / [delete] func (c *MenuController) Delete() { var ids []int64 - json.Unmarshal(c.Ctx.Input.RequestBody, &ids) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &ids) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } e := models.DelByMenu(ids) if e != nil { c.Data["json"] = controllers.ErrMsg(e.Error()) } c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 菜单构建 +// Build @Title 菜单构建 // @Description 菜单构建 // @Success 200 {object} controllers.Result // @router /build [get] @@ -100,15 +115,15 @@ func (c *MenuController) Build() { uid, _ := jwt.GetAdminUserId(c.Ctx.Input) menus := models.BuildMenus(uid) c.Data["json"] = controllers.SuccessData(menus) - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 菜单树形 +// GetTree @Title 菜单树形 // @Description 菜单树形 // @Success 200 {object} controllers.Result // @router /tree [get] func (c *MenuController) GetTree() { menus := models.GetAllMenus("") c.Data["json"] = controllers.SuccessData(menus) - c.ServeJSON() + _ = c.ServeJSON() } diff --git a/controllers/admin/RoleController.go b/controllers/admin/RoleController.go index 6d0fa7b..5736e9e 100644 --- a/controllers/admin/RoleController.go +++ b/controllers/admin/RoleController.go @@ -11,7 +11,7 @@ import ( "viviman.top/vo" ) -// 角色 API +// RoleController 角色 API type RoleController struct { controllers.BaseController } @@ -23,7 +23,7 @@ func (c *RoleController) URLMapping() { c.Mapping("Delete", c.Delete) } -// @Title 获取单个角色 +// GetOne @Title 获取单个角色 // @Description 获取单个角色 // @Param id path int true "角色ID" // @Success 200 {object} models.Role @@ -33,27 +33,32 @@ func (c *RoleController) GetOne() { id64, _ := strconv.ParseInt(id, 10, 64) role := models.GetOneRole(id64) c.Data["json"] = controllers.SuccessData(role) - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 角色列表 +// GetAll @Title 角色列表 // @Description 角色列表 // @Success 200 {object} controllers.Result // @router / [get] func (c *RoleController) GetAll() { total, list := models.GetAllRole(c.GetParams()) c.Data["json"] = controllers.SuccessData(vo.ResultList{Content: list, TotalElements: total}) - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 角色添加 +// Post @Title 角色添加 // @Description 角色添加 // @Success 200 {object} controllers.Result // @router / [post] func (c *RoleController) Post() { var model models.SysRole valid := validation.Validation{} - json.Unmarshal(c.Ctx.Input.RequestBody, &model) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &model) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } b, _ := valid.Valid(&model) if !b { for _, err := range valid.Errors { @@ -65,14 +70,19 @@ func (c *RoleController) Post() { c.Data["json"] = controllers.ErrMsg(e.Error()) } c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } -// @router / [put] +// Put @router / [put] func (c *RoleController) Put() { var model models.SysRole valid := validation.Validation{} - json.Unmarshal(c.Ctx.Input.RequestBody, &model) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &model) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } b, _ := valid.Valid(&model) if !b { for _, err := range valid.Errors { @@ -84,33 +94,43 @@ func (c *RoleController) Put() { c.Data["json"] = controllers.ErrMsg(e.Error()) } c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 角色删除 +// Delete @Title 角色删除 // @Description 角色删除 // @Success 200 {object} controllers.Result // @router / [delete] func (c *RoleController) Delete() { var ids []int64 - json.Unmarshal(c.Ctx.Input.RequestBody, &ids) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &ids) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } logs.Info(ids) e := models.DelByRole(ids) if e != nil { c.Data["json"] = controllers.ErrMsg(e.Error()) } c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 角色菜单更新 +// Menu @Title 角色菜单更新 // @Description 角色菜单更新 // @Success 200 {object} controllers.Result // @router /menu [put] func (c *RoleController) Menu() { var model dto.RoleMenu valid := validation.Validation{} - json.Unmarshal(c.Ctx.Input.RequestBody, &model) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &model) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } logs.Info("=======menu======") logs.Info(model) b, _ := valid.Valid(&model) @@ -121,5 +141,5 @@ func (c *RoleController) Menu() { } models.BatchRoleMenuAdd(model) c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } diff --git a/controllers/admin/ToolsController.go b/controllers/admin/ToolsController.go index d9fea61..e512984 100644 --- a/controllers/admin/ToolsController.go +++ b/controllers/admin/ToolsController.go @@ -8,9 +8,9 @@ type ToolsController struct { controllers.BaseController } -// @router / [post] +// Post @router / [post] func (c *ToolsController) Post() { c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } diff --git a/controllers/admin/UserController.go b/controllers/admin/UserController.go index e68bfab..7475986 100644 --- a/controllers/admin/UserController.go +++ b/controllers/admin/UserController.go @@ -13,7 +13,7 @@ import ( "viviman.top/vo" ) -// 用户 API +// UserController 用户 API type UserController struct { controllers.BaseController } @@ -25,7 +25,7 @@ func (c *UserController) URLMapping() { c.Mapping("Delete", c.Delete) } -// @Title 用户列表 +// GetAll @Title 用户列表 // @Description 用户列表 // @Success 200 {object} controllers.Result // @router / [get] @@ -34,17 +34,22 @@ func (c *UserController) GetAll() { enabled, _ := c.GetInt64("enabled", -1) total, list := models.GetAllUser(c.GetParams(), deptId, enabled) c.Data["json"] = controllers.SuccessData(vo.ResultList{Content: list, TotalElements: total}) - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 用户添加 +// Post @Title 用户添加 // @Description 用户添加 // @Success 200 {object} controllers.Result // @router / [post] func (c *UserController) Post() { var model models.SysUser valid := validation.Validation{} - json.Unmarshal(c.Ctx.Input.RequestBody, &model) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &model) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } b, _ := valid.Valid(&model) if !b { for _, err := range valid.Errors { @@ -56,17 +61,22 @@ func (c *UserController) Post() { c.Data["json"] = controllers.ErrMsg(e.Error()) } c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 用户编辑 +// Put @Title 用户编辑 // @Description 用户编辑 // @Success 200 {object} controllers.Result // @router / [put] func (c *UserController) Put() { var model models.SysUser valid := validation.Validation{} - json.Unmarshal(c.Ctx.Input.RequestBody, &model) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &model) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } logs.Info("======start======") logs.Info(model) b, _ := valid.Valid(&model) @@ -80,25 +90,30 @@ func (c *UserController) Put() { c.Data["json"] = controllers.ErrMsg(e.Error()) } c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 用户删除 +// Delete @Title 用户删除 // @Description 用户删除 // @Success 200 {object} controllers.Result // @router / [delete] func (c *UserController) Delete() { var ids []int64 - json.Unmarshal(c.Ctx.Input.RequestBody, &ids) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &ids) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } e := models.DelByUser(ids) if e != nil { c.Data["json"] = controllers.ErrMsg(e.Error()) } c.Data["json"] = controllers.SuccessData("操作成功") - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 用户上传图像 +// Avatar @Title 用户上传图像 // @Description 用户上传图像 // @Success 200 {object} controllers.Result // @router /updateAvatar [post] @@ -122,20 +137,29 @@ func (c *UserController) Avatar() { c.Data["json"] = controllers.ErrMsg("非法操作") } else { user.Avatar = avatarUrl - models.UpdateCurrentUser(user) + err := models.UpdateCurrentUser(user) + if err != nil { + logs.Error("更新时,发生异常!") + return + } c.Data["json"] = controllers.SuccessData("ok") } - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 用户修改密码 +// Pass @Title 用户修改密码 // @Description 用户修改密码 // @Success 200 {object} controllers.Result // @router /updatePass [post] func (c *UserController) Pass() { var model dto.UserPass valid := validation.Validation{} - json.Unmarshal(c.Ctx.Input.RequestBody, &model) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &model) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } b, _ := valid.Valid(&model) if !b { for _, err := range valid.Errors { @@ -150,29 +174,38 @@ func (c *UserController) Pass() { } else { if !untils.ComparePwd(user.Password, []byte(model.OldPass)) { c.Data["json"] = controllers.ErrMsg("旧密码错误密码错误") - c.ServeJSON() + _ = c.ServeJSON() } user.Password = untils.HashAndSalt([]byte(model.NewPass)) - models.UpdateCurrentUser(user) + err := models.UpdateCurrentUser(user) + if err != nil { + logs.Error("更新时,发生异常!") + return + } c.Data["json"] = controllers.SuccessData("ok") } - c.ServeJSON() + _ = c.ServeJSON() } -// @Title 用户修改个人信息 +// Center @Title 用户修改个人信息 // @Description 用户修改个人信息 // @Success 200 {object} controllers.Result // @router /center [put] func (c *UserController) Center() { var model dto.UserPost valid := validation.Validation{} - json.Unmarshal(c.Ctx.Input.RequestBody, &model) + err := json.Unmarshal(c.Ctx.Input.RequestBody, &model) + if err != nil { + c.Data["json"] = controllers.ErrMsg("转译时,发生异常!") + _ = c.ServeJSON() + return + } b, _ := valid.Valid(&model) if !b { for _, err := range valid.Errors { c.Data["json"] = controllers.ErrMsg(err.Message) } - c.ServeJSON() + _ = c.ServeJSON() } //save user uid, _ := jwt.GetAdminUserId(c.Ctx.Input) @@ -183,8 +216,12 @@ func (c *UserController) Center() { user.Phone = model.Phone user.Sex = model.Sex user.NickName = model.NickName - models.UpdateCurrentUser(user) + err := models.UpdateCurrentUser(user) + if err != nil { + logs.Error("查询时,发生异常!") + return + } c.Data["json"] = controllers.SuccessData("ok") } - c.ServeJSON() + _ = c.ServeJSON() } diff --git a/controllers/vivib/LiCaiController.go b/controllers/vivib/LiCaiController.go new file mode 100644 index 0000000..17a4c33 --- /dev/null +++ b/controllers/vivib/LiCaiController.go @@ -0,0 +1,135 @@ +package vivib + +import ( + "encoding/json" + "github.com/beego/beego/v2/core/logs" + "github.com/beego/beego/v2/core/validation" + "strconv" + "viviman.top/controllers" + "viviman.top/dto" + "viviman.top/models" + "viviman.top/vo" +) + +// LiCaiController 财务记录 API +type LiCaiController struct { + controllers.BaseController +} + +func (c *LiCaiController) URLMapping() { + c.Mapping("Post", c.Post) + c.Mapping("CpPost", c.CpPost) + c.Mapping("GetAll", c.GetAll) + c.Mapping("Put", c.Put) + c.Mapping("Delete", c.Delete) +} + +// GetOne @Title获取单个财务记录 +// @Description 获取单个财务记录 +// @Param id path int true "角色ID" +// @Success 200 {object} models.Role +// @router /:id [get] +func (c *LiCaiController) GetOne() { + id := c.Ctx.Input.Param(":id") + id64, _ := strconv.ParseInt(id, 10, 64) + role := models.GetOneRole(id64) + c.Data["json"] = controllers.SuccessData(role) + _ = c.ServeJSON() +} + +// GetAll @Title角色列表 +// @Description 角色列表 +// @Success 200 {object} controllers.Result +// @router / [get] +func (c *LiCaiController) GetAll() { + total, list := models.GetAllRole(c.GetParams()) + c.Data["json"] = controllers.SuccessData(vo.ResultList{Content: list, TotalElements: total}) + _ = c.ServeJSON() +} + +// CpPost @Title财务记录复制 +// @Description 角色添加 +// @Success 200 {object} controllers.Result +// @router / [post] +func (c *LiCaiController) CpPost() { + +} + +// Post @Title角色添加 +// @Description 角色添加 +// @Success 200 {object} controllers.Result +// @router / [post] +func (c *LiCaiController) Post() { + var model models.SysRole + valid := validation.Validation{} + json.Unmarshal(c.Ctx.Input.RequestBody, &model) + b, _ := valid.Valid(&model) + if !b { + for _, err := range valid.Errors { + c.Data["json"] = controllers.ErrMsg(err.Message) + } + } + _, e := models.AddRole(&model) + if e != nil { + c.Data["json"] = controllers.ErrMsg(e.Error()) + } + c.Data["json"] = controllers.SuccessData("操作成功") + _ = c.ServeJSON() +} + +// Put +// @router / [put] +func (c *LiCaiController) Put() { + var model models.SysRole + valid := validation.Validation{} + json.Unmarshal(c.Ctx.Input.RequestBody, &model) + b, _ := valid.Valid(&model) + if !b { + for _, err := range valid.Errors { + c.Data["json"] = controllers.ErrMsg(err.Message) + } + } + e := models.UpdateByRole(&model) + if e != nil { + c.Data["json"] = controllers.ErrMsg(e.Error()) + } + c.Data["json"] = controllers.SuccessData("操作成功") + _ = c.ServeJSON() +} + +// Delete @Title角色删除 +// @Description 角色删除 +// @Success 200 {object} controllers.Result +// @router / [delete] +func (c *LiCaiController) Delete() { + var ids []int64 + json.Unmarshal(c.Ctx.Input.RequestBody, &ids) + logs.Info(ids) + e := models.DelByRole(ids) + if e != nil { + c.Data["json"] = controllers.ErrMsg(e.Error()) + } + c.Data["json"] = controllers.SuccessData("操作成功") + _ = c.ServeJSON() +} + +// Menu @Title角色菜单更新 +// @Description 角色菜单更新 +// @Success 200 {object} controllers.Result +// @router /menu [put] +func (c *LiCaiController) Menu() { + var model dto.RoleMenu + valid := validation.Validation{} + json.Unmarshal(c.Ctx.Input.RequestBody, &model) + logs.Info("=======menu======") + logs.Info(model) + b, _ := valid.Valid(&model) + if !b { + for _, err := range valid.Errors { + c.Data["json"] = controllers.ErrMsg(err.Message) + } + } + models.BatchRoleMenuAdd(model) + c.Data["json"] = controllers.SuccessData("操作成功") + _ = c.ServeJSON() +} diff --git a/main.go b/main.go index 52492af..ecbdc8e 100644 --- a/main.go +++ b/main.go @@ -59,7 +59,6 @@ func main() { beego.BConfig.WebConfig.DirectoryIndex = true beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger" } - // beego.InsertFilterChain("/*", func(next beego.FilterFunc) beego.FilterFunc { return func(ctx *context.Context) { diff --git a/models/SysDept.go b/models/SysDept.go index abda592..4d2c910 100644 --- a/models/SysDept.go +++ b/models/SysDept.go @@ -34,7 +34,7 @@ func GetAllDepts(name string, enabled int8) []SysDept { return RecursionDeptList(depts, 0) } -//递归函数 +// RecursionDeptList 递归函数 func RecursionDeptList(data []SysDept, pid int64) []SysDept { var listTree = make([]SysDept, 0) for _, value := range data { @@ -61,7 +61,7 @@ func UpdateByDept(m *SysDept) (err error) { func DelByDept(ids []int64) (err error) { str := untils.ReturnQ(len(ids)) - logs.Info(str) + logs.Debug(str) o := orm.NewOrm() _, err = o.Raw("UPDATE sys_dept SET is_del = ? WHERE id in("+str+")", 1, ids).Exec() return diff --git a/redis/pool.go b/redis/pool.go index 696c177..f173e88 100644 --- a/redis/pool.go +++ b/redis/pool.go @@ -16,19 +16,20 @@ var ( func init() { host, _ := beego.AppConfig.String("redis_host") pwd, _ := beego.AppConfig.String("redis_pwd") - Pool = newPool(host, pwd) + db, _ := beego.AppConfig.Int("redis_db") + Pool = newPool(host, pwd, db) cleanupHook() } -func newPool(server string, pwd string) *redis.Pool { - +func newPool(server string, pwd string, db int) *redis.Pool { + dialOption := redis.DialDatabase(db) return &redis.Pool{ MaxIdle: 3, IdleTimeout: 240 * time.Second, Dial: func() (redis.Conn, error) { - c, err := redis.Dial("tcp", server) + c, err := redis.Dial("tcp", server, dialOption) if err != nil { return nil, err } diff --git a/routers/router.go b/routers/router.go index e5d4675..e6af683 100644 --- a/routers/router.go +++ b/routers/router.go @@ -7,6 +7,7 @@ package routers import ( beego "github.com/beego/beego/v2/server/web" "viviman.top/controllers/admin" + "viviman.top/controllers/vivib" ) func init() { @@ -60,7 +61,15 @@ func init() { ), ), ) - beego.AddNamespace(ns1, ns2) + //财务管理后台路由 + ns3 := beego.NewNamespace("/vivib", + beego.NSNamespace("/licai", + beego.NSInclude( + &vivib.LiCaiController{}, + ), + ), + ) + beego.AddNamespace(ns1, ns2, ns3) //beego.SetStaticPath("/swagger/", "swagger") } diff --git a/sql/yshop_go.sql b/sql/viviman_go.sql similarity index 100% rename from sql/yshop_go.sql rename to sql/viviman_go.sql diff --git a/untils/tools.go b/untils/tools.go index 7aa6d1a..591c959 100644 --- a/untils/tools.go +++ b/untils/tools.go @@ -8,7 +8,7 @@ import ( "viviman.top/controllers" ) -//加密 +// HashAndSalt 加密 func HashAndSalt(pwd []byte) string { hash, err := bcrypt.GenerateFromPassword(pwd, bcrypt.MinCost) if err != nil { @@ -17,7 +17,7 @@ func HashAndSalt(pwd []byte) string { return string(hash) } -//密码验证 +// ComparePwd 密码验证 func ComparePwd(hashPwd string, plainPwd []byte) bool { byteHash := []byte(hashPwd) err := bcrypt.CompareHashAndPassword(byteHash, plainPwd) @@ -28,7 +28,7 @@ func ComparePwd(hashPwd string, plainPwd []byte) bool { return true } -//判断array contain item +// Contains 判断array contain item func Contains(array interface{}, val interface{}) (index int) { index = -1 switch reflect.TypeOf(array).Kind() { @@ -46,12 +46,14 @@ func Contains(array interface{}, val interface{}) (index int) { return } +// Convert 数组转字符串 //[a] -> a -> a //[a b c] -> a b c -> a,b,c func Convert(array interface{}) string { return strings.Replace(strings.Trim(fmt.Sprint(array), "[]"), " ", ",", -1) } +// IntToBool 数值转布尔 func IntToBool(num int8) bool { if num > 0 { return true diff --git a/web/.eslintignore b/web/.eslintignore index a1bbc96..ff04b30 100644 --- a/web/.eslintignore +++ b/web/.eslintignore @@ -1,8 +1,7 @@ build/*.js -src/assets public dist -src/views +src/ diff --git a/web/src/api/vivib/licai.js b/web/src/api/vivib/licai.js new file mode 100644 index 0000000..eef71fb --- /dev/null +++ b/web/src/api/vivib/licai.js @@ -0,0 +1,50 @@ +import request from '@/utils/request' + +// 获取所有的Role +export function getAll() { + return request({ + url: 'admin/roles', + method: 'get' + }) +} + +export function add(data) { + return request({ + url: 'admin/roles', + method: 'post', + data + }) +} + +export function get(id) { + return request({ + url: 'admin/roles/' + id, + method: 'get' + }) +} + +export function del(ids) { + return request({ + url: 'admin/roles', + method: 'delete', + data: ids + }) +} + +export function edit(data) { + return request({ + url: 'admin/roles', + method: 'put', + data + }) +} + +export function editMenu(data) { + return request({ + url: 'admin/roles/menu', + method: 'put', + data + }) +} + +export default { add, edit, del, get, editMenu } diff --git a/web/src/layout/components/AppMain.vue b/web/src/layout/components/AppMain.vue index c235dc9..53580b2 100644 --- a/web/src/layout/components/AppMain.vue +++ b/web/src/layout/components/AppMain.vue @@ -27,7 +27,7 @@ export default { } - diff --git a/web/src/views/vivib/licai/licaiJs.js b/web/src/views/vivib/licai/licaiJs.js new file mode 100644 index 0000000..d8bfcc5 --- /dev/null +++ b/web/src/views/vivib/licai/licaiJs.js @@ -0,0 +1,170 @@ +import crudRoles from '@/api/system/role' +import {getDepts} from '@/api/system/dept' +import {getMenusTree} from '@/api/system/menu' +import CRUD, {crud, form, header, presenter} from '@crud/crud' +import rrOperation from '@crud/RR.operation' +import crudOperation from '@crud/CRUD.operation' +import udOperation from '@crud/UD.operation' +import pagination from '@crud/Pagination' +import Treeselect from '@riophae/vue-treeselect' +import '@riophae/vue-treeselect/dist/vue-treeselect.css' + +// crud交由presenter持有 +const defaultCrud = CRUD({title: '角色', url: 'admin/roles', sort: 'level,asc', crudMethod: {...crudRoles}}) +const defaultForm = {id: null, name: null, depts: [], remark: null, dataScope: '全部', level: 3, permission: null} +export default { + name: 'LiCai', + components: {Treeselect, pagination, crudOperation, rrOperation, udOperation}, + mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()], + data() { + return { + defaultProps: {children: 'children', label: 'label'}, + dateScopes: ['全部', '本级', '自定义'], level: 3, + currentId: 0, menuLoading: false, showButton: false, + menus: [], menuIds: [], depts: [], + permission: { + add: ['admin', 'roles:add'], + edit: ['admin', 'roles:edit'], + del: ['admin', 'roles:del'] + }, + rules: { + name: [ + {required: true, message: '请输入名称', trigger: 'blur'} + ], + permission: [ + {required: true, message: '请输入权限', trigger: 'blur'} + ] + } + } + }, + created() { + this.getMenus() + this.$nextTick(() => { + this.crud.toQuery() + }) + }, + methods: { + [CRUD.HOOK.afterRefresh]() { + this.$refs.menu.setCheckedKeys([]) + }, + // 编辑前 + [CRUD.HOOK.beforeToEdit](crud, form) { + if (form.dataScope === '自定义') { + this.getDepts() + } + const depts = [] + form.depts.forEach(function (dept, index) { + depts.push(dept.id) + }) + form.depts = depts + }, + // 提交前做的操作 + [CRUD.HOOK.afterValidateCU](crud) { + if (crud.form.dataScope === '自定义' && crud.form.depts.length === 0) { + this.$message({ + message: '自定义数据权限不能为空', + type: 'warning' + }) + return false + } else if (crud.form.dataScope === '自定义') { + const depts = [] + crud.form.depts.forEach(function (data, index) { + const dept = {id: data} + depts.push(dept) + }) + crud.form.depts = depts + } else { + crud.form.depts = [] + } + return true + }, + [CRUD.HOOK.afterAddError](crud) { + this.afterErrorMethod(crud) + }, + [CRUD.HOOK.afterEditError](crud) { + this.afterErrorMethod(crud) + }, + afterErrorMethod(crud) { + const depts = [] + crud.form.depts.forEach(function (dept, index) { + depts.push(dept.id) + }) + crud.form.depts = depts + }, + // 获取所有菜单 + getMenus() { + getMenusTree().then(res => { + this.menus = res.data + }) + }, + // 触发单选 + handleCurrentChange(val) { + if (val) { + const _this = this + // 清空菜单的选中 + this.$refs.menu.setCheckedKeys([]) + // 保存当前的角色id + this.currentId = val.id + this.showButton = val.level > 0 + // 初始化 + this.menuIds = [] + // 菜单数据需要特殊处理 + val.menus.forEach(function (data, index) { + if (data.pid != 0) { + _this.menuIds.push(data.id) + } + }) + } + }, + // 保存菜单 + saveMenu() { + this.menuLoading = true + const role = {id: this.currentId, menus: []} + // 得到半选的父节点数据,保存起来 + this.$refs.menu.getHalfCheckedNodes().forEach(function (data, index) { + const menu = {id: data.id} + role.menus.push(menu) + }) + // 得到已选中的 key 值 + this.$refs.menu.getCheckedKeys().forEach(function (data, index) { + const menu = {id: data} + role.menus.push(menu) + }) + crudRoles.editMenu(role).then(res => { + this.crud.notify('保存成功', CRUD.NOTIFICATION_TYPE.SUCCESS) + this.menuLoading = false + this.update() + }).catch(err => { + this.menuLoading = false + console.log(err.response.data.message) + }) + }, + // 改变数据 + update() { + // 无刷新更新 表格数据 + crudRoles.get(this.currentId).then(res => { + for (let i = 0; i < this.crud.data.length; i++) { + if (res.data.id === this.crud.data[i].id) { + this.crud.data[i] = res.data + break + } + } + }) + }, + // 获取部门数据 + getDepts() { + getDepts({enabled: true}).then(res => { + this.depts = res.content + }) + }, + // 如果数据权限为自定义则获取部门数据 + changeScope() { + if (this.form.dataScope === '自定义') { + this.getDepts() + } + }, + checkboxT(row, rowIndex) { + return row.level >= this.level + } + } +}