人人商城

permission.html 7.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. {template 'common/header'}
  2. {if $do == 'display'}
  3. <div class="clearfix">
  4. <div class="we7-padding-bottom clearfix">
  5. {if empty($module['main_module'])}
  6. <div class="pull-right">
  7. <a href="javascript:void(0);" data-toggle="modal" data-target="#user-modal" class="btn btn-primary we7-padding-horizontal">添加操作员</a>
  8. </div>
  9. {/if}
  10. </div>
  11. <table class="table we7-table table-hover">
  12. <thead class="navbar-inner">
  13. <tr>
  14. <th class="text-center" style="width:100px;">操作员名称</th>
  15. <th class="text-center" style="width:150px">权限信息</th>
  16. <th class="text-right" style="width:100px;">操作</th>
  17. </tr>
  18. </thead>
  19. <tbody>
  20. {if !empty($user_permissions)}
  21. {loop $user_permissions $item}
  22. <tr>
  23. <td class="text-center" style="width:50px;">{$item['user_info']['username']}</td>
  24. <td class="text-center">
  25. {if !empty($item['permission']) && !array_key_exists('all', $item['permission'])}
  26. {loop $item['permission'] $permission}
  27. <span class="label label-primary">{$permission}</span>
  28. {/loop}
  29. {else}
  30. <span class="label label-primary">所有</span>
  31. {/if}
  32. </td>
  33. <td style="width:100px;">
  34. <div class="link-group" >
  35. {if empty($module['main_module'])}
  36. <a href="{php echo url('module/permission/post', array('uid' => $item['uid'], 'm' => $module_name));}">编辑</a>
  37. <a href="{php echo url('module/permission/delete', array('uid' => $item['uid'], 'm' => $module_name));}" class="del">删除</a>
  38. {else}
  39. <span>---</span>
  40. {/if}
  41. </div>
  42. </td>
  43. </tr>
  44. {/loop}
  45. {else}
  46. <tr ng-if="!wechats">
  47. <td colspan="3" class="text-center">暂无数据</td>
  48. </tr>
  49. {/if}
  50. </tbody>
  51. </table>
  52. <!-- 添加应用操作员模态框 -->
  53. <div class="modal" id="user-modal">
  54. <div class="modal-dialog">
  55. <div class="modal-content">
  56. <div class="modal-header">
  57. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  58. <h3 class="modal-title">添加应用操作员</h3>
  59. </div>
  60. <form action="" method="post">
  61. <input type="hidden" name="c" value="module">
  62. <input type="hidden" name="a" value="permission">
  63. <input type="hidden" name="do" value="add_clerk">
  64. <input type="hidden" name="m" value="{php echo $module_name}">
  65. <div class="modal-body we7-form">
  66. <div class="form-group">
  67. <label class="control-label col-sm-2"></label>
  68. <div class="col-sm-10">
  69. <input type="radio" id="addtype-1" name="addtype" value="{ACCOUNT_MANAGE_TYPE_OPERATOR}" checked>
  70. <label for="addtype-1" class="radio-inline">操作员</label>
  71. <a style="float: right" class="color-default" href="{php echo url('module/permission/post', array('m' => $module_name))}">+添加用户</a>
  72. </div>
  73. </div>
  74. <div class="form-group">
  75. <label class="col-sm-2 control-label">用户名</label>
  76. <div class="col-sm-10">
  77. <input id="add-username" name="username" type="text" class="form-control">
  78. <span class="help-block">请输入完整的用户名。</span>
  79. </div>
  80. </div>
  81. </div>
  82. <div class="modal-footer">
  83. <button type="submit" class="btn btn-primary" >确认</button>
  84. <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
  85. </div>
  86. </form>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. {/if}
  92. {if $do == 'post'}
  93. <div class="clearfix">
  94. <form action="" method="post" class="form-horizontal form ajaxfrom we7-form" role="form" id="form-user">
  95. <div class="form-group">
  96. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">用户名</label>
  97. <div class="col-sm-10 col-lg-9 col-xs-12">
  98. <input id="" name="username" type="text" class="form-control" value="{$user['username']}" />
  99. <span class="help-block">请输入用户名,用户名为 3 到 15 个字符组成,包括汉字,大小写字母(不区分大小写)</span>
  100. </div>
  101. </div>
  102. <div class="form-group">
  103. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">密码</label>
  104. <div class="col-sm-10 col-lg-9 col-xs-12">
  105. <input id="password" name="password" type="password" class="form-control" value="" autocomplete="off" />
  106. <span class="help-block">请填写密码,最小长度为 8 个字符</span>
  107. </div>
  108. </div>
  109. <div class="form-group">
  110. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">确认密码</label>
  111. <div class="col-sm-10 col-lg-9 col-xs-12">
  112. <input id="repassword" name="repassword" type="password" class="form-control" value="" autocomplete="off" />
  113. <span class="help-block">重复输入密码,确认正确输入</span>
  114. </div>
  115. </div>
  116. <div class="form-group">
  117. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">备注</label>
  118. <div class="col-sm-10 col-lg-9 col-xs-12">
  119. <textarea id="" name="remark" style="height:80px;" class="form-control">{$user['remark']}</textarea>
  120. <span class="help-block">方便注明此用户的身份</span>
  121. </div>
  122. </div>
  123. <div class="form-group module-permission">
  124. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">权限设置</label>
  125. <div class="col-sm-10 col-lg-10 col-xs-12">
  126. {loop $all_permission $key $module_val}
  127. <div class="col-sm-10 col-lg-10 col-xs-12 plugin-name">{$module_val['info']['title']}</div>
  128. {loop $module_val['permission'] $sub_key $permission}
  129. <div class="col-sm-4 dropdown">
  130. <span class="checkbox">
  131. <input id="check-child-{$key}-{$sub_key}" type="checkbox" value="{$permission['permission']}" name="module_permission[{$module_val['info']['name']}][]" {if !empty($permission['checked'])}checked{/if}>
  132. <label for="check-child-{$key}-{$sub_key}" data-toggle="tooltip">{$permission['title']}{if !empty($menu['sub_permission'])}<span class="caret"></span>{/if}</label>
  133. </span>
  134. {if $permission['sub_permission']}
  135. <ul class="dropdown-menu">
  136. {loop $permission['sub_permission'] $sub_permission}
  137. <li class="text-left">
  138. <input id="check-child-{$sub_permission['permission']}" we7-check-all="1" type="checkbox" value="{$sub_permission['permission']}" {if !empty($sub_permission['checked'])}checked{/if} name="module_permission[{$module_val['info']['name']}][]">
  139. <label for="check-child-{$sub_permission['permission']}">
  140. {$sub_permission['title']}
  141. </label>
  142. </li>
  143. {/loop}
  144. </ul>
  145. {/if}
  146. </div>
  147. {/loop}
  148. {/loop}
  149. </div>
  150. </div>
  151. <div class="form-group">
  152. <div class="col-sm-offset-2 col-md-offset-2 col-lg-offset-1 col-xs-12 col-sm-10 col-md-10 col-lg-11">
  153. <input type="submit" class="btn btn-primary span3" name="submit" value="提交" />
  154. <input type="hidden" name="token" value="{$_W['token']}" />
  155. </div>
  156. </div>
  157. </form>
  158. </div>
  159. <script>
  160. $('.module-permission .dropdown span').hover(function(){
  161. $(this).parent().addClass('open').find('.dropdown-menu').show();
  162. $(this).parent().find('.dropdown-menu').hover(
  163. function(){$(this).show();$(this).parent().addClass('open')},
  164. function(){$(this).hide();$(this).parent().removeClass('open');}
  165. );
  166. },function(){
  167. $(this).parent().removeClass('open').find('.dropdown-menu').hide();
  168. });
  169. var haveChecked = false;
  170. $('input[type="checkbox"]').each(function(i, n) {
  171. if ($(n).prop('checked')) {
  172. haveChecked = true;
  173. }
  174. });
  175. if (!haveChecked) {
  176. $('input[type="checkbox"]').each(function(i, n) {
  177. $(n).prop('checked', 'checked')
  178. });
  179. }
  180. </script>
  181. {/if}
  182. {template 'common/footer'}