121 lines
2.9 KiB
HTML
121 lines
2.9 KiB
HTML
{extend name="common/base"/}
|
|
<!-- 主体 -->
|
|
{block name="body"}
|
|
<div class="body-content">
|
|
<form class="layui-form" style="display: inline;">
|
|
<input type="text" name="keywords" placeholder="ID/标题/标识/备注" class="layui-input"
|
|
autocomplete="off" style="max-width: 320px;display: inline;margin: -10px 10px 0 0;" />
|
|
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交搜索</button>
|
|
</form>
|
|
<table class="layui-hide" id="test" lay-filter="test"></table>
|
|
</div>
|
|
|
|
<script type="text/html" id="status">
|
|
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
|
|
</script>
|
|
<script type="text/html" id="toolbarDemo">
|
|
<div class="layui-btn-container">
|
|
<a class="layui-btn layui-btn-normal layui-btn-sm" href="/admin/slide/add">添加轮播组</a>
|
|
</div>
|
|
</script>
|
|
<script type="text/html" id="barDemo">
|
|
<a class="layui-btn layui-btn-xs" href="/admin/slide/add?id={{d.id}}">编辑</a>
|
|
<a class="layui-btn layui-btn-xs layui-btn-normal" href="/admin/slide/slide_info?id={{d.id}}">管理轮播</a>
|
|
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
|
|
</script>
|
|
{/block}
|
|
<!-- /主体 -->
|
|
|
|
<!-- 脚本 -->
|
|
{block name="script"}
|
|
<script>
|
|
function init(layui) {
|
|
var table = layui.table,
|
|
form = layui.form;
|
|
|
|
var tableIns = table.render({
|
|
elem: '#test',
|
|
title: '轮播组列表',
|
|
toolbar: '#toolbarDemo',
|
|
url: '/admin/slide/get_list', //数据接口
|
|
page: true, //开启分页
|
|
limit: 20,
|
|
cols: [
|
|
[
|
|
{
|
|
field: 'id',
|
|
title: 'ID号',
|
|
align: 'center',
|
|
width: 80
|
|
}, {
|
|
field: 'title',
|
|
title: '标题',
|
|
width: 240
|
|
}, {
|
|
field: 'name',
|
|
title: '标识',
|
|
align: 'center',
|
|
width: 160
|
|
}, {
|
|
field: 'desc',
|
|
title: '备注'
|
|
}, {
|
|
field: 'status',
|
|
title: '状态',
|
|
toolbar: '#status',
|
|
align: 'center',
|
|
width: 80
|
|
}, {
|
|
field: 'right',
|
|
title: '操作',
|
|
toolbar: '#barDemo',
|
|
width: 200,
|
|
align: 'center'
|
|
}
|
|
]
|
|
]
|
|
});
|
|
|
|
//监听行工具事件
|
|
table.on('tool(test)', function (obj) {
|
|
var data = obj.data;
|
|
//console.log(obj)
|
|
if (obj.event === 'del') {
|
|
layer.confirm('确定删除该轮播组吗?', {
|
|
icon: 3,
|
|
title: '提示'
|
|
}, function (index) {
|
|
$.ajax({
|
|
url: "/admin/slide/delete",
|
|
data: {
|
|
id: data.id
|
|
},
|
|
success: function (res) {
|
|
layer.msg(res.msg);
|
|
if (res.code == 1) {
|
|
obj.del();
|
|
}
|
|
}
|
|
})
|
|
layer.close(index);
|
|
});
|
|
}
|
|
});
|
|
|
|
//监听搜索提交
|
|
form.on('submit(webform)', function (data) {
|
|
tableIns.reload({
|
|
where: {
|
|
keywords: data.field.keywords
|
|
},
|
|
page: {
|
|
curr: 1
|
|
}
|
|
});
|
|
return false;
|
|
});
|
|
}
|
|
</script>
|
|
{include file="common/layui" base='base' extend="[]" use="['table','form']" callback="init" /}
|
|
{/block}
|
|
<!-- /脚本 --> |