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

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

    let Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: "checkbox"},
                    {field: 'id', width: 80, title: 'ID'},
                    {field: 'title', minWidth: 200, title: '文章标题'},
                    {field: 'cate_name', width: 120, title: '分类'},
                    {field: 'author', width: 100, title: '作者'},
                    {field: 'sort', width: 80, 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();
        },

    };

    return Controller;
});