form.html 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. {extend name="layout:home" /}
  2. {block name="container"}
  3. <form method="post">
  4. <div class="layui-tab layui-tab-card">
  5. <div class="layui-tab-content page-tab-content">
  6. <div class="layui-tab-item layui-show ">
  7. <div class="layui-form-item">
  8. <label class="layui-form-label">{$Think.lang.admin_group_name}</label>
  9. <div class="layui-input-block">
  10. <input type="text" class="layui-input field-name" name="group_name" id="group_name"
  11. value="{$group_info.group_name|default=''}" lay-verify="group_name" autocomplete="off"
  12. placeholder="{:lang('ds_please_enter')}{:lang('admin_group_name')}" required/>
  13. </div>
  14. </div>
  15. <table class="ds-default-table">
  16. <thead>
  17. <tr class="space">
  18. <th><input id="limitAll" value="1" type="checkbox">&nbsp;&nbsp;{$Think.lang.admin_group_set_limt}</th>
  19. </tr>
  20. </thead>
  21. <tbody>
  22. {foreach name="limit" item="v" key="k" }
  23. <tr>
  24. <td>
  25. <label style="width:100px">{$v.nav|default=''}</label>
  26. <input id="limit{$k}" type="checkbox" onclick="selectLimit('limit{$k}')">
  27. <label for="limit{$k}"><b>{$v.name}</b></label>
  28. {foreach name="$v.child" item="xv" key="xk" }
  29. {if condition="$admin_array eq 'add'"}
  30. <label><input dstype='limit' class="limit{$k}" type="checkbox" name="permission[]" value="{$xv.action}">{$xv.name}&nbsp;</label>
  31. {else/}
  32. <label><input dstype="limit{$k}" class="limit{$k}" type="checkbox" name="permission[]" value="{$xv.action}" <?php if(in_array(substr($xv['action'],0,($t=strpos($xv['action'],'|'))?$t:100),$group_info['group_limits'])){ echo "checked=\"checked\""; }?>>{$xv.name}&nbsp;</label>
  33. {/if}
  34. {/foreach}
  35. </td>
  36. </tr>
  37. {/foreach}
  38. </tbody>
  39. </table>
  40. <div class="layui-form-item">
  41. <div class="layui-input-block">
  42. <input type="submit" class="layui-btn layui-btn-normal" lay-submit value="{:lang('ds_submit')}"/>
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. </form>
  49. <script>
  50. function selectLimit(name) {
  51. if ($('#' + name).prop('checked')) {
  52. $('.' + name).prop('checked', true);
  53. } else {
  54. $('.' + name).prop('checked', false);
  55. }
  56. }
  57. $(function () {
  58. $('#limitAll').on('click', function () {
  59. if ($(this).prop('checked')) {
  60. $(this).parents('table').find('input:checkbox').prop('checked', true);
  61. } else {
  62. $(this).parents('table').find('input:checkbox').prop('checked', false);
  63. }
  64. });
  65. });
  66. layui.use('form', function () {
  67. var form = layui.form;
  68. });
  69. </script>
  70. {/block}