<title>文章表</title>
<!--当前位置开始-->
<div class="layui-card layadmin-header">
    <div class="layui-breadcrumb" lay-filter="breadcrumb">
        <script type="text/html" template lay-done="layui.data.updateMainBreadcrumb();">
        </script>
    </div>
</div>
<!--当前位置结束-->
<style>
    /* 重写样式 */
</style>
<script type="text/html" template lay-type="Post" lay-url="{{ layui.setter.apiUrl }}Api/CoreCmsArticle/GetIndex" lay-done="layui.data.done(d);">
    <div class="layui-form coreshop-search-form">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label" for="title">标题</label>
                <div class="layui-input-inline">
                    <input type="text" name="title" id="title" placeholder="请输入标题" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-CoreCmsArticle-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
            </div>
        </div>
    </div>
</script>
<div class="table-body">
    <table id="LAY-app-CoreCmsArticle-tableBox" lay-filter="LAY-app-CoreCmsArticle-tableBox"></table>
</div>

<script type="text/html" id="LAY-app-CoreCmsArticle-tableBox-bar">
    <a class="layui-bt layui-btn-xs" lay-event="selectArticle">选择</a>
</script>

<script>
    var indexData;
    var debug = layui.setter.debug;
    layui.data.done = function (d) {
        //开启调试情况下获取接口赋值数据
        if (debug) { console.log(d); }

        indexData = d.data;
        layui.use(['index', 'table', 'laydate', 'util', 'coreHelper'],
            function () {
                var $ = layui.$
                    , admin = layui.admin
                    , table = layui.table
                    , form = layui.form
                    , laydate = layui.laydate
                    , setter = layui.setter
                    , coreHelper = layui.coreHelper
                    , util = layui.util
                    , view = layui.view;

                //重载form
                form.render();
                var searchwhere;
                //监听搜索
                form.on('submit(LAY-app-CoreCmsArticle-search)',
                    function (data) {
                        var field = data.field;
                        searchwhere = field;
                        //执行重载
                        table.reload('LAY-app-CoreCmsArticle-tableBox', { where: field });
                    });
                //数据绑定
                table.render({
                    elem: '#LAY-app-CoreCmsArticle-tableBox',
                    url: layui.setter.apiUrl + 'Api/CoreCmsAdvertisement/GetArticle',
                    method: 'POST',
                    defaultToolbar: ['filter', 'print', 'exports'],
                    height: 'full-189',//无面包屑127,搜索框189,1行62
                    page: true,
                    limit: 30,
                    limits: [10, 15, 20, 25, 30, 50, 100, 200],
                    text: { none: '暂无相关数据' },
                    cols: [
                        [
                            { field: 'id', title: '序列', width: 60, sort: false },
                            { field: 'title', title: '标题', sort: false },
                            { field: 'isPub', title: '是否发布', width: 95, templet: '#switch_isPub', sort: false, unresize: true },
                            { width: 92, align: 'center', title: '操作', fixed: 'right', toolbar: '#LAY-app-CoreCmsArticle-tableBox-bar' }
                        ]
                    ]
                });
            });
    };
</script>

<!--设置是否发布-->
<script type="text/html" id="switch_isPub">
    <input type="checkbox" name="switch_isPub" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="switch_isPub" {{ d.isPub ? 'checked' : '' }}>
</script>