<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="name">表单名称</label>
                <div class="layui-input-inline">
                    <input type="text" name="name" id="name" placeholder="请输入表单名称" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-CoreCmsForm-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
            </div>
        </div>
    </div>
</script>
<div class="table-body">
    <table id="LAY-app-CoreCmsForm-FormTable-TableBox" lay-filter="LAY-app-CoreCmsForm-FormTable-TableBox"></table>
</div>

<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-CoreCmsForm-search)',
                    function (data) {
                        var field = data.field;
                        searchwhere = field;
                        //执行重载
                        table.reload('LAY-app-CoreCmsForm-FormTable-TableBox', { where: field });
                    });
                //数据绑定
                table.render({
                    elem: '#LAY-app-CoreCmsForm-FormTable-TableBox',
                    url: layui.setter.apiUrl + 'Api/Tools/GetForms',
                    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: 'name', title: '表单名称', sort: false, width: 105 },
                            { field: 'type', title: '表单类型', sort: false, width: 105 },
                            { width: 150, title: '操作', align: 'center', toolbar: '#formBar' }

                        ]
                    ]
                });
            });
    };
</script>
<script type="text/html" id="formBar">
    <a class="layui-btn layui-btn-xs" lay-event="selectform">选择</a>
</script>