baoxiudan.js 5.3 KB
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

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

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                columns: [
                    [
                        {checkbox: true},
                        {field: 'id', title: __('Id'),operate:false},
                        {field: 'order_sn', title: __('Order_sn'),operate:false},
                        // {field: 'user_id', title: __('User_id')}
                        {field: 'user.name', title: __('User.name'),operate:false},
                        {field: 'title', title: __('Title'),operate:false},
                        {field: 'address', title: __('Address'),operate:'LIKE'},
                        // {field: 'zhandian_id', title: __('Zhandian_id')},
                        {field: 'zhandian.zhandian', title: __('Zhandian.zhandian'),operate:'LIKE'},
                        {field: 'colum', title: __('Colum'),operate:'LIKE'},
                        // {field: 'system', title: __('System')},
                        {field: 'xitong.xitong', title: __('Xitong.xitong'),operate:'LIKE'},
                        {field: 'time', title: __('Time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'people_name', title: __('People_name'),operate:false},
                        {field: 'colum_con', title: __('Colum_con'),operate:false},
                        {field: 'images', title: __('Images'), events: Table.api.events.image, formatter: Table.api.formatter.images,operate:false},
                        {field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
                        {field: 'repair_type', title: __('Repair_type'), searchList: {"0":__('Repair_type 0'),"1":__('Repair_type 1'),"2":__('Repair_type 2')}, formatter: Table.api.formatter.normal},
                        {field: 'is_genghuan', title: __('Is_genghuan'), searchList: {"1":__('Is_genghuan 1'),"2":__('Is_genghuan 2')}, formatter: Table.api.formatter.normal,operate:false},
                        {field: 'price', title: __('Price'), searchList: {"0":__('Price 0'),"1":__('Price 1'),"2":__('Price 2'),"3":__('Price 3')}, formatter: Table.api.formatter.normal},
                        {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
                        // {field: 'redio_user_id', title: __('Redio_user_id')},
                        {field: 'redio_time', title: __('Redio_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime,operate:false},
                        {field: 'redio_con', title: __('Redio_con'),operate:false},
                        {field: 'ok_time', title: __('Ok_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'weixiu', title: __('Weixiu'),operate:false},
                        {field: 'jidian', title: __('Jidian'),operate:false},
                        {field: 'holder', title: __('Holder'),operate:false},
                        {field: 'fuwu', title: __('Fuwu'), searchList: {"1":__('Fuwu 1'),"2":__('Fuwu 2'),"3":__('Fuwu 3'),"4":__('Fuwu 4'),"5":__('Fuwu 5')}, formatter: Table.api.formatter.normal,operate:false},
                        {field: 'taiudu', title: __('Taiudu'), searchList: {"1":__('Taiudu 1'),"2":__('Taiudu 2'),"3":__('Taiudu 3'),"4":__('Taiudu 4'),"5":__('Taiudu 5')}, formatter: Table.api.formatter.normal,operate:false},
                        {field: 'talk_up', title: __('Talk_up'),operate:false},
                        {field: 'talk_con', title: __('Talk_con'),operate:false},
                        {field: 'createtime', title: __('Createtime'), operate:false, addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'updatetime', title: __('Updatetime'), operate:false, addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {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;
});