define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'userstudent/index' + location.search,
add_url: 'userstudent/add',
edit_url: 'userstudent/edit',
del_url: 'userstudent/del',
multi_url: 'userstudent/multi',
import_url: 'userstudent/import',
table: 'user_student',
}
});
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: 'user_id', title: __('User_id')},
{field: 'user.username', title: __('User.username'), operate: 'LIKE'},
{field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
{field: 'realname', title: __('Realname'), operate: 'LIKE'},
{field: 'gender', title: __('Gender'), searchList: {"1":__('Gender 1'),"0":__('Gender 0')}, formatter: Table.api.formatter.normal},
{field: 'age', title: __('Age')},
{field: 'school_id', title: __('School_id')},
{field: 'school.schoolname', title: __('School.schoolname'), operate: 'LIKE'},
{field: 'classes_id', title: __('Classes_id')},
{field: 'classes.classname', title: __('Classes.classname'), operate: 'LIKE'},
{field: 'idcard', title: __('Idcard'), operate: 'LIKE'},
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
{field: 'is_default', title: __('Is_default'), searchList: {"1":__('Is_default 1'),"0":__('Is_default 0')}, formatter: Table.api.formatter.normal},
// {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;
});
$("#c-classes_id").data("params", function (obj) {
return {
custom: {school_id: $("#c-school_id").val()}
};
});
$(document).on("change","#c-school_id",function(){
$("#c-classes_id").selectPageClear();
})