exam.js 3.2 KB

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