define(["jquery", "easy-admin"], function ($, ea) {

    let init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'article.cate/index',
        add_url: 'article.cate/add',
        edit_url: 'article.cate/edit',
        delete_url: 'article.cate/delete',
        export_url: 'article.cate/export',
        modify_url: 'article.cate/modify',
    };

    return {
        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: "checkbox"},
                    {field: 'id', width: 80, title: 'ID'},
                    {field: 'title', minWidth: 150, title: '分类名称'},
                    {field: 'sort', width: 100, title: '排序', edit: 'text'},
                    {
                        field: 'status',
                        title: '状态',
                        width: 85,
                        selectList: {0: '禁用', 1: '启用'},
                        templet: ea.table.switch
                    },
                    {field: 'create_time', minWidth: 150, title: '创建时间'},
                    {
                        width: 250,
                        title: '操作',
                        templet: ea.table.tool,
                        operat: ['edit', 'delete']
                    }
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
});