77 lines
4.7 KiB
JavaScript
77 lines
4.7 KiB
JavaScript
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
|
var Controller = {
|
|
index: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: 'zy/game/index' + location.search,
|
|
add_url: 'zy/game/add',
|
|
edit_url: 'zy/game/edit',
|
|
del_url: 'zy/game/del',
|
|
multi_url: 'zy/game/multi',
|
|
import_url: 'zy/game/import',
|
|
table: 'zy_game',
|
|
}
|
|
});
|
|
|
|
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: 'pid', title: __('Pid')},
|
|
{field: 'activity.name', title: __('Activity.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'stadium.name', title: __('Stadium.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'club.name', title: __('Club.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{ field: 'is_public', title: __('Is_public'), formatter: Table.api.formatter.label, searchList: { 0: __('Is_public0'), 1: __('Is_public1') } },
|
|
{ field: 'team_type', title: __('Team_type'), formatter: Table.api.formatter.label, searchList: { 3: __('Team_type3'), 1: __('Team_type1'), 2: __('Team_type2') } },
|
|
{ field: 'rule_type', title: __('Rule_type'), formatter: Table.api.formatter.label, searchList: { 1: __('Rule_type1'), 2: __('Rule_type2'), 3: __('Rule_type3'), 4: __('Rule_type4'), 5: __('Rule_type5'), 6: __('Rule_type6') } },
|
|
{ field: 'week', title: __('Week'), formatter: Table.api.formatter.label, searchList: { 0: __('Week0'), 1: __('Week1'), 2: __('Week2'), 3: __('Week3'), 4: __('Week4'), 5: __('Week5'), 6: __('Week6') } },
|
|
{field: 'date', title: __('Date'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
|
{field: 'start_time', title: __('Start_time')},
|
|
{field: 'end_time', title: __('End_time')},
|
|
{field: 'game_time', title: __('Game_time'), operate:'BETWEEN'},
|
|
{field: 'address', title: __('Address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'field', title: __('Field'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'limit_num', title: __('Limit_num')},
|
|
{field: 'join_num', title: __('Join_num')},
|
|
{field: 'attention', title: __('Attention')},
|
|
{ field: 'is_bring', title: __('Is_bring'), formatter: Table.api.formatter.label, searchList: { 0: __('Is_bring0'), 1: __('Is_bring1') } },
|
|
{field: 'bring_num', title: __('Bring_num')},
|
|
{ field: 'status', title: __('Status'), formatter: Table.api.formatter.label, searchList: { 0: __('Status0'), 1: __('Status1') } },
|
|
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
|
{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
|
|
|
{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;
|
|
});
|