<script type="text/html" template 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-ArticleTable-TableBox" lay-filter="LAY-app-CoreCmsArticle-ArticleTable-TableBox"></table>
</div>

<script>
    var debug = layui.setter.debug;
    layui.data.done = function (d) {
        //开启调试情况下获取接口赋值数据
        if (debug) { console.log(d); }
        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-ArticleTable-TableBox', { where: field });
                    });
                //数据绑定
                table.render({
                    elem: '#LAY-app-CoreCmsArticle-ArticleTable-TableBox',
                    url: layui.setter.apiUrl + 'Api/Tools/GetArticles',
                    method: 'POST',
                    defaultToolbar: ['filter', 'print', 'exports'],
                    height: '380px',//无面包屑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 },
                            { width: 150, title: '操作', align: 'center', toolbar: '#articleBar' }
                        ]
                    ]
                });
            });
    };
</script>
<script type="text/html" id="articleBar">
    <a class="layui-btn layui-btn-xs" lay-event="selectArticle">选择</a>
</script>