|
@@ -3,6 +3,8 @@ package controllers
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
"eta_gn/eta_api/models"
|
|
|
+ "eta_gn/eta_api/models/system"
|
|
|
+ "eta_gn/eta_api/models/system/response"
|
|
|
"eta_gn/eta_api/services"
|
|
|
"eta_gn/eta_api/utils"
|
|
|
"fmt"
|
|
@@ -76,7 +78,7 @@ func (this *ClassifyController) Add() {
|
|
|
}
|
|
|
|
|
|
|
|
|
- err, errMsg, isSentEmail := services.AddReportClassify(req.ClassifyName, req.ParentId, req.ClassifyType, req.IsRemind, req.RemindTime)
|
|
|
+ err, errMsg, isSentEmail := services.AddReportClassify(req.ClassifyName, req.ParentId, req.ClassifyType, req.IsRemind, req.RemindTime, req.VisibleUserIds)
|
|
|
if err != nil {
|
|
|
br.Msg = "添加失败"
|
|
|
if errMsg != "" {
|
|
@@ -325,7 +327,7 @@ func (this *ClassifyController) Edit() {
|
|
|
}
|
|
|
|
|
|
|
|
|
- err, errMsg, isSentEmail := services.EditReportClassify(req.ClassifyId, req.ClassifyName, req.IsRemind, req.RemindTime)
|
|
|
+ err, errMsg, isSentEmail := services.EditReportClassify(req.ClassifyId, req.ClassifyName, req.IsRemind, req.RemindTime, req.VisibleUserIds)
|
|
|
if err != nil {
|
|
|
br.Msg = "修改失败"
|
|
|
if errMsg != "" {
|
|
@@ -576,6 +578,21 @@ func (this *ClassifyController) ListClassify() {
|
|
|
}
|
|
|
list := originList
|
|
|
|
|
|
+ visibleUsers, err := models.GetClassifyVisibleAll()
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ visibleUserMap := make(map[int][]int)
|
|
|
+
|
|
|
+ for _, v := range visibleUsers {
|
|
|
+ visibleUserMap[v.ClassifyId] = append(visibleUserMap[v.ClassifyId], v.AdminId)
|
|
|
+ }
|
|
|
+
|
|
|
+ for i, v := range list {
|
|
|
+ list[i].VisiableUsers = visibleUserMap[v.Id]
|
|
|
+ }
|
|
|
|
|
|
if classifyType > 0 {
|
|
|
list = make([]*models.ClassifyList, 0)
|
|
@@ -603,6 +620,11 @@ func (this *ClassifyController) ListClassify() {
|
|
|
if !utils.InArrayByInt(classifyIds, v.Id) {
|
|
|
continue
|
|
|
}
|
|
|
+ if visible, ok := visibleUserMap[v.Id]; ok {
|
|
|
+ if !utils.InArrayByInt(visible, this.SysUser.AdminId) {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ }
|
|
|
list = append(list, v)
|
|
|
}
|
|
|
}
|
|
@@ -639,6 +661,8 @@ func (this *ClassifyController) ListClassify() {
|
|
|
services.SortClassifyListBySortAndCreateTime(list)
|
|
|
|
|
|
list = services.GetClassifyListTreeRecursive(list, 0)
|
|
|
+
|
|
|
+ list = services.RecursiveFilterNoChildTreeClassify(list)
|
|
|
|
|
|
resp := new(models.ClassifyListResp)
|
|
|
resp.List = list
|
|
@@ -990,3 +1014,39 @@ func (this *ClassifyController) ClassifyPermissionV2() {
|
|
|
br.Msg = "获取成功"
|
|
|
br.Data = resp
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (this *ClassifyController) AdminList() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+
|
|
|
+ adminList, err := system.GetSysAdminListAll()
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取管理员列表失败"
|
|
|
+ br.ErrMsg = "获取管理员列表失败, Err: " + err.Error()
|
|
|
+ }
|
|
|
+
|
|
|
+ list := make([]*response.AdminItem, 0)
|
|
|
+ for _, v := range adminList {
|
|
|
+ item := new(response.AdminItem)
|
|
|
+ item.AdminId = v.AdminId
|
|
|
+ item.AdminName = v.AdminName
|
|
|
+ item.RealName = v.RealName
|
|
|
+ list = append(list, item)
|
|
|
+ }
|
|
|
+
|
|
|
+ resp := new(response.AdminListResp)
|
|
|
+ resp.List = list
|
|
|
+
|
|
|
+ br.Data = resp
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+}
|