123 lines
5.3 KiB
JavaScript
123 lines
5.3 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/classes_spec/index' + location.search,
|
||
|
add_url: 'school/classes/classes_spec/add',
|
||
|
edit_url: 'school/classes/classes_spec/edit',
|
||
|
del_url: 'school/classes/classes_spec/del',
|
||
|
multi_url: 'school/classes/classes_spec/multi',
|
||
|
import_url: 'school/classes/classes_spec/import',
|
||
|
table: 'school_classes_lib_spec',
|
||
|
}
|
||
|
});
|
||
|
|
||
|
var table = $("#table");
|
||
|
|
||
|
// 初始化表格
|
||
|
table.bootstrapTable({
|
||
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||
|
pk: 'id',
|
||
|
sortName: 'weigh',
|
||
|
columns: [
|
||
|
[
|
||
|
{checkbox: true},
|
||
|
{field: 'id', title: __('Id')},
|
||
|
{field: 'classes_lib_id', title: __('Classes_lib_id')},
|
||
|
{field: 'name', title: __('Name'), operate: 'LIKE'},
|
||
|
{field: 'start_time', title: __('Start_time')},
|
||
|
{field: 'end_time', title: __('End_time')},
|
||
|
{field: 'limit_num', title: __('Limit_num')},
|
||
|
{field: 'sign_num', title: __('Sign_num')},
|
||
|
{field: 'verification_num', title: __('Verification_num')},
|
||
|
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
|
||
|
{field: 'weigh', title: __('Weigh'), operate: false},
|
||
|
{field: 'createtime', title: __('Createtime')},
|
||
|
{field: 'updatetime', title: __('Updatetime')},
|
||
|
{field: 'schoolclasseslib.title', title: __('Schoolclasseslib.title'), operate: 'LIKE'},
|
||
|
{field: 'schoolclasseslib.headimage', title: __('Schoolclasseslib.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);
|
||
|
},
|
||
|
recyclebin: function () {
|
||
|
// 初始化表格参数配置
|
||
|
Table.api.init({
|
||
|
extend: {
|
||
|
'dragsort_url': ''
|
||
|
}
|
||
|
});
|
||
|
|
||
|
var table = $("#table");
|
||
|
|
||
|
// 初始化表格
|
||
|
table.bootstrapTable({
|
||
|
url: 'school/classes/classes_spec/recyclebin' + location.search,
|
||
|
pk: 'id',
|
||
|
sortName: 'id',
|
||
|
columns: [
|
||
|
[
|
||
|
{checkbox: true},
|
||
|
{field: 'id', title: __('Id')},
|
||
|
{field: 'name', title: __('Name'), align: 'left'},
|
||
|
{
|
||
|
field: 'deletetime',
|
||
|
title: __('Deletetime'),
|
||
|
operate: 'RANGE',
|
||
|
addclass: 'datetimerange',
|
||
|
formatter: Table.api.formatter.datetime
|
||
|
},
|
||
|
{
|
||
|
field: 'operate',
|
||
|
width: '130px',
|
||
|
title: __('Operate'),
|
||
|
table: table,
|
||
|
events: Table.api.events.operate,
|
||
|
buttons: [
|
||
|
{
|
||
|
name: 'Restore',
|
||
|
text: __('Restore'),
|
||
|
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
|
||
|
icon: 'fa fa-rotate-left',
|
||
|
url: 'school/classes/classes_spec/restore',
|
||
|
refresh: true
|
||
|
},
|
||
|
{
|
||
|
name: 'Destroy',
|
||
|
text: __('Destroy'),
|
||
|
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
|
||
|
icon: 'fa fa-times',
|
||
|
url: 'school/classes/classes_spec/destroy',
|
||
|
refresh: true
|
||
|
}
|
||
|
],
|
||
|
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;
|
||
|
});
|