|
@@ -0,0 +1,64 @@
|
|
|
+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: '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: 'class_id', title: __('Class_id')},
|
|
|
+ {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: 'user.username', title: __('User.username'), operate: 'LIKE'},
|
|
|
+ {field: 'school.schoolname', title: __('School.schoolname'), operate: 'LIKE'},
|
|
|
+ {field: 'classes.classname', title: __('Classes.classname'), operate: 'LIKE'},
|
|
|
+ {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;
|
|
|
+});
|