user_permission.blade.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. @extends('admin/layout')
  2. @section('header')
  3. <link rel="stylesheet" href="{{asset('js/plugins/zTree_v3-master/css/zTreeStyle/zTreeStyle.css')}}">
  4. @endsection
  5. @section('content')
  6. <body class="gray-bg">
  7. <div class="wrapper wrapper-content animated fadeInRight">
  8. <div class="row">
  9. <div class="col-sm-12">
  10. <div class="ibox float-e-margins">
  11. <div class="ibox-title">
  12. 菜单配置
  13. </div>
  14. <div class="ibox-content">
  15. <ul id="treeDemo" class="ztree"></ul>
  16. <div style="margin: 20px 0 0 50px">
  17. <button class="btn btn-info" onclick="units.save()">保存</button>
  18. <button class="btn btn-default closeLayer">取消</button>
  19. </div>
  20. </div>
  21. </div>
  22. </div>
  23. {{--<div class="col-sm-9">--}}
  24. {{--<div class="ibox float-e-margins">--}}
  25. {{--<div class="ibox-title">权限配置</div>--}}
  26. {{--<div class="ibox-content">--}}
  27. {{--<table id="table" class="table table-condensed" data-mobile-responsive="true"></table>--}}
  28. {{--</div>--}}
  29. {{--</div>--}}
  30. {{--</div>--}}
  31. </div>
  32. </div>
  33. </body>
  34. @endsection
  35. @section('footer')
  36. <script src="{{asset('js/plugins/zTree_v3-master/js/jquery.ztree.core.min.js')}}"></script>
  37. <script src="{{asset('js/plugins/zTree_v3-master/js/jquery.ztree.excheck.min.js')}}"></script>
  38. <script>
  39. var zTreeObj;
  40. var setting = {
  41. check: {
  42. enable: true
  43. },
  44. data: {
  45. simpleData: {
  46. enable: true
  47. }
  48. }
  49. };
  50. var trees = JSON.parse('{!! json_encode($trees) !!}');
  51. $(document).ready(function () {
  52. zTreeObj = $.fn.zTree.init($("#treeDemo"), setting, trees);
  53. });
  54. var units = {
  55. save: function () {
  56. var userIds = JSON.parse('{!! json_encode($userIds) !!}');
  57. var checkedNodes = zTreeObj.getCheckedNodes();
  58. var permissionIds = [];
  59. $.each(checkedNodes, function (inx, val) {
  60. permissionIds.push(val.id);
  61. });
  62. var config = {
  63. url: '/admin/system/user-permissions',
  64. type: 'put',
  65. data: {userIds: userIds, permissionIds: permissionIds}
  66. };
  67. config.success = function (result) {
  68. layer.msg(result.message, {icon: 6, time: 1500}, function () {
  69. tips.closeParentLayer();
  70. });
  71. };
  72. tips.ajax(config);
  73. }
  74. };
  75. </script>
  76. @endsection