define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'school/classes/order/service_order_log/index' + location.search,
                    add_url: 'school/classes/order/service_order_log/add',
                    edit_url: 'school/classes/order/service_order_log/edit',
                    del_url: 'school/classes/order/service_order_log/del',
                    multi_url: 'school/classes/order/service_order_log/multi',
                    import_url: 'school/classes/order/service_order_log/import',
                    table: 'school_classes_service_order_log',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                fixedColumns: true,
                fixedRightNumber: 1,
                columns: [
                    [
                        {checkbox: true},
                        {field: 'id', title: __('Id')},
                        {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},

                        {field: 'classes_service_order_id',visible:false, title: __('Classes_service_order_id')},
                        {field: 'classes_order_id',visible:false, title: __('Classes_order_id')},
                        {field: 'user_id',visible:false, title: __('User_id')},
                        {field: 'classes_order_detail_id',visible:false, title: __('Classes_order_detail_id')},
                        {field: 'classes_lib_id',visible:false, title: __('Classes_lib_id')},
                        {field: 'manystore_id',visible:false, title: __('Manystore_id')},
                        {field: 'shop_id',visible:false, title: __('Shop_id')},
                        {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"4":__('Status 4'),"7":__('Status 7'),"-3":__('Status -3')}, formatter: Table.api.formatter.status},
                        {field: 'service_stauts', title: __('Service_stauts'), searchList: {"1":__('Service_stauts 1'),"4":__('Service_stauts 4'),"7":__('Service_stauts 7'),"10":__('Service_stauts 10'),"-3":__('Service_stauts -3')}, formatter: Table.api.formatter.normal},
                        {field: 'sales_type', title: __('Sales_type'), searchList: {"-3":__('Sales_type -3'),"1":__('Sales_type 1'),"4":__('Sales_type 4'),"7":__('Sales_type 7'),"10":__('Sales_type 10')}, formatter: Table.api.formatter.normal},
                        {field: 'log_text', title: __('Log_text'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                        {field: 'oper_id', title: __('Oper_id')},
                        {field: 'oper_type', title: __('Oper_type'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                         {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                        // {field: 'serviceorder.order_no', title: __('Order.order_no'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                        // {field: 'classesorder.order_no', title: __('Order.order_no'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                        // {field: 'classesorder.pay_no', title: __('Order.pay_no'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                        {field: 'user.nickname',visible:false, title: __('User.nickname'), operate: 'LIKE'},
                        {field: 'user.realname',visible:false, title: __('User.realname'), operate: 'LIKE'},
                        {field: 'user.mobile',visible:false, title: __('User.mobile'), operate: 'LIKE'},
                        {field: 'user.avatar',visible:false, title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
                        // {field: 'detail.title', title: __('Detail.title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                        // {field: 'admin.nickname', title: __('Admin.nickname'), operate: 'LIKE'},
                        // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };





    return Controller;
});
