check_item.blade.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. @extends('admin/layout')
  2. <style>
  3. .alert {
  4. /*margin-bottom: 5px !important;*/
  5. }
  6. </style>
  7. @section('content')
  8. <body class="gray-bg">
  9. <div class="wrapper wrapper-content animated fadeInRight">
  10. <div class="row">
  11. <div class="col-sm-12">
  12. <div class="ibox float-e-margins">
  13. <div class="ibox-content">
  14. <form class="form-horizontal">
  15. <div class="form-group">
  16. <label class="col-sm-2 control-label">
  17. {{--检查项--}}
  18. {{--<br/>--}}
  19. {{--<small class="text-navy">自定义样式</small>--}}
  20. </label>
  21. <div class="col-sm-6">
  22. <div class="checkbox i-checks">
  23. <label>
  24. <input type="checkbox" title="" id="toggle">
  25. <span style="font-weight: bold">全选/反选[只能全选反选拥有权限的选项]</span></label>
  26. </div>
  27. @php
  28. $checkItemScopes=$siteProcess->process->check_item_scopes??[];
  29. $checkItems = $siteProcess->check_items??[];
  30. @endphp
  31. @foreach($checkItemScopes as $item)
  32. {{--检测每个检查项的权限--}}
  33. @php $for=\App\Libs\Helps::hasCheckItemsFor($item['for']??[]) @endphp
  34. <div class="checkbox i-checks">
  35. <label>
  36. <input type="checkbox" value="{{$item['inx']}}" title="" @if(!$for) disabled @endif
  37. @if(in_array($item['inx'],$checkItems)) checked @endif name="checkItems">
  38. <i></i>{{$item['inx']}}. {{$item['val']}} @if(!$for) <span class="red">[无权限]</span> @endif</label>
  39. @if(!empty($item['remark']))
  40. <div class="alert alert-info" style="margin-left: 19px">
  41. {!! $item['remark']??'' !!}
  42. </div>
  43. @endif
  44. </div>
  45. @endforeach
  46. </div>
  47. </div>
  48. <div class="form-group">
  49. <div class="col-sm-offset-3 col-sm-8">
  50. @if($siteProcess->active==2)
  51. <button class="btn btn-sm btn-primary" type="button" onclick="units.save()">提交
  52. </button>
  53. @endif
  54. <button class="btn btn-sm btn-white closeLayer" type="button">取消</button>
  55. </div>
  56. </div>
  57. </form>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. </body>
  64. @endsection
  65. @section('footer')
  66. <script src="{{asset('js/plugins/iCheck/icheck.min.js')}}"></script>
  67. <script>
  68. $(function () {
  69. $(".i-checks").iCheck({
  70. checkboxClass: "icheckbox_square-green",
  71. radioClass: "iradio_square-green"
  72. });
  73. });
  74. var units = {
  75. save: function () {
  76. var checkItems = [];
  77. $("[name=checkItems]:checked").each(function () {
  78. checkItems.push($(this).val());
  79. });
  80. if (checkItems.length < 1) {
  81. layer.alert('请选择检查项再进行提交', {icon: 5});
  82. return;
  83. }
  84. var config = {
  85. url: '/admin/process/check-item/' + "{{$siteProcess->id}}",
  86. type: 'post',
  87. data: {checkItems: checkItems}
  88. };
  89. config.success = function (result) {
  90. layer.msg(result.message, {icon: 6, time: 1500}, function () {
  91. parent.window.location.reload();
  92. tips.closeParentLayer();
  93. });
  94. };
  95. tips.ajax(config);
  96. }
  97. };
  98. $("#toggle").on('ifChecked', function (event) {
  99. $("[name=checkItems]:not(:disabled)").iCheck('check');
  100. }).on('ifUnchecked', function () {
  101. $("[name=checkItems]:not(:disabled)").iCheck('uncheck');
  102. });
  103. </script>
  104. @endsection