fix(menu): show dashboard overview as root item
This commit is contained in:
@@ -21,9 +21,7 @@ type Menu struct {
|
||||
// PlatformMenus 使用二维数据组织菜单;每一行表示一个菜单分组。
|
||||
var PlatformMenus = [][]Menu{
|
||||
{
|
||||
{Identity: "dashboard", GroupCode: "dashboard", Name: "工作台", Icon: "icon-dashboard", Path: "/dashboard", SortNo: 10, Status: common.StatusEnable},
|
||||
{Identity: "dashboard_overview", ParentIdentity: "dashboard", GroupCode: "dashboard", Name: "数据概览", Path: "/dashboard/overview", SortNo: 1, Status: common.StatusEnable},
|
||||
{Identity: "dashboard_reports", ParentIdentity: "dashboard", GroupCode: "dashboard", Name: "统计报表", Path: "/dashboard/reports", SortNo: 2, Status: common.StatusEnable},
|
||||
{Identity: "dashboard_overview", GroupCode: "dashboard", Name: "数据概览", Icon: "icon-dashboard", Path: "/dashboard/overview", SortNo: 10, Status: common.StatusEnable},
|
||||
},
|
||||
{
|
||||
{Identity: "organization", GroupCode: "organization", Name: "机构管理", Icon: "icon-storage", Path: "/organization", SortNo: 20, Status: common.StatusEnable},
|
||||
@@ -128,6 +126,10 @@ func LoadPlatformMenus(roleCode string) ([]Menu, error) {
|
||||
allowed := make(map[string]struct{}, len(identities))
|
||||
for _, identity := range identities {
|
||||
allowed[identity] = struct{}{}
|
||||
// 兼容历史角色保存的 dashboard 父菜单或报表菜单授权。
|
||||
if identity == "dashboard" || identity == "dashboard_reports" {
|
||||
allowed["dashboard_overview"] = struct{}{}
|
||||
}
|
||||
}
|
||||
for _, menu := range menus {
|
||||
if _, ok := allowed[menu.Identity]; ok && menu.ParentIdentity != "" {
|
||||
|
||||
Reference in New Issue
Block a user