exam.js 5.3 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_collection_name', title: __('考试名称')},
  25. {field: 'sim_type', title: __('Sim_type'),searchList:{"0001":"FZD04B型侦毒器","0002":"FZB006型毒剂报警器","0003":"防化兵用毒剂报警器"},formatter: Table.api.formatter.simtype},
  26. {field: 'user_username', title: __('学员学号')},
  27. {field: 'user_nickname', title: __('学员姓名')},
  28. {
  29. field: 'user_depart_id',
  30. title: __('Department'),
  31. visible: false,
  32. addclass: 'selectpage',
  33. extend: 'data-source="department/index/index" data-field="name"',
  34. operate: Config.groupIds !=8 ? 'in':false,
  35. formatter: Table.api.formatter.search
  36. },
  37. // {
  38. // field: 'dadmin',
  39. // title: __('Department'),
  40. // formatter: function (value, row, index) {
  41. // if (value.length == 0)
  42. // return '-' ;
  43. // var department="";
  44. // $.each(value,function(i,v){ //arrTmp数组数据
  45. // if (v.department){
  46. // department+=department?','+v.department.name:v.department.name;
  47. // }
  48. // });
  49. // return Table.api.formatter.flag.call(this, department, row, index);
  50. // }, operate:false
  51. // },
  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'),searchList: {"0":"未登录","1":"已登录","2":"模拟器检查并下发故障中","3":"模拟器正常","4":"答题中","5":"已交卷","6":"计算成绩中","7":"获取到成绩报告","80":"教师标记缺考","81":"登录未开始答题","90":"模拟器异常结束"},formatter: Table.api.formatter.simexamstatus},
  57. {field: 'total_score', title: __('Total_score')},
  58. // {field: 'deduction_total_score', title: __('Deduction_total_score')},
  59. {field: 'starttime', title: __('Start_time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
  60. {field: 'endtime', title: __('End_time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
  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. });