|
@@ -13,6 +13,12 @@ import (
|
|
|
"time"
|
|
|
)
|
|
|
|
|
|
+const (
|
|
|
+ CHART_CLASSIFY_ADD_OR_EDIT = "chartLib:classifyOpt:add"
|
|
|
+ CHART_CLASSIFY_DELETE = "chartLib:classifyOpt:delete"
|
|
|
+ CHART_CLASSIFY_MOVE = "chartLib:classifyOpt:move"
|
|
|
+)
|
|
|
+
|
|
|
// 数据管理-分类模块
|
|
|
type ChartClassifyController struct {
|
|
|
controllers.BaseAuthController
|
|
@@ -1104,7 +1110,7 @@ func (this *ChartClassifyController) ChartClassifyChartListV3() {
|
|
|
noPermissionChartIdMap[v.ChartInfoId] = true
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ var allNodes []*data_manage.ChartClassifyItems
|
|
|
isShowMe, _ := this.GetBool("IsShowMe")
|
|
|
if isShowMe {
|
|
|
allChartInfo, err := data_manage.GetChartClassifyAndInfoByParentIdForMe(chartClassifyId, sysUser.AdminId)
|
|
@@ -1114,41 +1120,62 @@ func (this *ChartClassifyController) ChartClassifyChartListV3() {
|
|
|
return
|
|
|
}
|
|
|
// 移除没有权限的图表
|
|
|
- allNodes := data.HandleNoPermissionChart(allChartInfo, noPermissionChartIdMap, this.SysUser.AdminId)
|
|
|
+ allNodes = data.HandleNoPermissionChart(allChartInfo, noPermissionChartIdMap, this.SysUser.AdminId)
|
|
|
allNodes, err = data.GetChartClassifyByIsMe(sysUser.AdminId, chartClassifyId, utils.CHART_SOURCE_DEFAULT, allNodes)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- resp.AllNodes = allNodes
|
|
|
-
|
|
|
- br.Ret = 200
|
|
|
- br.Success = true
|
|
|
- br.Msg = "获取成功"
|
|
|
- br.Data = resp
|
|
|
- fmt.Println("source my classify")
|
|
|
- return
|
|
|
+ //resp.AllNodes = allNodes
|
|
|
+ //
|
|
|
+ //br.Ret = 200
|
|
|
+ //br.Success = true
|
|
|
+ //br.Msg = "获取成功"
|
|
|
+ //br.Data = resp
|
|
|
+ //fmt.Println("source my classify")
|
|
|
+ //return
|
|
|
+ } else {
|
|
|
+ allChartInfo, err := data_manage.GetChartClassifyAndInfoByParentId(chartClassifyId)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //allChartInfo, err := data_manage.GetChartInfoAllByClassifyId(utils.CHART_SOURCE_DEFAULT, chartClassifyId)
|
|
|
+ //if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ // br.Msg = "获取失败"
|
|
|
+ // br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+ // 移除没有权限的图表
|
|
|
+ allNodes = data.HandleNoPermissionChart(allChartInfo, noPermissionChartIdMap, this.SysUser.AdminId)
|
|
|
}
|
|
|
-
|
|
|
- allChartInfo, err := data_manage.GetChartClassifyAndInfoByParentId(chartClassifyId)
|
|
|
- if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ menulist, e := system.GetMenuButtonsByRoleId(this.SysUser.RoleId)
|
|
|
+ if e != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ br.ErrMsg = "获取角色按钮权限失败, Err: " + e.Error()
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
- //allChartInfo, err := data_manage.GetChartInfoAllByClassifyId(utils.CHART_SOURCE_DEFAULT, chartClassifyId)
|
|
|
- //if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
- // br.Msg = "获取失败"
|
|
|
- // br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
|
|
|
- // return
|
|
|
- //}
|
|
|
- // 移除没有权限的图表
|
|
|
- allNodes := data.HandleNoPermissionChart(allChartInfo, noPermissionChartIdMap, this.SysUser.AdminId)
|
|
|
-
|
|
|
+ buttonList := make(map[string]int, 0)
|
|
|
+ for _, item := range menulist {
|
|
|
+ if item.MenuType == 1 {
|
|
|
+ buttonList[item.ButtonCode] = 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ var addOrEditRight, deleteRight, moveRight bool
|
|
|
+ if _, ok := buttonList[CHART_CLASSIFY_ADD_OR_EDIT]; ok {
|
|
|
+ addOrEditRight = true
|
|
|
+ }
|
|
|
+ if _, ok := buttonList[CHART_CLASSIFY_DELETE]; ok {
|
|
|
+ deleteRight = true
|
|
|
+ }
|
|
|
+ if _, ok := buttonList[CHART_CLASSIFY_MOVE]; ok {
|
|
|
+ moveRight = true
|
|
|
+ }
|
|
|
for k, item := range allNodes {
|
|
|
- item.Button = data.GetChartOpButton(this.SysUser, item.SysUserId, item.HaveOperaAuth)
|
|
|
+ //item.Button = data.GetChartOpButton(this.SysUser, item.SysUserId, item.HaveOperaAuth)
|
|
|
+ item.Button = data.GetChartOpButtonV2(item.HaveOperaAuth, addOrEditRight, deleteRight, moveRight)
|
|
|
if item.ChartInfoId > 0 {
|
|
|
item.Button.AddButton = false
|
|
|
item.Button.OpButton = false
|