exams.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. $('.btn-edit').data('area',['55%','95%']);
  5. // 初始化表格参数配置
  6. Table.api.init({
  7. extend: {
  8. index_url: 'teacher/exams/index' + location.search,
  9. add_url: 'teacher/exams/add',
  10. edit_url: 'teacher/exams/edit',
  11. del_url: 'teacher/exams/del',
  12. multi_url: 'teacher/exams/multi',
  13. import_url: 'teacher/exams/import',
  14. table: 'teacher_exams',
  15. }
  16. });
  17. var table = $("#table");
  18. // 初始化表格
  19. table.bootstrapTable({
  20. url: $.fn.bootstrapTable.defaults.extend.index_url,
  21. pk: 'exam_id',
  22. sortName: 'exam_id',
  23. fixedColumns: true,
  24. fixedRightNumber: 1,
  25. searchFormVisible:true,
  26. columns: [
  27. [
  28. {checkbox: true},
  29. {field: 'exam_id', title: __('Exam_id')},
  30. {field: 'exam_collection_name', title: __('考试名称')},
  31. {field: 'sim_type', title: __('Sim_type'),searchList:{"0001":"FZD04B型侦毒器","0002":"FZB006型毒剂报警器","0003":"防化兵用毒剂报警器"},formatter: Table.api.formatter.simtype},
  32. {field: 'user_username', title: __('学员学号')},
  33. {field: 'user_nickname', title: __('学员姓名')},
  34. {
  35. field: 'user_depart_id',
  36. title: __('Department'),
  37. visible: false,
  38. addclass: 'selectpage',
  39. extend: 'data-source="department/index/index" data-field="name"',
  40. operate: Config.groupIds !=8 ? 'in':false,
  41. formatter: Table.api.formatter.search
  42. },
  43. // {
  44. // field: 'dadmin',
  45. // title: __('Department'),
  46. // formatter: function (value, row, index) {
  47. // if (value.length == 0)
  48. // return '-' ;
  49. // var department="";
  50. // $.each(value,function(i,v){ //arrTmp数组数据
  51. // if (v.department){
  52. // department+=department?','+v.department.name:v.department.name;
  53. // }
  54. // });
  55. // return Table.api.formatter.flag.call(this, department, row, index);
  56. // }, operate:false
  57. // },
  58. // {field: 'exam_collection_id', title: __('Exam_collection_id')},
  59. // {field: 'user_id', title: __('User_id')},
  60. // {field: 'seat_id', title: __('Seat_id')},
  61. // {field: 'sim_id', title: __('Sim_id')},
  62. {field: 'exam_status', title: __('Exam_status'),searchList: {"0":"未登录","1":"已登录","2":"模拟器检查并下发故障中","3":"模拟器正常","4":"答题中","5":"已交卷","6":"计算成绩中","7":"获取到成绩报告","80":"教师标记缺考","81":"登录未开始答题","90":"模拟器异常结束"},formatter: Table.api.formatter.simexamstatus},
  63. {field: 'total_score', title: __('Total_score')},
  64. // {field: 'deduction_total_score', title: __('Deduction_total_score')},
  65. {field: 'starttime', title: __('Start_time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
  66. {field: 'endtime', title: __('End_time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
  67. // {field: 'login_time', title: __('Login_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  68. // {field: 'logout_time', title: __('Logout_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  69. // {field: 'create_by', title: __('Create_by'), operate: 'LIKE'},
  70. // {field: 'createtime', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  71. // {field: 'update_by', title: __('Update_by'), operate: 'LIKE'},
  72. // {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  73. // {field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  74. {field: 'operate', title: __('Operate'), table: table,
  75. events: Table.api.events.operate,
  76. // formatter: Table.api.formatter.operate
  77. formatter: Table.api.formatter.buttons,
  78. buttons: [
  79. {
  80. name: 'dispatch',
  81. text: '',
  82. icon: 'fa fa-pencil',
  83. title: '编辑',
  84. classname: 'btn btn-success btn-xs btn-magic btn-dialog',
  85. extend: 'data-area=\'["55%","95%"]\'',
  86. url: 'teacher/exams/edit',
  87. }
  88. ],
  89. }
  90. ]
  91. ]
  92. });
  93. // 为表格绑定事件
  94. Table.api.bindevent(table);
  95. $(document).on('click', '.btn-view', function () {
  96. var ids = Table.api.selectedids(table);
  97. var title = '成绩详情';
  98. Fast.api.open(Fast.api.fixurl("teacher/exams/view/ids/"+ids), title, { area: ["60%", "95%"] });
  99. });
  100. },
  101. persent: function () {
  102. Table.api.init({
  103. extend: {
  104. index_url: 'teacher/exams/persent' + location.search,
  105. indexed_url: 'teacher/exams/index' + location.search,
  106. table: 'teacher_exams',
  107. }
  108. });
  109. var table = $("#table");
  110. // 初始化表格
  111. table.bootstrapTable({
  112. url: $.fn.bootstrapTable.defaults.extend.index_url,
  113. pk: 'exam_id',
  114. sortName: 'exam_id',
  115. toolbar: '#toolbar',
  116. fixedColumns: true,
  117. fixedRightNumber: 1,
  118. searchFormVisible:false,
  119. columns: [
  120. [
  121. // {checkbox: true},
  122. {field: '', title: __('更换件')},
  123. {field: '', title: __('学员姓名')},
  124. {field: '', title: __('状态')},
  125. {field: 'endtime', title: __('申请时间'), formatter: Table.api.formatter.datetime, operate: false, addclass: 'datetimerange', sortable: true},
  126. {field: 'operate', title: __('Operate'), table: table,
  127. events: Table.api.events.operate,
  128. // formatter: Table.api.formatter.operate
  129. formatter: Table.api.formatter.buttons,
  130. buttons: [
  131. // {
  132. // name: 'dispatch',
  133. // text: '',
  134. // icon: 'fa fa-pencil',
  135. // title: '编辑',
  136. // classname: 'btn btn-success btn-xs btn-magic btn-dialog',
  137. // extend: 'data-area=\'["55%","95%"]\'',
  138. // url: 'teacher/exams/edit',
  139. // }
  140. ],
  141. }
  142. ]
  143. ]
  144. });
  145. // 为表格绑定事件
  146. Table.api.bindevent(table);
  147. var table1 = $("#table1");
  148. // 初始化表格
  149. table1.bootstrapTable({
  150. url: $.fn.bootstrapTable.defaults.extend.indexed_url,
  151. pk: 'exam_id',
  152. sortName: 'exam_id',
  153. toolbar: '#toolbar1',
  154. fixedColumns: true,
  155. fixedRightNumber: 1,
  156. searchFormVisible:false,
  157. columns: [
  158. [
  159. // {checkbox: true},
  160. {field: '', title: __('座号')},
  161. {field: '', title: __('模拟器状态')},
  162. {field: '', title: __('学员学号')},
  163. {field: '', title: __('学员姓名')},
  164. {field: '', title: __('考试状态')},
  165. {field: '', title: __('考试成绩')},
  166. {field: '', title: __('故障现象')},
  167. {field: '', title: __('故障部位')},
  168. {field: '', title: __('排除方法')},
  169. {field: 'operate', title: __('Operate'), table: table1,
  170. events: Table.api.events.operate,
  171. // formatter: Table.api.formatter.operate
  172. formatter: Table.api.formatter.buttons,
  173. buttons: [
  174. // {
  175. // name: 'dispatch',
  176. // text: '',
  177. // icon: 'fa fa-pencil',
  178. // title: '编辑',
  179. // classname: 'btn btn-success btn-xs btn-magic btn-dialog',
  180. // extend: 'data-area=\'["55%","95%"]\'',
  181. // url: 'teacher/exams/edit',
  182. // }
  183. ],
  184. }
  185. ]
  186. ]
  187. });
  188. // 为表格绑定事件
  189. Table.api.bindevent(table1);
  190. },
  191. add: function () {
  192. Controller.api.bindevent();
  193. },
  194. edit: function () {
  195. Controller.api.bindevent();
  196. },
  197. api: {
  198. bindevent: function () {
  199. Form.api.bindevent($("form[role=form]"));
  200. }
  201. }
  202. };
  203. return Controller;
  204. });