!39 修复账号多角色时菜单重复,子菜单ID小于父菜单ID时无法显示的问题

Merge pull request !39 from waizking/N/A
This commit is contained in:
zhengxinonly
2022-06-16 08:44:53 +00:00
committed by Gitee
+2 -2
View File
@@ -36,12 +36,12 @@ def make_menu_tree():
if p.enable == 0:
continue
# 一二级菜单
if int(p.type) == 0 or int(p.type) == 1:
if int(p.type) in [0,1] and p not in powers:
powers.append(p)
power_schema = PowerOutSchema(many=True) # 用已继承 ma.ModelSchema 类的自定制类生成序列化类
power_dict = power_schema.dump(powers) # 生成可序列化对象
power_dict.sort(key=lambda x: x['id'], reverse=True)
power_dict.sort(key=lambda x: (x['parent_id'], x['id']), reverse=True)
menu_dict = OrderedDict()
for _dict in power_dict: