practice.js 4.1 KB

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