林一峰
8 years ago
10 changed files with 157 additions and 83 deletions
-
13app/Http/Controllers/Admin/IndexController.php
-
3app/Http/Controllers/Admin/MenuController.php
-
62app/Http/Controllers/Admin/UserRoleController.php
-
82lqycms.sql
-
2resources/views/admin/article/add.blade.php
-
5resources/views/admin/menu/add.blade.php
-
2resources/views/admin/menu/index.blade.php
-
2resources/views/admin/userrole/index.blade.php
-
67resources/views/admin/userrole/permissions.blade.php
-
2routes/web.php
82
lqycms.sql
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,67 @@ |
|||
<!DOCTYPE html><html><head><title>角色权限设置_后台管理</title>@include('admin.common.header') |
|||
<div class="container-fluid"> |
|||
<div class="row"> |
|||
<!-- 左边开始 --><div class="col-sm-3 col-md-2 sidebar">@include('admin.common.leftmenu')</div><!-- 左边结束 --> |
|||
|
|||
<!-- 右边开始 --><div class="col-sm-9 col-md-10 rightbox"><div id="mainbox"> |
|||
<h2 class="sub-header">角色权限设置</h2>[ <a href="<?php echo route('admin_userrole'); ?>">角色列表</a> ]<br><br> |
|||
|
|||
<form method="post" action="<?php echo route('admin_userrole_dopermissions'); ?>" role="form" enctype="multipart/form-data" class="table-responsive"><div class="table-responsive">{{ csrf_field() }} |
|||
<input style="display:none;" name="role_id" type="text" id="role_id" value="<?php echo $role_id; ?>"> |
|||
<ul class="list-group"> |
|||
<?php if($menus){foreach($menus as $row){ ?>
|
|||
<li class="list-group-item <?php if($row["deep"]==0){echo 'list-group-item-info';} ?>"><?php echo '<span style="padding-left:'.($row["deep"]*30).'px;"></span>'; ?><input type='checkbox' <?php if($row["is_access"]==1){echo "checked='checked'";} ?> name='menuid[]' value='<?php echo $row["id"]; ?>' level='<?php echo $row["deep"]; ?>' onclick='javascript:checknode(this);'> <?php for($i=0;$i<$row["deep"];$i++){echo "—";}echo $row["name"]; ?></li>
|
|||
<?php }} ?>
|
|||
</ul> |
|||
|
|||
<button type="submit" class="btn btn-success" value="Submit">保存(Submit)</button><br><br> |
|||
</div><!-- 表格结束 --></form><!-- 表单结束 --> |
|||
|
|||
<script> |
|||
function checknode(obj) |
|||
{ |
|||
var chk = $("input[type='checkbox']"); |
|||
var count = chk.length; |
|||
var num = chk.index(obj); |
|||
var level_top = level_bottom = chk.eq(num).attr('level'); |
|||
|
|||
for (var i = num; i >= 0; i--) |
|||
{ |
|||
var le = chk.eq(i).attr('level'); |
|||
if (le <level_top) |
|||
{ |
|||
chk.eq(i).prop("checked", true); |
|||
var level_top = level_top - 1; |
|||
} |
|||
} |
|||
|
|||
for (var j = num + 1; j < count; j++) |
|||
{ |
|||
var le = chk.eq(j).attr('level'); |
|||
|
|||
if (chk.eq(num).prop("checked")) |
|||
{ |
|||
if (le > level_bottom) |
|||
{ |
|||
chk.eq(j).prop("checked", true); |
|||
} |
|||
else if (le == level_bottom) |
|||
{ |
|||
break; |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
if (le >level_bottom) |
|||
{ |
|||
chk.eq(j).prop("checked", false); |
|||
}else if(le == level_bottom) |
|||
{ |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
</div></div><!-- 右边结束 --></div></div> |
|||
</body></html> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue