authorize.html 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <include file="public@header" />
  2. <style>.expander{margin-left: -20px;}</style>
  3. </head>
  4. <body>
  5. <div class="wrap js-check-wrap">
  6. <ul class="nav nav-tabs">
  7. <li class="active"><a href="{:url('Rbac/authorize',['id'=>$role_id])}">后台界面授权</a></li>
  8. <li><a href="{:url('Rbac/apiAuthorize',['id'=>$role_id])}">后台API授权</a></li>
  9. </ul>
  10. <form class="js-ajax-form margin-top-20" action="{:url('Rbac/authorizePost')}" method="post">
  11. <div class="table_full">
  12. <table class="table table-bordered" id="authrule-tree">
  13. <tbody>
  14. {$category}
  15. </tbody>
  16. </table>
  17. </div>
  18. <div class="form-actions text-center">
  19. <input type="hidden" name="roleId" value="{$roleId}" />
  20. <button class="btn btn-primary js-ajax-submit" type="submit">{:lang('SAVE')}</button>
  21. </div>
  22. </form>
  23. </div>
  24. <script src="__STATIC__/js/admin.js?v={$_static_version}"></script>
  25. <script type="text/javascript">
  26. $(document).ready(function () {
  27. Wind.css('treeTable');
  28. Wind.use('treeTable', function () {
  29. $("#authrule-tree").treeTable({
  30. indent: 20
  31. });
  32. });
  33. });
  34. function checknode(obj) {
  35. var chk = $("input[type='checkbox']");
  36. var count = chk.length;
  37. var num = chk.index(obj);
  38. var level_top = level_bottom = chk.eq(num).attr('level');
  39. for (var i = num; i >= 0; i--) {
  40. var le = chk.eq(i).attr('level');
  41. if (le <level_top) {
  42. chk.eq(i).prop("checked", true);
  43. var level_top = level_top - 1;
  44. }
  45. }
  46. for (var j = num + 1; j < count; j++) {
  47. var le = chk.eq(j).attr('level');
  48. if (chk.eq(num).prop("checked")) {
  49. if (le > level_bottom){
  50. chk.eq(j).prop("checked", true);
  51. }
  52. else if (le == level_bottom){
  53. break;
  54. }
  55. } else {
  56. if (le >level_bottom){
  57. chk.eq(j).prop("checked", false);
  58. }else if(le == level_bottom){
  59. break;
  60. }
  61. }
  62. }
  63. }
  64. </script>
  65. </body>
  66. </html>