There is a problem with the code when judging whether to check the submenu
<input type="checkbox" name="menu[{$vo.mid}]" lay-skin=" primary" title="{$vo.title}" {:isset($role['rights']) && $role['rights'] && in_array($vo.mid,$role['rights'])?' checked':''}>
This should change in_array($vo.mid,$role['rights']) to in_array($cvo.mid,$role['rights'])
Otherwise all will be checked