practice.js 3.9 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/collection/index' + location.search,
  8. table: 'teacher_collection',
  9. }
  10. });
  11. var table = $("#table");
  12. // 初始化表格
  13. table.bootstrapTable({
  14. url: $.fn.bootstrapTable.defaults.extend.index_url,
  15. pk: 'exam_collection_id',
  16. sortName: 'exam_collection_id',
  17. fixedColumns: true,
  18. fixedRightNumber: 1,
  19. searchFormVisible:true,
  20. columns: [
  21. [
  22. {checkbox: true},
  23. {field: 'exam_collection_id', title: __('编号')},
  24. {field: 'sim_type', title: __('Sim_type'),searchList:{"0001":"FZD04B型侦毒器","0002":"FZB006型毒剂报警器","0003":"防化兵用毒剂报警器"},formatter: Table.api.formatter.simtype},
  25. {field: 'question_setting_method', title: __('Question_setting_method'),searchList:{"1":"系统随机","2":"教师自选","3":"任务自选"},formatter: Table.api.formatter.simmethod},
  26. {field: 'exam_collection_type', title: __('Exam_collection_type'),operate: false,formatter: function (value, row, index) {
  27. return '练习';
  28. }
  29. },
  30. {
  31. field: 'exam_collection_state',searchList:{"2":"打开","3":"关闭"},
  32. title: __('Exam_collection_state'),
  33. align: 'center',
  34. table: table,disable:true,
  35. formatter: Table.api.formatter.collectonstate
  36. },
  37. {field: 'exam_collection_name', title: __('Exam_collection_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  38. // {field: 'task_id', title: __('Task_id')},
  39. {field: 'limit_duration', title: __('Limit_duration')},
  40. {field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  41. {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  42. // {field: 'create_user_id', title: __('Create_user_id')},
  43. {field: 'create_by', title: __('Create_by'), operate: 'LIKE'},
  44. {field: 'createtime', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  45. // {field: 'update_by', title: __('Update_by'), operate: 'LIKE'},
  46. // {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  47. // {field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  48. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  49. ]
  50. ]
  51. });
  52. // 为表格绑定事件
  53. Table.api.bindevent(table);
  54. },
  55. add: function () {
  56. Controller.api.bindevent();
  57. },
  58. edit: function () {
  59. Controller.api.bindevent();
  60. },
  61. api: {
  62. bindevent: function () {
  63. Form.api.bindevent($("form[role=form]"));
  64. }
  65. }
  66. };
  67. return Controller;
  68. });