FastAdmin 后台 UserRule 勾选不完整 Bug 修复
当用户权限的级选择时出现有部分没有选中。
修复来自在 qmit [1]
public static function getTreeList($selected = [])
{
// 结果集转成数组
$ruleList = collection(self::where('status', 'normal')->order('weigh', 'desc')->select())->toArray();
// 获得当前节点有子节点的节点数组
Tree::instance()->init($ruleList);
$ruleList = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0), 'name');
$hasChild = [];
foreach ($ruleList as $k => $v)
{
if ($v['haschild'])
{
$hasChild[] = $v['id'];
}
}
$nodeList = [];
foreach ($ruleList as $k => $v)
{
$state = array('selected' => in_array($v['id'], $selected) && !in_array($v['id'], $hasChild));
// $state = array('selected' => $v['ismenu'] ? false : in_array($v['id'], $selected));
$nodeList[] = array('id' => $v['id'], 'parent' => $v['pid'] ? $v['pid'] : '#', 'text' => __($v['title']), 'type' => 'menu', 'state' => $state);
}
return $nodeList;
}
后台“会员分组”选中分组后重新编辑的bug https://forum.fastadmin.net/thread/5983 ↩︎