人人商城

module-permission.html 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. {template 'common/header-gw'}
  2. <style>
  3. .left-div{width:120px;overflow:hidden}
  4. .right-fa{width:20px;}
  5. .pad-left {padding-left:50px;height:30px;line-height:30px;background:url('./resource/images/bg_repno.gif') no-repeat -245px -545px;}
  6. .pad-bottom {padding-left:50px;height:30px;line-height:30px;background:url('./resource/images/bg_repno.gif') no-repeat -245px -595px;}
  7. .add{cursor:pointer;padding-top:5px;}
  8. .position{display:inline-block;width:100px;}
  9. </style>
  10. <ol class="breadcrumb">
  11. <li><a href="./?refresh"><i class="fa fa-home"></i></a></li>
  12. <li><a href="{url 'system/welcome'}">系统</a></li>
  13. <li class="active">模块权限</li>
  14. </ol>
  15. <ul class="nav nav-tabs">
  16. <li><a href="{php echo url('extension/menu');}">菜单列表</a></li>
  17. <li class="active"><a href="{php echo url('extension/menu/module');}">模块菜单</a></li>
  18. </ul>
  19. {if $do == 'module'}
  20. <div class="clearfix">
  21. <h5 class="page-header">设置权限验证</h5>
  22. <form action="" method="post" class="form-horizontal">
  23. <div class="panel">
  24. <div class="panel-body table-responsive">
  25. <table class="table">
  26. <thead>
  27. <tr>
  28. <th width="90">排序</th>
  29. <th width="300">模块名称</th>
  30. <th width="300">图标</th>
  31. <th>链接地址</th>
  32. <th style="text-align:center">操作</th>
  33. </tr>
  34. </thead>
  35. <tbody>
  36. {loop $modules $module}
  37. {if !empty($module['entry'])}
  38. <tr>
  39. <td></td>
  40. <td colspan="4"><span class="label label-success">{$module['title']}</span></td>
  41. </tr>
  42. {if !empty($module['entry']['menu'])}
  43. {loop $module['entry']['menu'] $menu}
  44. <tr>
  45. <input type="hidden" name="eid[]" value="{$menu['eid']}"/>
  46. <input type="hidden" name="entry[]" value="menu"/>
  47. <input type="hidden" name="url[]" value=""/>
  48. <td>
  49. <input type="text" name="displayorder[]" value="{$menu['displayorder']}" class="form-control" style="width:80px">
  50. </td>
  51. <td><div class="pad-left"> <span class="text-success position">业务功能菜单</span>{$menu['title']}</div></td>
  52. <td>
  53. <div class="input-group" style="width:250px">
  54. <input type="text" class="form-control" name="icon[]" value="{$menu['icon']}"/>
  55. <span class="input-group-addon"><i class="{$menu['icon']}"></i></span>
  56. <span class="input-group-btn">
  57. <button class="btn btn-default showIconDialog" type="button">图标</button>
  58. </span>
  59. </div>
  60. </td>
  61. <td></td>
  62. <td></td>
  63. </tr>
  64. {/loop}
  65. {/if}
  66. {if !empty($module['entry']['mine'])}
  67. {loop $module['entry']['mine'] $mine}
  68. <tr>
  69. <input type="hidden" name="eid[]" value="{$mine['eid']}"/>
  70. <input type="hidden" name="entry[]" value="mine"/>
  71. <td>
  72. <input type="text" name="displayorder[]" value="{$mine['displayorder']}" class="form-control" style="width:80px">
  73. </td>
  74. <td><div class="pad-left"> <span class="text-danger position">自定义菜单</span>{$mine['title']}</div></td>
  75. <td>
  76. <div class="input-group" style="width:250px">
  77. <input type="text" class="form-control" name="icon[]" value="{$mine['icon']}"/>
  78. <span class="input-group-addon"><i class="{$mine['icon']}"></i></span>
  79. <span class="input-group-btn">
  80. <button class="btn btn-default showIconDialog" type="button">图标</button>
  81. </span>
  82. </div>
  83. </td>
  84. <td>
  85. <input type="text" name="url[]" value="{$mine['url']}" class="form-control" style="width:300px">
  86. </td>
  87. <td align="center">
  88. <a href="javascript:;" class="btn btn-danger del-eid" data-id="{$mine['eid']}">删除</a>
  89. </td>
  90. </tr>
  91. {/loop}
  92. {/if}
  93. <tr>
  94. <td></td>
  95. <td colspan="4">
  96. <div class="pad-bottom pull-left"></div>
  97. <div class="pull-left add" data-module="{$module['name']}">
  98. <i class="fa fa-plus-circle"></i> 自定义菜单
  99. </div>
  100. </td>
  101. </tr>
  102. {/if}
  103. {/loop}
  104. </tbody>
  105. </table>
  106. </div>
  107. </div>
  108. <input type="submit" name="submit" class="btn btn-primary" value="提交"/>
  109. <input type="hidden" name="token" value="{$_W['token']}"/>
  110. </form>
  111. </div>
  112. {/if}
  113. <script>
  114. require(['util'], function(u){
  115. $('.title').hover(function(){
  116. $(this).tooltip('show');
  117. },function(){
  118. $(this).tooltip('hide');
  119. });
  120. $('.table').on('click', '.showIconDialog', function(){
  121. var btn = $(this);
  122. var spview = btn.parent().prev();
  123. var ipt = spview.prev();
  124. if(!ipt.val()){
  125. spview.css("display", "none");
  126. }
  127. u.iconBrowser(function(ico){
  128. ipt.val(ico);
  129. spview.show();
  130. spview.find("i").attr("class","");
  131. spview.find("i").addClass("fa").addClass(ico);
  132. });
  133. });
  134. $('.add').click(function(){
  135. var module = $(this).attr('data-module');
  136. var html =
  137. '<tr>' +
  138. '<input name="add_module[]" value="'+module+'" type="hidden">' +
  139. '<td><input style="width:80px;" type="text" name="add_displayorder[]" value="0" class="form-control"></td>' +
  140. '<td>' +
  141. '<div class="pad-left">' +
  142. '<input style="width:100px;" placeholder="菜单名称" type="text" name="add_title[]" value="" class="form-control">' +
  143. '</div>' +
  144. '</td>' +
  145. '<td>' +
  146. '<div class="input-group" style="width:300px">' +
  147. '<input type="text" class="form-control" name="add_icon[]" value="fa fa-puzzle-piece"/>' +
  148. '<span class="input-group-addon"><i class="fa fa-puzzle-piece"></i></span>' +
  149. '<span class="input-group-btn">' +
  150. '<button class="btn btn-default showIconDialog" type="button">图标</button>' +
  151. '</span>' +
  152. '</div>' +
  153. '</td>' +
  154. '<td><input style="width:300px;" placeholder="菜单链接地址" type="text" name="add_url[]" value="" class="form-control"></td>' +
  155. '<td><i class="fa fa-times-circle" onclick="$(this).parents(\'tr\').remove()"></i></td>' +
  156. '</tr>';
  157. $(this).parents('tr').before(html)
  158. });
  159. $('.del-eid').click(function(){
  160. if(!confirm('确认删除吗')) return false;
  161. var eid = $(this).attr('data-id');
  162. if(eid) {
  163. $.post("{php echo url('extension/menu/del_bind')}", {'eid':eid}, function(){
  164. location.reload();
  165. return false;
  166. });
  167. }
  168. });
  169. });
  170. </script>
  171. {template 'common/footer-gw'}