exam.js 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'student/exam/index' + location.search,
  8. table: 'teacher_exams',
  9. }
  10. });
  11. var table = $("#table");
  12. // 初始化表格
  13. table.bootstrapTable({
  14. url: $.fn.bootstrapTable.defaults.extend.index_url,
  15. pk: 'exam_id',
  16. sortName: 'exam_id',
  17. fixedColumns: true,
  18. fixedRightNumber: 1,
  19. searchFormVisible:true,
  20. columns: [
  21. [
  22. {checkbox: true},
  23. {field: 'exam_id', title: __('Exam_id')},
  24. {field: 'exam_collection_id', title: __('Exam_collection_id')},
  25. {field: 'user_id', title: __('User_id')},
  26. {field: 'seat_id', title: __('Seat_id')},
  27. // {field: 'sim_id', title: __('Sim_id')},
  28. {field: 'exam_status', title: __('Exam_status')},
  29. {field: 'total_score', title: __('Total_score')},
  30. // {field: 'deduction_total_score', title: __('Deduction_total_score')},
  31. {field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  32. {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  33. {field: 'login_time', title: __('Login_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  34. // {field: 'logout_time', title: __('Logout_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  35. // {field: 'create_by', title: __('Create_by'), operate: 'LIKE'},
  36. {field: 'createtime', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  37. // {field: 'update_by', title: __('Update_by'), operate: 'LIKE'},
  38. // {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  39. // {field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  40. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  41. ]
  42. ]
  43. });
  44. // 为表格绑定事件
  45. Table.api.bindevent(table);
  46. },
  47. add: function () {
  48. Controller.api.bindevent();
  49. },
  50. edit: function () {
  51. Controller.api.bindevent();
  52. },
  53. api: {
  54. bindevent: function () {
  55. Form.api.bindevent($("form[role=form]"));
  56. }
  57. }
  58. };
  59. return Controller;
  60. });