exams.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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/examing' + 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: 'rel_id',
  114. sortName: 'rel_id',
  115. toolbar: '#toolbar',
  116. fixedColumns: true,
  117. fixedRightNumber: 1,
  118. searchFormVisible:false,
  119. columns: [
  120. [
  121. // {checkbox: true},
  122. {field: 'fault_name', title: __('更换件')},
  123. {field: 'create_by', title: __('学员姓名')},
  124. {field: 'request_status', title: __('状态'),
  125. formatter: function(value, row,index) {
  126. if(value==1){
  127. return '<span class="text-warning">待处理</span>';
  128. }else if(value==2){
  129. return '<span class="text-success">已送</span>';
  130. }else if(value==3){
  131. return '<span class="text-danger">已驳回</span>';
  132. }
  133. }
  134. },
  135. {field: 'createtime', title: __('申请时间'), formatter: Table.api.formatter.datetime, operate: false, addclass: 'datetimerange', sortable: true},
  136. {field: 'operate', title: __('Operate'), table: table,
  137. events: Table.api.events.operate,
  138. // formatter: Table.api.formatter.operate
  139. formatter: Table.api.formatter.buttons,
  140. buttons: [
  141. {
  142. name: 'dispatch',
  143. text: '',
  144. icon: 'fa fa-check',
  145. title: '已送',
  146. classname: 'btn btn-success btn-xs btn-magic btn-ajax',
  147. url: 'teacher/exams/handle/type/1',
  148. visible: function (rr) {
  149. if(rr.request_status == 1 || rr.request_status == 0){
  150. return true;
  151. }
  152. return false;
  153. },
  154. success: function (data, ret) {
  155. table.bootstrapTable("refresh");
  156. },
  157. },{
  158. name: 'dispatch',
  159. text: '',
  160. icon: 'fa fa-reply-all',
  161. title: '驳回',
  162. classname: 'btn btn-danger btn-xs btn-magic btn-ajax',
  163. url: 'teacher/exams/handle/type/2',
  164. visible: function (rr) {
  165. if(rr.request_status == 1 || rr.request_status == 0){
  166. return true;
  167. }
  168. return false;
  169. },
  170. success: function (data, ret) {
  171. table.bootstrapTable("refresh");
  172. },
  173. }
  174. ],
  175. }
  176. ]
  177. ]
  178. });
  179. // 为表格绑定事件
  180. Table.api.bindevent(table);
  181. var table1 = $("#table1");
  182. // 初始化表格
  183. table1.bootstrapTable({
  184. url: $.fn.bootstrapTable.defaults.extend.indexed_url,
  185. pk: 'exam_id',
  186. sortName: 'exam_id',
  187. toolbar: '#toolbar1',
  188. fixedColumns: true,
  189. fixedRightNumber: 1,
  190. searchFormVisible:false,
  191. columns: [
  192. [
  193. // {checkbox: true},
  194. {field: 'seat_id', title: __('座号')},
  195. {field: '', title: __('模拟器状态'),
  196. formatter: function(value, row,index) {
  197. return '<span class="text-success">就绪</span>';
  198. }
  199. },
  200. {field: 'user_username', title: __('学员学号')},
  201. {field: 'user_nickname', title: __('学员姓名')},
  202. {field: '', title: __('考试状态'),
  203. formatter: function(value, row,index) {
  204. return '<span class="text-success">已交卷</span>';
  205. }
  206. },
  207. {field: 'total_score', title: __('考试成绩')},
  208. // {field: '', title: __('故障现象')},
  209. // {field: '', title: __('故障部位')},
  210. // {field: '', title: __('排除方法')},
  211. // {field: 'operate', title: __('Operate'), table: table1,
  212. // events: Table.api.events.operate,
  213. // // formatter: Table.api.formatter.operate
  214. // formatter: Table.api.formatter.buttons,
  215. // buttons: [
  216. // // {
  217. // // name: 'dispatch',
  218. // // text: '',
  219. // // icon: 'fa fa-pencil',
  220. // // title: '编辑',
  221. // // classname: 'btn btn-success btn-xs btn-magic btn-dialog',
  222. // // extend: 'data-area=\'["55%","95%"]\'',
  223. // // url: 'teacher/exams/edit',
  224. // // }
  225. // ],
  226. // }
  227. ]
  228. ]
  229. });
  230. // 为表格绑定事件
  231. Table.api.bindevent(table1);
  232. var table2 = $("#table2");
  233. // 初始化表格
  234. table2.bootstrapTable({
  235. url: $.fn.bootstrapTable.defaults.extend.indexed_url,
  236. pk: 'exam_id',
  237. sortName: 'exam_id',
  238. toolbar: '#toolbar2',
  239. fixedColumns: true,
  240. pageSize: 10,
  241. pagination:false,
  242. fixedRightNumber: 1,
  243. searchFormVisible:false,
  244. columns: [
  245. [
  246. // {checkbox: true},
  247. {field: 'seat_id', title: __('座号')},
  248. {field: 'user_username', title: __('学员学号')},
  249. {field: 'user_nickname', title: __('学员姓名')},
  250. {field: 'total_score', title: __('考试成绩')},
  251. {field: '', title: __('总分')},
  252. {field: '', title: __('故障一未排除扣25分')},
  253. {field: '', title: __('故障二未排除扣25分')},
  254. {field: '', title: __('故障三未排除扣25分')},
  255. {field: '', title: __('故障现象少写或错写1条扣1分')},
  256. {field: '', title: __('可能原因少写或错写1条扣1分')},
  257. {field: '', title: __('故障部位少写或错写1条扣1分')},
  258. {field: '', title: __('排除方法少写或错写1条扣1分')},
  259. {field: '', title: __('修复结论错扣2分')},
  260. {field: '', title: __('按每超时1分钟扣分的比例扣分')},
  261. // {field: '', title: __('故障部位')},
  262. // {field: '', title: __('排除方法')},
  263. // {field: 'operate', title: __('Operate'), table: table1,
  264. // events: Table.api.events.operate,
  265. // // formatter: Table.api.formatter.operate
  266. // formatter: Table.api.formatter.buttons,
  267. // buttons: [
  268. // // {
  269. // // name: 'dispatch',
  270. // // text: '',
  271. // // icon: 'fa fa-pencil',
  272. // // title: '编辑',
  273. // // classname: 'btn btn-success btn-xs btn-magic btn-dialog',
  274. // // extend: 'data-area=\'["55%","95%"]\'',
  275. // // url: 'teacher/exams/edit',
  276. // // }
  277. // ],
  278. // }
  279. ]
  280. ]
  281. });
  282. // 为表格绑定事件
  283. Table.api.bindevent(table2);
  284. },
  285. add: function () {
  286. Controller.api.bindevent();
  287. },
  288. edit: function () {
  289. Controller.api.bindevent();
  290. },
  291. api: {
  292. bindevent: function () {
  293. Form.api.bindevent($("form[role=form]"));
  294. }
  295. }
  296. };
  297. return Controller;
  298. });