exam.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. singleSelect : true,
  21. columns: [
  22. [
  23. {checkbox: true},
  24. {field: 'exam_id', title: __('Exam_id')},
  25. {field: 'exam_collection_name', title: __('考试名称')},
  26. {field: 'sim_type', title: __('Sim_type'),searchList:{"0001":"FZD04B型侦毒器","0002":"FZB006型毒剂报警器","0003":"防化兵用毒剂报警器"},formatter: Table.api.formatter.simtype},
  27. {field: 'user_username', title: __('学员学号')},
  28. {field: 'user_nickname', title: __('学员姓名')},
  29. {
  30. field: 'user_depart_id',
  31. title: __('Department'),
  32. visible: false,
  33. addclass: 'selectpage',
  34. extend: 'data-source="department/index/index" data-field="name"',
  35. operate: Config.groupIds !=8 ? 'in':false,
  36. formatter: Table.api.formatter.search
  37. },
  38. // {
  39. // field: 'dadmin',
  40. // title: __('Department'),
  41. // formatter: function (value, row, index) {
  42. // if (value.length == 0)
  43. // return '-' ;
  44. // var department="";
  45. // $.each(value,function(i,v){ //arrTmp数组数据
  46. // if (v.department){
  47. // department+=department?','+v.department.name:v.department.name;
  48. // }
  49. // });
  50. // return Table.api.formatter.flag.call(this, department, row, index);
  51. // }, operate:false
  52. // },
  53. // {field: 'exam_collection_id', title: __('Exam_collection_id')},
  54. // {field: 'user_id', title: __('User_id')},
  55. // {field: 'seat_id', title: __('Seat_id')},
  56. // {field: 'sim_id', title: __('Sim_id')},
  57. {field: 'exam_status', title: __('Exam_status'),searchList: {"0":"未登录","1":"已登录","2":"模拟器检查并下发故障中","3":"模拟器正常","4":"答题中","5":"已交卷","6":"计算成绩中","7":"获取到成绩报告","80":"教师标记缺考","81":"登录未开始答题","90":"模拟器异常结束"},formatter: Table.api.formatter.simexamstatus},
  58. {field: 'total_score', title: __('Total_score')},
  59. // {field: 'deduction_total_score', title: __('Deduction_total_score')},
  60. {field: 'starttime', title: __('Start_time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
  61. {field: 'endtime', title: __('End_time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
  62. // {field: 'login_time', title: __('Login_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  63. // {field: 'logout_time', title: __('Logout_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  64. // {field: 'create_by', title: __('Create_by'), operate: 'LIKE'},
  65. // {field: 'createtime', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  66. // {field: 'update_by', title: __('Update_by'), operate: 'LIKE'},
  67. // {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  68. // {field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  69. // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  70. ]
  71. ]
  72. });
  73. // 为表格绑定事件
  74. Table.api.bindevent(table);
  75. $(document).on('click', '.btn-view', function () {
  76. var ids = Table.api.selectedids(table);
  77. var title = '成绩详情';
  78. Fast.api.open(Fast.api.fixurl("student/exam/view/ids/"+ids), title, { area: ["60%", "95%"] });
  79. });
  80. },
  81. add: function () {
  82. Controller.api.bindevent();
  83. },
  84. edit: function () {
  85. Controller.api.bindevent();
  86. },
  87. api: {
  88. bindevent: function () {
  89. Form.api.bindevent($("form[role=form]"));
  90. }
  91. }
  92. };
  93. return Controller;
  94. });