layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'tree', 'xmSelect', 'laydate'], function () {
    let $ = layui.jquery,
        form = layui.form,
        table = layui.table,
        layer = layui.layer,
        tree = layui.tree,
        laydate = layui.laydate,
        xmSelect = layui.xmSelect,
        miniTab = layui.miniTab;

    /**** index begin ***/
    //index页面
    if ($('.location-index-page').length > 0) {
        miniTab.listen();

        // 渲染表格
        let listUrl = $('#table-container').data('url');
        let insTb = table.render({
            elem: '#table-container',
            toolbar: '#toolbar-tpl',
            defaultToolbar: [],
            url: listUrl,
            method: 'post',
            even: true,
            limits: [10,20,50,100,200,500,1000],
            request: {
                pageName: 'page',
                limitName: 'size',
            },
            parseData: function (res) {
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": res.data.total, //解析数据长度
                    "data": res.data.list //解析数据列表
                };
            },
            page: false,
            cols: [[
                {type: 'checkbox'},
                {field: 'id', width: 100, title: '编号'},
                {field: 'title', minWidth: 200, title: '标题'},
                {field: 'key', minWidth: 150, title: '位置标识'},
                {field: 'created_at', width: 170, title: '创建时间'},
                {templet: '#row-operate', minWidth: 150, field: 'right', align: 'center', title: '操作', fixed: 'right'}
            ]],
            done: function () {
                Tools.setInsTb(insTb);
            }
        });
    }
    /*** index end ***/

});