123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- {include file="common/header"/}
- <div class="LM-container">
- <div class="LM-main">
- <fieldset class="layui-elem-field layui-field-title">
- <legend>{:lang('config')}{:lang('list')}</legend>
- <blockquote class="layui-elem-quote">
- <div class="LM-table">
- <div class="layui-inline">
- <input type="text" id='keys' name="keys" lay-verify="required" placeholder="{:lang('pleaseEnter')}" autocomplete="off" class="layui-input">
- </div>
- <a href="javascript:;" class="layui-btn data-add-btn layui-btn-sm" lay-submit="" lay-filter="search" id="search">{:lang('search')}</a>
- <a href="javascript:;" class="layui-btn layui-btn-sm layui-btn-warm" lay-filter="add" id="add">{:lang('add')}{:lang('config')}</a>
- <a href="javascript:;" class="layui-btn layui-btn-sm layui-btn-danger" lay-filter="group" id="group">{:lang('add')}{:lang('config group')}</a>
- <a href="javascript:;" class="layui-btn layui-btn-sm layui-btn-normal" lay-filter="grouplist" id="grouplist">{:lang('config group')}{:lang('list')}</a>
- </div>
- </blockquote>
- </fieldset>
- <table class="layui-table layui-hide" id="list" lay-filter="list"></table>
- </div>
- </div>
- <script type="text/html" id="action">
- <a class="layui-btn layui-btn-xs" lay-event="edit">{:lang('edit')}</a>
- <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">{:lang('del')}</a>
- </script>
- <script type="text/html" id="status">
- <input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="status" {{ d.status == 1 ? 'checked' : '' }}>
- </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("configlist")}',
- method: 'post',
- cols: [[
- {checkbox: true, fixed: true},
- {field: 'id', title: 'ID', width: 80, sort: true},
- {field: 'code', title: '配置键', width: 120,sort: true},
- {field: 'value', title: '配置值', width: 250,sort: true},
- {field: 'type', title: '分组', width: 250,sort: true},
- {field: 'remark', title: '备注', width: 220,sort:true},
- {field: 'status', title: '状态', width: 180, templet:'#status'},
- {title:'操作',width:120, 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;
- var id = data.id;
- if(obj.event === 'del'){
- layer.confirm('{:lang("Are you sure you want to delete it")}', function(index){
- loading =layer.load(1, {shade: [0.1,'#fff']});
- $.post("{:url('configDel')}",{id:data.id},function(res){
- layer.close(loading);
- if(res.code>0){
- layer.msg(res.msg,{time:1000,icon:1});
- obj.del();
- }else{
- layer.msg(res.msg,{time:1000,icon:2});
- }
- });
- });
- }else if(obj.event === 'edit'){
- var index = layer.open({
- type: 2,
- content: '{:url("configEdit")}?id='+id,
- area: ['600px', '800px'],
- maxmin: true
- });
- layer.full(index);
- }
- });
- form.on('switch(status)', function(data){
- loading =layer.load(1, {shade: [0.1,'#fff']});
- $.post("{:url('configState')}",{id:data.value},function(res){
- layer.close(loading);
- if(res.code>0){
- layer.msg(res.msg,{time:1000,icon:1});
- }else{
- layer.msg(res.msg,{time:1000,icon:2});
- }
- });
- });
- $('#search').click(function () {
- var $keys = $('#keys').val();
- if(!$keys){
- return layer.msg('请输入关键词');
- }
- tableIn.reload({ page: {page: 1},where: {keys: $keys}});
- })
- $('#add').click(function () {
- var index = layer.open({
- type: 2,
- content: '{:url("configAdd")}',
- area: ['600px', '800px'],
- maxmin: true
- });
- layer.full(index);
- })
- $('#group').click(function () {
- var index = layer.open({
- type: 2,
- content: '{:url("configGroupAdd")}',
- area: ['600px', '800px'],
- maxmin: true
- });
- layer.full(index);
- })
- $('#grouplist').click(function () {
- var index = layer.open({
- type: 2,
- content: '{:url("configGroup")}',
- area: ['600px', '800px'],
- maxmin: true
- });
- layer.full(index);
- })
- });
- </script>
|