admingroup_list.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <?php
  2. /**
  3. * 管理员组列表
  4. *
  5. * @createtime 2018/03/01
  6. * @author 空竹
  7. * @copyright 芝麻开发(http://www.zhimawork.com)
  8. */
  9. require_once('admin_init.php');
  10. require_once('admincheck.php');
  11. $POWERID = '9001';//权限
  12. Admin::checkAuth($POWERID, $ADMINAUTH);
  13. ?>
  14. <!DOCTYPE html>
  15. <html>
  16. <head>
  17. <?php include('htmlhead.inc.php');?>
  18. <title>管理员组 - 管理设置 - 管理系统</title>
  19. </head>
  20. <body>
  21. <div id="header">
  22. <?php include('top.inc.php');?>
  23. <?php
  24. $FLAG_TOPNAV = 'system';//主菜单焦点
  25. include('nav.inc.php');
  26. ?>
  27. </div>
  28. <div id="container">
  29. <?php
  30. $FLAG_LEFTMENU = 'admingroup_list';//左侧子菜单焦点
  31. include('admin_menu.inc.php');
  32. ?>
  33. <div id="maincontent">
  34. <div class="zm_handle">
  35. <div class="btns">
  36. <input type="button" class="btn-handle btn-yellow" id="btn_order" value="保存排序"/>
  37. <input type="button" class="btn-handle" id="btn_add" value="添加管理员组"/>
  38. </div>
  39. </div>
  40. <div class="tablelist">
  41. <table>
  42. <tr>
  43. <th>组ID</th>
  44. <th>组名称</th>
  45. <th>排序</th>
  46. <th>操作</th>
  47. </tr>
  48. <?php
  49. $rows = Admingroup::getList();
  50. if(!empty($rows)){
  51. foreach($rows as $row){
  52. $isSuperGroup = 0;
  53. if($row['id'] == 1) $isSuperGroup = 1;//超级管理员组
  54. ?>
  55. <tr>
  56. <td class="center"><?php echo $row['id'];?></td>
  57. <td><?php echo $row['name'];?></td>
  58. <td class="center">
  59. <?php
  60. if($isSuperGroup == 1) {
  61. echo '<input type="text" class="order-input" name="order_super" value="'.$row['order'].'" disabled="disabled">';
  62. }else{
  63. echo '<input type="text" class="order-input" name="order" value="'.$row['order'].'">';
  64. echo '<input type="hidden" value="'.$row['id'].'" name="rowid"/>';
  65. }
  66. ?>
  67. </td>
  68. <td class="center">
  69. <?php
  70. if($isSuperGroup == 0){
  71. ?>
  72. <a href="admingroup_auth.php?id=<?php echo $row['id']?>" title="设置权限"><i class="fa fa-cog"></i></a>
  73. <a href="javascript:edit(<?php echo $row['id'];?>)" title="修改"><i class="fa fa-edit"></i></a>
  74. <a href="javascript:del(<?php echo $row['id'];?>)" title="删除"><i class="fa fa-remove"></i></a>
  75. <?php }?>
  76. </td>
  77. </tr>
  78. <?php
  79. }
  80. }else{
  81. echo '<tr><td colspan="4" class="center">没有数据</td></tr>';
  82. }
  83. ?>
  84. </table>
  85. <div id="pagelist">
  86. <div class="pageinfo">
  87. <span class="table_info">共<?php echo count($rows);?>条数据</span>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. <div class="clear"></div>
  93. </div>
  94. <?php include('footer.inc.php');?>
  95. <script type="text/javascript">
  96. $(function(){
  97. //添加
  98. $('#btn_add').click(function(){
  99. layer.open({
  100. type: 2,
  101. title: '添加管理员组',
  102. shadeClose: true,
  103. shade: 0.3,
  104. area: ['500px', '300px'],
  105. content: 'admingroup_add.php'
  106. });
  107. });
  108. //排序
  109. $('#btn_order').click(function(){
  110. var orderList = $('input[name="order"]').map(function(){ return $(this).val(); }).get().toString();
  111. var idList = $('input:hidden[name="rowid"]').map(function(){ return $(this).val(); }).get().toString();
  112. $.getJSON('admingroup_do.php?act=order',{order:orderList, id:idList},function(data){
  113. var code = data.code;
  114. var msg = data.msg;
  115. switch(code){
  116. case 1:
  117. layer.alert(msg, {icon: 6}, function(index){
  118. location.reload();
  119. });
  120. break;
  121. default:
  122. layer.alert(msg, {icon: 5});
  123. }
  124. });
  125. });
  126. });
  127. //修改
  128. function edit(id){
  129. layer.open({
  130. type: 2,
  131. title: '修改管理员组',
  132. shadeClose: true,
  133. shade: 0.3,
  134. area: ['500px', '300px'],
  135. content: 'admingroup_edit.php?id='+id
  136. });
  137. }
  138. //删除
  139. function del(id){
  140. layer.confirm('确认删除该管理员组吗?', {
  141. btn: ['确认','取消']
  142. }, function(){
  143. var index = layer.load(0, {shade: false});
  144. $.ajax({
  145. type : 'POST',
  146. data : {
  147. id : id
  148. },
  149. dataType : 'json',
  150. url : 'admingroup_do.php?act=del',
  151. success : function(data){
  152. layer.close(index);
  153. var code = data.code;
  154. var msg = data.msg;
  155. switch(code){
  156. case 1:
  157. layer.alert(msg, {icon: 6}, function(index){
  158. location.reload();
  159. });
  160. break;
  161. default:
  162. layer.alert(msg, {icon: 5});
  163. }
  164. }
  165. });
  166. }, function(){}
  167. );
  168. }
  169. </script>
  170. </body>
  171. </html>