define(['table', 'upload','form'], function (Table,Upload,Form) {
    var User = {
        //Do setup work hereAction
        index: function () {
            window.filterData = {
                "order_id":{value1:Fast.api.query('ids'),symbol:'=','value2':''}
            };
            window.groupOption=Config.groupList;
            window.roleOption=Config.roleList;
            
            Table.api.init({
                extend: {
                    index_url: 'workrecord/select',
                    add_url: null,
                    edit_url: 'workrecord/update',
                    del_url: null,
                    multi_url: 'workrecord/multi',
                    dragsort_url: null,
                    table: 'work_record',
                }
            });

            var table = $("#table");
            var tableOptions = {
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                commonSearch: false,
                search: false,
                columns: [
                    [
                        {checkbox: true},
                        {
                            field: 'id',
                            title: 'ID',
                            filter: "number",
                            sortable: true    // 是否排序
                        },
                        {
                            title: "订单号",
                            field: "order_id"
                        },
                        {
                            title: "开始时间",
                            field: "start_time",
                            formatter:Table.api.formatter.datetime
                        },
                        {
                            title: "结束时间",
                            field: "end_time",
                            formatter:Table.api.formatter.datetime
                        },
                        {
                            title: "状态",
                            field: "status",
                            formatter: Table.api.formatter.switch
                        },
                        {
                            field: 'operate', title: '操作', 
                            table: table, events: Table.api.events.operate, 
                            formatter: Table.api.formatter.operate
                        }
                    ]
                ]
            };
            // 初始化表格
            table.bootstrapTable(tableOptions);
            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        update:function(){
            var form = $('form');
            Form.api.bindevent(form)
        },
        insert:function(){
            var form = $('form');
            Form.api.bindevent(form)
        }
    };
    return User
});