exam.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. search:false,
  22. columns: [
  23. [
  24. {checkbox: true},
  25. // {field: 'exam_id', title: __('Exam_id')},
  26. {field: 'exam_collection_name', title: __('考试名称'),operate: 'like'},
  27. {field: 'sim_type', title: __('Sim_type'),searchList:{"0001":"FZD04B型侦毒器","0002":"FZB006型毒剂报警器","0003":"防化兵用毒剂报警器"},formatter: Table.api.formatter.simtype},
  28. {field: 'user_username', title: __('学员学号'),operate: false},
  29. {field: 'user_nickname', title: __('学员姓名'),operate: false},
  30. {
  31. field: 'user_depart_id',
  32. title: __('Department'),
  33. visible: false,
  34. addclass: 'selectpage',
  35. extend: 'data-source="department/index/index" data-field="name"',
  36. operate: Config.groupIds !=8 ? 'in':false,
  37. formatter: Table.api.formatter.search
  38. },
  39. {field: 'total_score', title: __('Total_score')},
  40. {field: 'starttime', title: __('Start_time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
  41. {field: 'endtime', title: __('End_time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
  42. ]
  43. ]
  44. });
  45. // 为表格绑定事件
  46. Table.api.bindevent(table);
  47. $(document).on('click', '.btn-view', function () {
  48. var ids = Table.api.selectedids(table);
  49. var title = '成绩详情';
  50. Fast.api.open(Fast.api.fixurl("student/exam/view/ids/"+ids), title, { area: ["75%", "95%"] });
  51. });
  52. },
  53. add: function () {
  54. Controller.api.bindevent();
  55. },
  56. edit: function () {
  57. Controller.api.bindevent();
  58. },
  59. api: {
  60. bindevent: function () {
  61. Form.api.bindevent($("form[role=form]"));
  62. }
  63. }
  64. };
  65. return Controller;
  66. });