73 lines
4.4 KiB
JavaScript
73 lines
4.4 KiB
JavaScript
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
|
var Controller = {
|
|
index: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: 'zy/activity/index' + location.search,
|
|
add_url: 'zy/activity/add',
|
|
edit_url: 'zy/activity/edit',
|
|
del_url: 'zy/activity/del',
|
|
multi_url: 'zy/activity/multi',
|
|
import_url: 'zy/activity/import',
|
|
table: 'zy_activity',
|
|
}
|
|
});
|
|
|
|
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: '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: '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: '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: 'type', title: __('Type'), formatter: Table.api.formatter.label, searchList: { 0: __('Type0'), 1: __('Type1') } },
|
|
{ field: 'start_time', title: __('Start_time') },
|
|
{ field: 'end_time', title: __('End_time') },
|
|
{ field: 'game_time', title: __('Game_time') },
|
|
{ field: 'limit_num', title: __('Limit_num') },
|
|
{ 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;
|
|
});
|