58 lines
2.6 KiB
JavaScript
58 lines
2.6 KiB
JavaScript
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
|
var Controller = {
|
|
index: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: 'school/classes/virtual_user/index' + location.search,
|
|
add_url: 'school/classes/virtual_user/add'+ location.search,
|
|
edit_url: 'school/classes/virtual_user/edit'+ location.search,
|
|
del_url: 'school/classes/virtual_user/del',
|
|
multi_url: 'school/classes/virtual_user/multi',
|
|
import_url: 'school/classes/virtual_user/import',
|
|
table: 'school_virtual_user',
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
|
|
// 初始化表格
|
|
table.bootstrapTable({
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
pk: 'id',
|
|
sortName: 'id',
|
|
columns: [
|
|
[
|
|
{checkbox: true},
|
|
// {field: 'id', title: __('Classes_lib_id')},
|
|
{field: 'id', title: __('Id')},
|
|
{field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
|
|
{field: 'head_image', title: __('Head_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
|
{field: 'classes_lib_id', title: __('Classes_lib_id')},
|
|
{field: 'time', title: __('Time'),operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
{field: 'lib.title', title: __('Lib.title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'lib.headimage', title: __('Lib.headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
|
{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;
|
|
});
|