define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'gamepeople/index' + location.search, // add_url: 'gamepeople/add', edit_url: 'gamepeople/edit', // del_url: 'gamepeople/del', // multi_url: 'gamepeople/multi', // import_url: 'gamepeople/import', table: 'game_people', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', fixedColumns: true, fixedRightNumber: 2, columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'user_id', title: __('User_id')}, {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'}, {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'}, {field: 'game_id', title: __('Game_id')}, {field: 'game.name', title: __('Game.name'), operate: 'LIKE'}, {field: 'game_place_id', title: __('Game_place_id')}, {field: 'place.name', title: __('Place.name'), operate: 'LIKE'}, {field: 'price', title: __('Price'), operate: 'LIKE'}, {field: 'group', title: __('Group')}, {field: 'is_leader', title: __('Is_leader'), searchList: {"0":__('Is_leader 0'),"1":__('Is_leader 1')}, formatter: Table.api.formatter.normal}, {field: 'starttime', title: __('Starttime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'endtime', title: __('Endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'num', title: __('Num')}, {field: 'now_num', title: __('Now_num')}, {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status}, {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; });