exams.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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: 'teacher/exams/index' + location.search,
  8. add_url: 'teacher/exams/add',
  9. edit_url: 'teacher/exams/edit',
  10. del_url: 'teacher/exams/del',
  11. multi_url: 'teacher/exams/multi',
  12. import_url: 'teacher/exams/import',
  13. table: 'teacher_exams',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'exam_id',
  21. sortName: 'exam_id',
  22. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. searchFormVisible:true,
  25. columns: [
  26. [
  27. {checkbox: true},
  28. {field: 'exam_id', title: __('Exam_id')},
  29. {field: 'exam_collection_id', title: __('Exam_collection_id')},
  30. {field: 'user_id', title: __('User_id')},
  31. {field: 'seat_id', title: __('Seat_id')},
  32. // {field: 'sim_id', title: __('Sim_id')},
  33. {field: 'exam_status', title: __('Exam_status')},
  34. {field: 'total_score', title: __('Total_score')},
  35. // {field: 'deduction_total_score', title: __('Deduction_total_score')},
  36. {field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  37. {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  38. {field: 'login_time', title: __('Login_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  39. // {field: 'logout_time', title: __('Logout_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  40. // {field: 'create_by', title: __('Create_by'), operate: 'LIKE'},
  41. {field: 'createtime', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  42. // {field: 'update_by', title: __('Update_by'), operate: 'LIKE'},
  43. // {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  44. // {field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  45. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  46. ]
  47. ]
  48. });
  49. // 为表格绑定事件
  50. Table.api.bindevent(table);
  51. },
  52. add: function () {
  53. Controller.api.bindevent();
  54. },
  55. edit: function () {
  56. Controller.api.bindevent();
  57. },
  58. api: {
  59. bindevent: function () {
  60. Form.api.bindevent($("form[role=form]"));
  61. }
  62. }
  63. };
  64. return Controller;
  65. });