人人商城

work.html 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. {template 'common/header'}
  2. {if $issolution == 1}
  3. <ol class="breadcrumb" style="padding:5px 0;">
  4. <li><a href="{url 'home/welcome/ext'}"><i class="fa fa-cogs"></i> &nbsp; 扩展功能</a></li>
  5. <li><a href="{url 'home/welcome/ext' array('m' => $m)}">{$module_types[$module['type']]['title']}模块 - {$module['title']}</a></li>
  6. <li class="active">操作人员列表</li>
  7. </ol>
  8. {/if}
  9. <ul class="nav nav-tabs">
  10. <li class="active"><a href="{url 'profile/worker'}">操作人员列表</a></li>
  11. </ul>
  12. <div class="panel panel-default">
  13. <div class="panel-body table-responsive">
  14. {if $issolution == 1}
  15. <table class="table">
  16. <thead>
  17. <tr>
  18. <th style="width:80px;">用户编号</th>
  19. <th style="width:200px;">用户名</th>
  20. <th>角色</th>
  21. <th style="width:150px;">操作</th>
  22. </tr>
  23. </thead>
  24. {loop $works $row}
  25. <tr>
  26. <td>{$row['uid']}</td>
  27. <td>{$member[$row['uid']]['username']}</td>
  28. <td>
  29. {if $row['role'] == 'operator'}
  30. <span class="label label-warning">操作员</span>
  31. {elseif $row['role'] == 'manager'}
  32. <span class="label label-success">管理员</span>
  33. {/if}
  34. </td>
  35. <td>
  36. <a href="{php echo url('profile/permission', array('m' => $m, 'uid' => $row['uid']))}">设置权限</a>
  37. </td>
  38. </tr>
  39. {/loop}
  40. </table>
  41. {else}
  42. <table class="table">
  43. <thead>
  44. <tr>
  45. <th style="width:50px;">选择</th>
  46. <th style="width:80px">用户编号</th>
  47. <th style="width:200px;">用户名</th>
  48. <th>角色</th>
  49. </tr>
  50. </thead>
  51. {loop $works $row}
  52. <tr>
  53. <td class="row-first"><input class="member" type="checkbox" value="{$row['id']}" /></td>
  54. <td>{$row['uid']}</td>
  55. <td>{$member[$row['uid']]['username']}</td>
  56. <td>
  57. {if $row['role'] == 'operator'}
  58. <span class="label label-success">操作员</span>
  59. {elseif $row['role'] == 'manager'}
  60. <span class="label label-warning">管理员</span>
  61. {/if}
  62. </td>
  63. </tr>
  64. {/loop}
  65. <tfoot>
  66. <tr>
  67. <td colspan="4">
  68. <input id="btn-add" class="btn btn-primary" type="button" value="添加账号操作员">
  69. <input id="btn-revo" class="btn btn-default" type="button" value="删除选定操作">
  70. <a class="btn" href="#" onclick="addUserPanel(this)">如果是添加一个新用户,请先添加该用户</a>
  71. </td>
  72. </tr>
  73. </tfoot>
  74. </table>
  75. {/if}
  76. </div>
  77. </div>
  78. <script type="text/javascript">
  79. var seletedUserIds = {php echo json_encode($uids);};
  80. require(['biz'], function(biz){
  81. $(function(){
  82. $('#btn-add').click(function(){
  83. {if $_W['isfounder']}
  84. biz.user.browser(seletedUserIds, function(us){
  85. $.post('{php echo url('account/permission', array('uniacid' => $_W['uniacid'], 'reference' => $_GPC['reference']));}', {'do': 'auth', uid: us}, function(dat){
  86. if(dat == 'success') {
  87. location.href = location.href;
  88. } else {
  89. alert('操作失败, 请稍后重试, 服务器返回信息为: ' + dat);
  90. }
  91. });
  92. },{mode:'invisible'});
  93. {else}
  94. u.message('抱歉,您无法添加操作人员,请联系系统管理员为您添加.');
  95. {/if}
  96. });
  97. $('#btn-revo').click(function(){
  98. {if $_W['isfounder']}
  99. $chks = $(':checkbox.member:checked');
  100. if($chks.length >0){
  101. if(!confirm('确认删除当前选择的用户?')){
  102. return;
  103. }
  104. var ids = [];
  105. $chks.each(function(){
  106. ids.push(this.value);
  107. });
  108. $.post('{php echo url('account/permission', array('uniacid' => $uniacid));}',{'do':'revos', 'ids': ids},function(dat){
  109. if(dat == 'success') {
  110. location.href = location.href;
  111. } else {
  112. alert('操作失败, 请稍后重试, 服务器返回信息为: ' + dat);
  113. }
  114. });
  115. }
  116. {else}
  117. u.message('抱歉,您无法添加操作人员,请联系系统管理员为您添加.');
  118. {/if}
  119. });
  120. });
  121. });
  122. function addUserPanel() {
  123. require(['util'], function(util){
  124. util.ajaxshow('{php echo url('user/create');}', '添加管理员', {'width': 800});
  125. });
  126. }
  127. </script>
  128. {template 'common/footer'}