Преглед изворни кода

Merge branch 'feature/pool294_fa_calendar' into debug

xyxie пре 1 месец
родитељ
комит
4aac4532e2
1 измењених фајлова са 8 додато и 3 уклоњено
  1. 8 3
      controller/fe_calendar/fe_calendar.go

+ 8 - 3
controller/fe_calendar/fe_calendar.go

@@ -41,12 +41,15 @@ func PermissionList(c *gin.Context) {
 	}
 	parents := make([]*chart_permission.SimpleChartPermission, 0)
 	parentPermissions := make(map[int][]*chart_permission.SimpleChartPermission, 0)
+	showPermissionIds := make(map[int]struct{}, 0)
 	for _, v := range permissions {
 		if v.ParentId > 0 && utils.InArrayByInt(validPermissionIds, int(v.ChartPermissionID)) && utils.InArrayByInt(matterPermissionIds, int(v.ChartPermissionID)) {
 			if parentPermissions[v.ParentId] == nil {
 				parentPermissions[v.ParentId] = make([]*chart_permission.SimpleChartPermission, 0)
 			}
 			parentPermissions[v.ParentId] = append(parentPermissions[v.ParentId], chart_permission.FormatChartPermission2Simple(v))
+			showPermissionIds[int(v.ChartPermissionID)] = struct{}{}
+			showPermissionIds[v.ParentId] = struct{}{}
 			continue
 		}
 		parents = append(parents, chart_permission.FormatChartPermission2Simple(v))
@@ -68,9 +71,11 @@ func PermissionList(c *gin.Context) {
 		response.FailMsg("获取失败", "获取品种列表失败, Err: "+e.Error(), c)
 		return
 	}
-	if e == nil {
-		lastEditPermissionId = matter.ChartPermissionId
-		lastEditPermissionName = matter.ChartPermissionName
+	if e == nil && matter != nil && matter.FeCalendarMatterId > 0 {
+		if _, ok := showPermissionIds[matter.ChartPermissionId]; ok {
+			lastEditPermissionId = matter.ChartPermissionId
+			lastEditPermissionName = matter.ChartPermissionName
+		}
 	}
 
 	resp.CheckedPermissionId = lastEditPermissionId