exam.js 4.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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_id', title: __('学员学号')},
  25. {field: 'exam_id', title: __('学员姓名')},
  26. {field: 'exam_id', title: __('模拟器型号')},
  27. {
  28. field: 'user_depart_id',
  29. title: __('Department'),
  30. visible: false,
  31. addclass: 'selectpage',
  32. extend: 'data-source="department/index/index" data-field="name"',
  33. operate: Config.groupIds !=8 ? 'in':false,
  34. formatter: Table.api.formatter.search
  35. },
  36. // {
  37. // field: 'dadmin',
  38. // title: __('Department'),
  39. // formatter: function (value, row, index) {
  40. // if (value.length == 0)
  41. // return '-' ;
  42. // var department="";
  43. // $.each(value,function(i,v){ //arrTmp数组数据
  44. // if (v.department){
  45. // department+=department?','+v.department.name:v.department.name;
  46. // }
  47. // });
  48. // return Table.api.formatter.flag.call(this, department, row, index);
  49. // }, operate:false
  50. // },
  51. {field: 'exam_id', title: __('考试名称')},
  52. {field: 'exam_collection_id', title: __('Exam_collection_id')},
  53. {field: 'user_id', title: __('User_id')},
  54. {field: 'seat_id', title: __('Seat_id')},
  55. // {field: 'sim_id', title: __('Sim_id')},
  56. {field: 'exam_status', title: __('Exam_status')},
  57. {field: 'total_score', title: __('Total_score')},
  58. // {field: 'deduction_total_score', title: __('Deduction_total_score')},
  59. {field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  60. {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  61. // {field: 'login_time', title: __('Login_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  62. // {field: 'logout_time', title: __('Logout_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  63. // {field: 'create_by', title: __('Create_by'), operate: 'LIKE'},
  64. // {field: 'createtime', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  65. // {field: 'update_by', title: __('Update_by'), operate: 'LIKE'},
  66. // {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  67. // {field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  68. // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  69. ]
  70. ]
  71. });
  72. // 为表格绑定事件
  73. Table.api.bindevent(table);
  74. },
  75. add: function () {
  76. Controller.api.bindevent();
  77. },
  78. edit: function () {
  79. Controller.api.bindevent();
  80. },
  81. api: {
  82. bindevent: function () {
  83. Form.api.bindevent($("form[role=form]"));
  84. }
  85. }
  86. };
  87. return Controller;
  88. });