123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- @extends('admin.public.base')
- @section('body_class')
- style="margin: 0 auto;width: 96%;padding: 30px 0px;"
- @endsection
- @section('content')
- <style>
- .checkmod {
- border: 1px solid #ccc;
- margin-bottom: 20px;
- padding: 0;
- }
-
- .checkmod dt label {
- background-color: #ececec;
- border-bottom: 1px solid #ebebeb;
- font-weight: bold;
- height: 30px;
- line-height: 30px;
- padding-left: 30px;
- }
-
- .checkmod dd label {
- line-height: 30px;
- padding-left: 20px;
- }
- </style>
- <div class="row">
- <div class="col-xs-12">
- <div>
- <form class="form-horizontal post-form" id="validation-form" method="post" action="">
- @if (request('id',0))
- <input name="id" type="hidden" value="{{request('id',0)}}" />
- @endif
- @foreach ($access_menu as $node)
- <dl class="checkmod">
- <dt class="hd">
- <label class="checkbox"><input class="auth_rules rules_all" type="checkbox" name="rules[]" value="{{$node['id']}}">{{$node['title']}}</label>
- </dt>
- <dd class="bd">
- @if (isset($node['child']))
- @foreach ($node['child'] as $child)
- <div class="rule_check">
- <div>
- <label class="checkbox" @if ( !empty($child['tip'])) title='{{$child['tip']}}' @endif >
- <input class="auth_rules rules_row" type="checkbox" name="rules[]" value="{{$child['id']}}"/>{{$child['title']}}
- </label>
- @if ( !empty($child['child']))
- @foreach ($child['child'] as $op)
- <div style="margin-left:30px;">
- <label class="checkbox">
- <input class="auth_rules" type="checkbox" name="rules[]" value="{{$op['id']}}" /> {{$op['title']}}
- </label>
- @if ( !empty($op['child']))
- <div style="margin-left:50px;">
- @foreach ($op['child'] as $k1 => $op1 )
- <span class="child_row">
- <label class="checkbox" style="display: inline-block;">
- <input class="auth_rules" type="checkbox" name="rules[]" value="{{$op1['id']}}" /> {{$op1['title']}}
- </label>
- </span>
- @endforeach
- </div>
- @endif
- </div>
- @endforeach
- @endif
- </div>
- </div>
- @endforeach
- @endif
- </dd>
- </dl>
- @endforeach
- <div class="form-group">
- <div class="col-sm-12">
- @csrf
- <input type="submit" value="提交" class="btn btn-primary" />
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- @endsection
- @section('javascript')
- <style>
- .checkmod {
- padding: 0;
- border: 1px solid #ccc;
- margin-bottom: 20px;
- }
- .checkmod dt {
- background-color: #ececec;
- border-bottom: 1px solid #ebebeb;
- font-weight: bold;
- height: 30px;
- line-height: 30px;
- padding-left: 10px;
- }
- .checkmod dd {
- line-height: 30px;
- padding-left: 20px;
- }
- </style>
- <script>
- $(function() {
- <?php echo 'var rules = ['.$rules['rules'].'];' ?>
- $('.auth_rules').each(function() {
- if($.inArray(parseInt(this.value, 10), rules) > -1) {
- $(this).prop('checked', true);
- }
- if(this.value == '') {
- $(this).closest('span').remove();
- }
- });
- //全选节点
- $('.rules_all').on('change', function() {
- $(this).closest('dl').find('dd').find('input').prop('checked', this.checked);
- });
- $('.rules_row').on('change', function() {
- $(this).closest('.rule_check').find('input').prop('checked', this.checked);
- });
- });
- </script>
- @endsection
|