123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- {include file="public/header" /}
- <body>
- <div class="layui-fluid">
- <div class="layui-card">
- <div class="layui-form layui-card-header layuiadmin-card-header-auto">
- <div class="layui-form-item">
- <!--<div class="layui-inline">-->
- <!--<div class="layui-input-inline">-->
- <!--<input type="text" name="start" class="layui-input" onfocus="wk.lay_date(this);" placeholder="创建开始日期">-->
- <!--</div>-->
- <!--<div class="layui-form-mid">-->
- <!-- - -->
- <!--</div>-->
- <!--<div class="layui-input-inline">-->
- <!--<input type="text" name="end" class="layui-input" onfocus="wk.lay_date(this);" placeholder="创建结束日期">-->
- <!--</div>-->
- <!--</div>-->
- <div class="layui-inline">
- <div class="layui-input-inline">
- <select name="type" lay-search="">
- <option value="">不限类型</option>
- {foreach name="type" item="vo" key="key"}
- <option value="{$key}">{$vo}</option>
- {/foreach}
- </select>
- </div>
- </div>
- <div class="layui-inline">
- <div class="layui-input-inline">
- <select name="group" lay-search="">
- <option value="">不限分组</option>
- {foreach name="group" item="vo" key="key"}
- <option value="{$key}">{$vo}</option>
- {/foreach}
- </select>
- </div>
- </div>
- <div class="layui-inline">
- <div class="layui-input-inline">
- <input type="text" class="layui-input" name="key" placeholder="输入需查询的标题/名称"/>
- </div>
- </div>
- <div class="layui-inline">
- <div class="layui-input-inline">
- <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
- <button class="layui-btn layui-btn-normal" id="empty" lay-submit="" lay-filter="LAY-search">重置</button>
- </div>
- </div>
- </div>
- <div>
- <button class="layui-btn" data-type="add" onclick="wk.layer_show('添加配置','{:url('add_config')}')">
- <i class="fa fa-plus"></i> 添加配置
- </button>
- <span class="layui-btn-dropdown" style="display:inline-block;">
- <button class="layui-btn layui-btn-danger" data-toggle="dropdown"><i class="fa fa-wrench"></i> 批量操作 <i class="fa fa-caret-down"></i></button>
- <ul class="layui-dropdown-menu layui-anim layui-anim-upbit">
- <li><a href="javascript:;" class="layuiBtn" data-type="getCheckData"><i class="fa fa-trash-o"></i> 批量删除 </a></li>
- <li><a href="javascript:;" class="layuiBtn" data-type="usingAll" id="onAll"><i class="fa fa-check-circle"></i> 批量启用</a></li>
- <li><a href="javascript:;" class="layuiBtn" data-type="forbiddenAll" id="offAll"><i class="fa fa-ban"></i> 批量禁用</a></li>
- </ul>
- </span>
- </div>
- </div>
- <div class="layui-card-body">
- <table id="LAY-table-manage" lay-filter="LAY-table-manage"></table>
- <!--操作模板-->
- <script type="text/html" id="opeBar">
- <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>
- <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>
- </script>
- <!--状态模板-->
- <script type="text/html" id="staBar">
- <input type="checkbox" value="{{d.id}}" lay-skin="switch" lay-text="ON|OFF" lay-filter="OnOff"{{ d.status == 1 ? 'checked' : '' }} >
- </script>
- </div>
- </div>
- </div>
- {include file="public/footer" /}
- <script>
- layui.use(['index', 'table'], function () {
- var $ = layui.$
- , form = layui.form
- , table = layui.table
- table.render({
- elem: '#LAY-table-manage'
- , url: '{:url("Config/index")}'
- ,response: {
- statusCode: 220 //成功的状态码,默认:0
- }
- , page: true
- , even: false //开启隔行背景
- , size: 'lg' //sm小尺寸的表格 lg大尺寸
- // ,width:100
- , autoSort: false
- , cellMinWidth: 150
- , height: "full-220"
- , limits: [10, 20, 30, 40, 50]
- , limit: "{:config('pages')}"
- , loading: true
- , id: 'LAY-table'
- , cols: [[
- {type: 'checkbox', fixed: 'left',}
- , {type:'numbers', width: 80, title: '序号'}
- , {field: 'name', width: '', title: '名称', align: 'center'}
- , {field: 'title', width: '', title: '标题', align: 'center'}
- , {field: 'type', width: 80, title: '类型', align: 'center'}
- , {field: 'group', width: 80, title: '分组', align: 'center'}
- , {field: 'create_time', width: '', title: '创建时间', sort: true, align: 'center'}
- , {field: 'update_time', width: '', title: '更新时间', sort: true, align: 'center'}
- , {field: 'status',fixed: 'right', width: 100, title: '状态', align: 'center', templet: '#staBar'}
- , {fixed: 'right', width: 120, title: '操作', align: 'center', toolbar: '#opeBar'}
- ]]
- });
- //监听状态开关操作
- form.on('switch(OnOff)', function (obj) {
- var num = '';
- obj.elem.checked == true? num = 1: num = 2;
- //配置状态
- wk.status(this.value,num, '{:url("status_config")}',obj);
- });
- //事件
- var active = {
- getCheckData: function(){
- //批量删除
- wk.batchDel(getIds(),"{:url('batchDelConfig')}");
- }
- ,forbiddenAll: function(){
- //批量禁用
- wk.batchForbidden(getIds(),2,"{:url('forbiddenConfig')}");
- }
- ,usingAll: function(){
- //批量启用
- wk.usingAll(getIds(),1,"{:url('usingConfig')}");
- }
- };
- $('.layuiBtn').on('click', function () {
- var type = $(this).data('type');
- active[type] ? active[type].call(this) : '';
- });
- var getIds = function () {
- var ids = [];
- var checkStatus = table.checkStatus('LAY-table')
- ,data = checkStatus.data;
- $.each(data,function(index,item){
- ids.push(item['id'])
- });
- return ids;
- }
- });
- </script>
- </body>
- </html>
|