index.html 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. {include file="public/header" /}
  2. <body>
  3. <div class="layui-fluid">
  4. <div class="layui-card">
  5. <div class="layui-form layui-card-header layuiadmin-card-header-auto">
  6. <div class="layui-form-item">
  7. <!--<div class="layui-inline">-->
  8. <!--<div class="layui-input-inline">-->
  9. <!--<input type="text" name="start" class="layui-input" onfocus="wk.lay_date(this);" placeholder="创建开始日期">-->
  10. <!--</div>-->
  11. <!--<div class="layui-form-mid">-->
  12. <!-- - -->
  13. <!--</div>-->
  14. <!--<div class="layui-input-inline">-->
  15. <!--<input type="text" name="end" class="layui-input" onfocus="wk.lay_date(this);" placeholder="创建结束日期">-->
  16. <!--</div>-->
  17. <!--</div>-->
  18. <div class="layui-inline">
  19. <div class="layui-input-inline">
  20. <select name="type" lay-search="">
  21. <option value="">不限类型</option>
  22. {foreach name="type" item="vo" key="key"}
  23. <option value="{$key}">{$vo}</option>
  24. {/foreach}
  25. </select>
  26. </div>
  27. </div>
  28. <div class="layui-inline">
  29. <div class="layui-input-inline">
  30. <select name="group" lay-search="">
  31. <option value="">不限分组</option>
  32. {foreach name="group" item="vo" key="key"}
  33. <option value="{$key}">{$vo}</option>
  34. {/foreach}
  35. </select>
  36. </div>
  37. </div>
  38. <div class="layui-inline">
  39. <div class="layui-input-inline">
  40. <input type="text" class="layui-input" name="key" placeholder="输入需查询的标题/名称"/>
  41. </div>
  42. </div>
  43. <div class="layui-inline">
  44. <div class="layui-input-inline">
  45. <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
  46. <button class="layui-btn layui-btn-normal" id="empty" lay-submit="" lay-filter="LAY-search">重置</button>
  47. </div>
  48. </div>
  49. </div>
  50. <div>
  51. <button class="layui-btn" data-type="add" onclick="wk.layer_show('添加配置','{:url('add_config')}')">
  52. <i class="fa fa-plus"></i> 添加配置
  53. </button>
  54. <span class="layui-btn-dropdown" style="display:inline-block;">
  55. <button class="layui-btn layui-btn-danger" data-toggle="dropdown"><i class="fa fa-wrench"></i> 批量操作 <i class="fa fa-caret-down"></i></button>
  56. <ul class="layui-dropdown-menu layui-anim layui-anim-upbit">
  57. <li><a href="javascript:;" class="layuiBtn" data-type="getCheckData"><i class="fa fa-trash-o"></i> 批量删除 </a></li>
  58. <li><a href="javascript:;" class="layuiBtn" data-type="usingAll" id="onAll"><i class="fa fa-check-circle"></i> 批量启用</a></li>
  59. <li><a href="javascript:;" class="layuiBtn" data-type="forbiddenAll" id="offAll"><i class="fa fa-ban"></i> 批量禁用</a></li>
  60. </ul>
  61. </span>
  62. </div>
  63. </div>
  64. <div class="layui-card-body">
  65. <table id="LAY-table-manage" lay-filter="LAY-table-manage"></table>
  66. <!--操作模板-->
  67. <script type="text/html" id="opeBar">
  68. <a class="layui-btn layui-btn-xs" title="编辑" onclick="wk.layer_show('编辑配置','{:url('edit_config')}?id={{d.id}}')"><i class="fa fa-pencil"></i></a>
  69. <a class="layui-btn layui-btn-danger layui-btn-xs" title="删除" onclick="wk.confirm('{{d.id}}','{:url('del_config')}')"><i class="fa fa-trash-o"></i></a>
  70. </script>
  71. <!--状态模板-->
  72. <script type="text/html" id="staBar">
  73. <input type="checkbox" value="{{d.id}}" lay-skin="switch" lay-text="ON|OFF" lay-filter="OnOff"{{ d.status == 1 ? 'checked' : '' }} >
  74. </script>
  75. </div>
  76. </div>
  77. </div>
  78. {include file="public/footer" /}
  79. <script>
  80. layui.use(['index', 'table'], function () {
  81. var $ = layui.$
  82. , form = layui.form
  83. , table = layui.table
  84. table.render({
  85. elem: '#LAY-table-manage'
  86. , url: '{:url("Config/index")}'
  87. ,response: {
  88. statusCode: 220 //成功的状态码,默认:0
  89. }
  90. , page: true
  91. , even: false //开启隔行背景
  92. , size: 'lg' //sm小尺寸的表格 lg大尺寸
  93. // ,width:100
  94. , autoSort: false
  95. , cellMinWidth: 150
  96. , height: "full-220"
  97. , limits: [10, 20, 30, 40, 50]
  98. , limit: "{:config('pages')}"
  99. , loading: true
  100. , id: 'LAY-table'
  101. , cols: [[
  102. {type: 'checkbox', fixed: 'left',}
  103. , {type:'numbers', width: 80, title: '序号'}
  104. , {field: 'name', width: '', title: '名称', align: 'center'}
  105. , {field: 'title', width: '', title: '标题', align: 'center'}
  106. , {field: 'type', width: 80, title: '类型', align: 'center'}
  107. , {field: 'group', width: 80, title: '分组', align: 'center'}
  108. , {field: 'create_time', width: '', title: '创建时间', sort: true, align: 'center'}
  109. , {field: 'update_time', width: '', title: '更新时间', sort: true, align: 'center'}
  110. , {field: 'status',fixed: 'right', width: 100, title: '状态', align: 'center', templet: '#staBar'}
  111. , {fixed: 'right', width: 120, title: '操作', align: 'center', toolbar: '#opeBar'}
  112. ]]
  113. });
  114. //监听状态开关操作
  115. form.on('switch(OnOff)', function (obj) {
  116. var num = '';
  117. obj.elem.checked == true? num = 1: num = 2;
  118. //配置状态
  119. wk.status(this.value,num, '{:url("status_config")}',obj);
  120. });
  121. //事件
  122. var active = {
  123. getCheckData: function(){
  124. //批量删除
  125. wk.batchDel(getIds(),"{:url('batchDelConfig')}");
  126. }
  127. ,forbiddenAll: function(){
  128. //批量禁用
  129. wk.batchForbidden(getIds(),2,"{:url('forbiddenConfig')}");
  130. }
  131. ,usingAll: function(){
  132. //批量启用
  133. wk.usingAll(getIds(),1,"{:url('usingConfig')}");
  134. }
  135. };
  136. $('.layuiBtn').on('click', function () {
  137. var type = $(this).data('type');
  138. active[type] ? active[type].call(this) : '';
  139. });
  140. var getIds = function () {
  141. var ids = [];
  142. var checkStatus = table.checkStatus('LAY-table')
  143. ,data = checkStatus.data;
  144. $.each(data,function(index,item){
  145. ids.push(item['id'])
  146. });
  147. return ids;
  148. }
  149. });
  150. </script>
  151. </body>
  152. </html>