123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- {include file="common/header"/}
- <div class="LM-container">
- <div class="LM-main">
- <fieldset class="layui-elem-field layui-field-title">
- <legend>日志{:lang('list')}</legend>
- <blockquote class="layui-elem-quote">
- <div class="tabletop">
- <div class="layui-inline">
- <!-- <label class="layui-form-label">搜索{:lang('username')}</label>-->
- <div class="layui-input-inline">
- <input type="text" name="keys" id="keys" lay-verify="required" autocomplete="off"
- class="layui-input">
- </div>
- <button type="submit" class="layui-btn layui-btn-sm" lay-submit lay-filter="submit" id="search">
- {:lang('search')}
- </button>
- <a href="javascript:;" class="layui-btn layui-btn-sm layui-btn-danger" id="delAll">{:lang('delete checked')}</a>
- </div>
- </div>
- </blockquote>
- </fieldset>
- <table class="layui-tab" id="list" lay-filter="list"></table>
- </div>
- </div>
- <script type="text/html" id="action">
- <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">{:lang('del')}</a>
- </script>
- <script type="text/html" id="time">
- {{layui.util.toDateString(d.create_time*1000, 'yyyy-MM-dd HH:mm:ss')}}
- </script>
- {include file="common/footer"/}
- <script>
- layui.use(['form', 'table'], function () {
- var $ = layui.jquery,
- form = layui.form,
- table = layui.table;
- var tableIn = table.render({
- elem: '#list',
- url: '{:url("index")}',
- method: 'post',
- cols: [[
- {checkbox: true, fixed: 'left'},
- {field: 'id', title: 'ID', width: 80, sort: true},
- {field: 'admin_id', title: 'admin_id', width: 80, sort: true},
- {field: 'username', title: '账号', width: 150, sort: true},
- {field: 'log_url', title: '地址', width: 150, templet: '#size', sort: true,},
- {field: 'log_content', title: '内容', width: 150, sort: true,},
- {field: 'log_title', title: '标题', width: 150, sort: true,},
- {field: 'log_agent', title: '浏览器', width: 120, sort: true,},
- {field: 'log_ip', title: 'ip', width: 80},
- {field: 'create_time', title: '时间', width: 180,templet:'#time'},
- {title:'操作',width:100, toolbar: '#action',align:"center"}
- ]],
- limits: [10, 15, 20, 25, 50, 100],
- limit: 15,
- page: true,
- });
- table.on('tool(list)', function(obj) {
- var data = obj.data;
- if(obj.event === 'del'){
- layer.confirm('{:lang("Are you sure you want to delete it")}', function(index){
- var loading = layer.load(1, {shade: [0.1, '#fff']});
- $.post("{:url('delete')}",{id:data.id},function(res){
- layer.close(loading);
- if(res.code===1){
- layer.msg(res.msg,{time:1000,icon:1});
- tableIn.reload({where:{catid:'{:input("catid")}'}});
- }else{
- layer.msg(res.msg,{time:1000,icon:2});
- }
- });
- layer.close(index);
- });
- }
- });
- $('#search').click(function () {
- var $keys = $('#keys').val();
- if(!$keys){
- return layer.msg('请输入关键词');
- }
- tableIn.reload({ page: {page: 1},where: {keys: $keys}});
- });
- $('#delAll').click(function(){
- layer.confirm("{:lang('Are you sure you want to delete it')}", {icon: 3}, function(index) {
- layer.close(index);
- var checkStatus = table.checkStatus('list'); //test即为参数id设定的值
- var ids = [];
- console.log(checkStatus.data)
- $(checkStatus.data).each(function (index, item) {
- ids.push(item.id);
- });
- if(ids==''){
- layer.msg("{:lang('please choose data')}", {time: 1000, icon: 2});
- return false;
- }
- var loading = layer.load(1, {shade: [0.1, '#fff']});
- $.post("{:url('delete')}", {id: ids}, function (res) {
- layer.close(loading);
- if (res.code > 0) {
- layer.msg(res.msg, {time: 1000, icon: 1});
- tableIn.reload();
- } else {
- layer.msg(res.msg, {time: 1000, icon: 2});
- }
- });
- });
- })
- });
- </script>
|