123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- {include file="common/header"/}
- <div class="LM-container">
- <div class="LM-main">
- <fieldset class="layui-elem-field layui-field-title">
- <legend>{:lang('admin')}{:lang('list')}</legend>
- <blockquote class="layui-elem-quote">
- <div class="LM-table">
- <div class="layui-inline">
- <input type="text" name="keys" id="keys" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
- </div>
- <button class="layui-btn data-add-btn layui-btn-sm" lay-submit="" lay-filter="add" id="search">搜索</button>
- <a href="{:url('adminAdd')}" class="layui-btn layui-btn-sm layui-btn-warm">{:lang('add')}{:lang('admin')}</a>
- </div>
- </blockquote>
- </fieldset>
- <table class="layui-table" id="list" lay-filter="list"></table>
- </div>
- </div>
- {include file="common/footer"/}
- <script type="text/html" id="action">
- <a href="{:url('adminEdit')}?id={{d.id}}" class="layui-btn layui-btn-xs">{:lang('edit')}</a>
- {{# if(d.id==1){ }}
- <a href="#" class="layui-btn layui-btn-xs layui-btn-disabled">{:lang('del')}</a>
- {{# }else{ }}
- <a href="#" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">{:lang('del')}</a>
- {{# } }}
- </script>
- <script type="text/html" id="status">
- {{# if(d.id==1){ }}
- <input type="checkbox" disabled name="status" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="status" checked>
- {{# }else{ }}
- <input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="status" {{ d.status == 1 ? 'checked' : '' }}>
- {{# } }}
- </script>
- <script>
- layui.use(['table','form','layer'], function() {
- var table = layui.table,form = layui.form,$ = layui.jquery;
- var tableIn = table.render({
- elem: '#list',
- url: '{:url("adminList")}',
- method:'post',
- title:'{:lang("admin")}{:lang("list")}',
- cols: [[
- {field:'id', title: 'ID', width:100,fixed: true}
- ,{field:'username', title: '用户名', width:180}
- ,{field:'title', title: '{:lang("adminGroup")}', width:100}
- // ,{field:'email', title: '{:lang("email")}', width:200}
- ,{field:'mobile', title: '{:lang("mobile")}', width:150}
- ,{field:'ip', title: '{:lang("ip")}',width:150,hide:true}
- ,{field:'status', title: '{:lang("status")}',width:150,toolbar: '#status'}
- ,{title:'操作',width:150, toolbar: '#action',align:"center"}
- ]],
- limits: [10, 15, 20, 25, 50, 100],
- limit: 10,
- page: true
- });
- form.on('switch(status)', function(obj){
- loading =layer.load(1, {shade: [0.1,'#fff']});
- var id = this.value;
- var is_open = obj.elem.checked===true?1:0;
- $.post('{:url("adminState")}',{'id':id,'is_open':is_open},function (res) {
- layer.close(loading);
- if (res.code>0) {
- tableIn.reload();
- }else{
- layer.msg(res.msg,{time:1000,icon:2});
- return false;
- }
- })
- });
- 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){
- $.post("{:url('adminDel')}",{id:data.id},function(res){
- if (res.code>0) {
- layer.msg(res.msg,{time:1000,icon:1});
- obj.del();
- }else{
- layer.msg(res.msg,{time:1000,icon:2});
- }
- });
- layer.close(index);
- });
- }
- });
- $('#LM-add').click(function () {
- var index = layer.open({
- type: 2,
- content: '{:url("adminAdd")}',
- area: ['800px', '600px'],
- maxmin: true
- });
- layer.full(index);
- })
- $('#search').click(function () {
- var $keys = $('#keys').val();
- if(!$keys){
- return layer.msg('请输入关键词');
- }
- tableIn.reload({ page: {page: 1},where: {keys: $keys}});
- })
- });
- </script>
|