62 lines
3.0 KiB
JavaScript
62 lines
3.0 KiB
JavaScript
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
|
var Controller = {
|
|
index: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: 'zy/club/index' + location.search,
|
|
add_url: 'zy/club/add',
|
|
edit_url: 'zy/club/edit',
|
|
del_url: 'zy/club/del',
|
|
multi_url: 'zy/club/multi',
|
|
import_url: 'zy/club/import',
|
|
table: 'zy_club',
|
|
}
|
|
});
|
|
|
|
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: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content },
|
|
{ field: 'sub_name', title: __('Sub_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content },
|
|
{ field: 'logo', title: __('Logo'),events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false },
|
|
{ field: 'city', title: __('City'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content },
|
|
{ field: 'join_type', title: __('Join_type'), formatter: Table.api.formatter.label, searchList: { 0: __('Join_type0'), 1: __('Join_type1'), 2: __('Join_type2'), 3: __('Join_type3'), 4: __('Join_type4') } },
|
|
{ field: 'user.username', title: __('President') },
|
|
{ field: 'is_public', title: __('Is_public'), formatter: Table.api.formatter.label, searchList: { 0: __('Is_public0'), 1: __('Is_public1'), } },
|
|
{ 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;
|
|
});
|