|
@@ -24,6 +24,15 @@ func PermissionList(c *gin.Context) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 获取品种下面挂有日历的品种列表
|
|
|
|
+
|
|
|
|
+ matterOb := new(fe_calendar_matter.FeCalendarMatter)
|
|
|
|
+ matterPermissionIds, e := matterOb.GetAllPermissionIds()
|
|
|
|
+ if e != nil {
|
|
|
|
+ response.FailMsg("获取失败", "获取有日历品种列表失败, Err: "+e.Error(), c)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
// 遍历品种树
|
|
// 遍历品种树
|
|
permissions, e := chart_permission.GetChartPermissionsByProductId()
|
|
permissions, e := chart_permission.GetChartPermissionsByProductId()
|
|
if e != nil {
|
|
if e != nil {
|
|
@@ -33,7 +42,7 @@ func PermissionList(c *gin.Context) {
|
|
parents := make([]*chart_permission.SimpleChartPermission, 0)
|
|
parents := make([]*chart_permission.SimpleChartPermission, 0)
|
|
parentPermissions := make(map[int][]*chart_permission.SimpleChartPermission, 0)
|
|
parentPermissions := make(map[int][]*chart_permission.SimpleChartPermission, 0)
|
|
for _, v := range permissions {
|
|
for _, v := range permissions {
|
|
- if v.ParentId > 0 && utils.InArrayByInt(validPermissionIds, int(v.ChartPermissionID)) {
|
|
|
|
|
|
+ if v.ParentId > 0 && utils.InArrayByInt(validPermissionIds, int(v.ChartPermissionID)) && utils.InArrayByInt(matterPermissionIds, int(v.ChartPermissionID)) {
|
|
if parentPermissions[v.ParentId] == nil {
|
|
if parentPermissions[v.ParentId] == nil {
|
|
parentPermissions[v.ParentId] = make([]*chart_permission.SimpleChartPermission, 0)
|
|
parentPermissions[v.ParentId] = make([]*chart_permission.SimpleChartPermission, 0)
|
|
}
|
|
}
|
|
@@ -42,15 +51,31 @@ func PermissionList(c *gin.Context) {
|
|
}
|
|
}
|
|
parents = append(parents, chart_permission.FormatChartPermission2Simple(v))
|
|
parents = append(parents, chart_permission.FormatChartPermission2Simple(v))
|
|
}
|
|
}
|
|
- resp := make([]*chart_permission.SimpleChartPermission, 0)
|
|
|
|
|
|
+ var resp chart_permission.FaCalendarPermissionResp
|
|
|
|
+ list := make([]*chart_permission.SimpleChartPermission, 0)
|
|
for _, v := range parents {
|
|
for _, v := range parents {
|
|
if parentPermissions[v.ChartPermissionId] == nil {
|
|
if parentPermissions[v.ChartPermissionId] == nil {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
v.Children = parentPermissions[v.ChartPermissionId]
|
|
v.Children = parentPermissions[v.ChartPermissionId]
|
|
- resp = append(resp, v)
|
|
|
|
|
|
+ list = append(list, v)
|
|
|
|
+ }
|
|
|
|
+ lastEditPermissionId := 0
|
|
|
|
+ lastEditPermissionName := ""
|
|
|
|
+ // 查询最近被编辑过的品种ID
|
|
|
|
+ matter, e := matterOb.GetLaststModifyMatter()
|
|
|
|
+ if e != nil && e.Error() != utils.NotEmpty() {
|
|
|
|
+ response.FailMsg("获取失败", "获取品种列表失败, Err: "+e.Error(), c)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if e == nil {
|
|
|
|
+ lastEditPermissionId = matter.ChartPermissionId
|
|
|
|
+ lastEditPermissionName = matter.ChartPermissionName
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ resp.CheckedPermissionId = lastEditPermissionId
|
|
|
|
+ resp.CheckedPermissionName = lastEditPermissionName
|
|
|
|
+ resp.List = list
|
|
response.OkData("获取成功", resp, c)
|
|
response.OkData("获取成功", resp, c)
|
|
}
|
|
}
|
|
|
|
|