exams.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function ($, undefined, Backend, Table, Form,editable) {
  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. singleSelect : true, //
  27. columns: [
  28. [
  29. {checkbox: true},
  30. {field: 'exam_id', title: __('Exam_id')},
  31. {field: 'exam_collection_name', title: __('考试名称')},
  32. {field: 'sim_type', title: __('Sim_type'),searchList:{"0001":"FZD04B型侦毒器","0002":"FZB006型毒剂报警器","0003":"防化兵用毒剂报警器"},formatter: Table.api.formatter.simtype},
  33. {field: 'user_username', title: __('学员学号')},
  34. {field: 'user_nickname', title: __('学员姓名')},
  35. {
  36. field: 'user_depart_id',
  37. title: __('Department'),
  38. visible: false,
  39. addclass: 'selectpage',
  40. extend: 'data-source="department/index/index" data-field="name"',
  41. operate: Config.groupIds !=8 ? 'in':false,
  42. formatter: Table.api.formatter.search
  43. },
  44. // {
  45. // field: 'dadmin',
  46. // title: __('Department'),
  47. // formatter: function (value, row, index) {
  48. // if (value.length == 0)
  49. // return '-' ;
  50. // var department="";
  51. // $.each(value,function(i,v){ //arrTmp数组数据
  52. // if (v.department){
  53. // department+=department?','+v.department.name:v.department.name;
  54. // }
  55. // });
  56. // return Table.api.formatter.flag.call(this, department, row, index);
  57. // }, operate:false
  58. // },
  59. // {field: 'exam_collection_id', title: __('Exam_collection_id')},
  60. // {field: 'user_id', title: __('User_id')},
  61. // {field: 'seat_id', title: __('Seat_id')},
  62. // {field: 'sim_id', title: __('Sim_id')},
  63. {field: 'exam_status', title: __('Exam_status'),searchList: {"0":"未登录","1":"已登录","2":"模拟器检查并下发故障中","3":"模拟器正常","4":"答题中","5":"已交卷","6":"计算成绩中","7":"获取到成绩报告","80":"教师标记缺考","81":"登录未开始答题","90":"模拟器异常结束"},formatter: Table.api.formatter.simexamstatus},
  64. {field: 'total_score', title: __('Total_score')},
  65. // {field: 'deduction_total_score', title: __('Deduction_total_score')},
  66. {field: 'starttime', title: __('Start_time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
  67. {field: 'endtime', title: __('End_time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
  68. // {field: 'login_time', title: __('Login_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  69. // {field: 'logout_time', title: __('Logout_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  70. // {field: 'create_by', title: __('Create_by'), operate: 'LIKE'},
  71. // {field: 'createtime', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  72. // {field: 'update_by', title: __('Update_by'), operate: 'LIKE'},
  73. // {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  74. // {field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  75. {field: 'operate', title: __('Operate'), table: table,
  76. events: Table.api.events.operate,
  77. // formatter: Table.api.formatter.operate
  78. formatter: Table.api.formatter.buttons,
  79. buttons: [
  80. {
  81. name: 'dispatch',
  82. text: '',
  83. icon: 'fa fa-pencil',
  84. title: '编辑',
  85. classname: 'btn btn-success btn-xs btn-magic btn-dialog',
  86. extend: 'data-area=\'["55%","95%"]\'',
  87. url: 'teacher/exams/edit',
  88. }
  89. ],
  90. }
  91. ]
  92. ]
  93. });
  94. // 为表格绑定事件
  95. Table.api.bindevent(table);
  96. $(document).on('click', '.btn-view', function () {
  97. var ids = Table.api.selectedids(table);
  98. var title = '成绩详情';
  99. Fast.api.open(Fast.api.fixurl("teacher/exams/view/ids/"+ids), title, { area: ["60%", "95%"] });
  100. });
  101. },
  102. persent: function () {
  103. Table.api.init({
  104. extend: {
  105. index_url: 'teacher/exams/persent' + location.search,
  106. edit_url: 'teacher/exams/editscore',
  107. indexed_url: 'teacher/exams/examing' + location.search,
  108. score_url: 'teacher/exams/score' + location.search,
  109. table: 'teacher_exams',
  110. }
  111. });
  112. var table = $("#table");
  113. // 初始化表格
  114. table.bootstrapTable({
  115. url: $.fn.bootstrapTable.defaults.extend.index_url,
  116. pk: 'rel_id',
  117. sortName: 'rel_id',
  118. toolbar: '#toolbar',
  119. fixedColumns: true,
  120. fixedRightNumber: 1,
  121. searchFormVisible:false,
  122. showExport:false,
  123. search:false,
  124. columns: [
  125. [
  126. // {checkbox: true},
  127. {field: 'fault_name', title: __('更换件')},
  128. {field: 'create_by', title: __('学员姓名')},
  129. {field: 'request_status', title: __('状态'),
  130. formatter: function(value, row,index) {
  131. if(value==1){
  132. return '<span class="text-warning">待处理</span>';
  133. }else if(value==2){
  134. return '<span class="text-success">已送</span>';
  135. }else if(value==3){
  136. return '<span class="text-danger">已驳回</span>';
  137. }
  138. }
  139. },
  140. {field: 'createtime', title: __('申请时间'), formatter: Table.api.formatter.datetime, operate: false, addclass: 'datetimerange', sortable: true},
  141. {field: 'operate', title: __('Operate'), table: table,
  142. events: Table.api.events.operate,
  143. // formatter: Table.api.formatter.operate
  144. formatter: Table.api.formatter.buttons,
  145. buttons: [
  146. {
  147. name: 'dispatch',
  148. text: '',
  149. icon: 'fa fa-check',
  150. title: '已送',
  151. classname: 'btn btn-success btn-xs btn-magic btn-ajax',
  152. url: 'teacher/exams/handle/type/1',
  153. visible: function (rr) {
  154. if(rr.request_status == 1 || rr.request_status == 0){
  155. return true;
  156. }
  157. return false;
  158. },
  159. success: function (data, ret) {
  160. table.bootstrapTable("refresh");
  161. },
  162. },{
  163. name: 'dispatch',
  164. text: '',
  165. icon: 'fa fa-reply-all',
  166. title: '驳回',
  167. classname: 'btn btn-danger btn-xs btn-magic btn-ajax',
  168. url: 'teacher/exams/handle/type/2',
  169. visible: function (rr) {
  170. if(rr.request_status == 1 || rr.request_status == 0){
  171. return true;
  172. }
  173. return false;
  174. },
  175. success: function (data, ret) {
  176. table.bootstrapTable("refresh");
  177. },
  178. }
  179. ],
  180. }
  181. ]
  182. ]
  183. });
  184. // 为表格绑定事件
  185. Table.api.bindevent(table);
  186. var table1 = $("#table1");
  187. // 初始化表格
  188. table1.bootstrapTable({
  189. url: $.fn.bootstrapTable.defaults.extend.indexed_url,
  190. pk: 'exam_id',
  191. sortName: 'exam_id',
  192. toolbar: '#toolbar1',
  193. fixedColumns: true,
  194. fixedRightNumber: 1,
  195. searchFormVisible:false,
  196. showExport:false,
  197. search:false,
  198. columns: [
  199. [
  200. // {checkbox: true},
  201. {field: 'seat_id', title: __('座号')},
  202. {field: '', title: __('模拟器状态'),
  203. formatter: function(value, row,index) {
  204. return '<span class="text-success">就绪</span>';
  205. }
  206. },
  207. {field: 'user_username', title: __('学员学号')},
  208. {field: 'user_nickname', title: __('学员姓名')},
  209. {field: '', title: __('考试状态'),
  210. formatter: function(value, row,index) {
  211. return '<span class="text-success">已交卷</span>';
  212. }
  213. },
  214. {field: 'total_score', title: __('考试成绩')},
  215. // {field: '', title: __('故障现象')},
  216. // {field: '', title: __('故障部位')},
  217. // {field: '', title: __('排除方法')},
  218. // {field: 'operate', title: __('Operate'), table: table1,
  219. // events: Table.api.events.operate,
  220. // // formatter: Table.api.formatter.operate
  221. // formatter: Table.api.formatter.buttons,
  222. // buttons: [
  223. // // {
  224. // // name: 'dispatch',
  225. // // text: '',
  226. // // icon: 'fa fa-pencil',
  227. // // title: '编辑',
  228. // // classname: 'btn btn-success btn-xs btn-magic btn-dialog',
  229. // // extend: 'data-area=\'["55%","95%"]\'',
  230. // // url: 'teacher/exams/edit',
  231. // // }
  232. // ],
  233. // }
  234. ]
  235. ]
  236. });
  237. // 为表格绑定事件
  238. Table.api.bindevent(table1);
  239. var table2 = $("#table2");
  240. // 初始化表格
  241. table2.bootstrapTable({
  242. url: $.fn.bootstrapTable.defaults.extend.score_url,
  243. pk: 'exam_id',
  244. sortName: 'exam_id',
  245. toolbar: '#toolbar2',
  246. fixedColumns: true,
  247. pageSize: 10,
  248. pagination:false,
  249. fixedLeftNumber: 4,
  250. searchFormVisible:false,
  251. showExport:false,
  252. search:false,
  253. columns: [
  254. [
  255. // {checkbox: true},
  256. {field: 'seat_id', title: __('座号')},
  257. {field: 'user_username', title: __('学员学号')},
  258. {field: 'user_nickname', title: __('学员姓名')},
  259. {field: 'total', title: __('考试成绩')},
  260. {field: 'fault_one_score', title: __('故障一扣分'),editable:true},
  261. {field: 'fault_two_score', title: __('故障二扣分'),editable:true},
  262. {field: 'fault_three_score', title: __('故障三扣分'),editable:true},
  263. {field: 'xianxian_score', title: __('故障现象扣分'),editable:true},
  264. {field: 'yuanyin_socre', title: __('可能原因扣分'),editable:true},
  265. {field: 'buwei_score', title: __('故障部位扣分'),editable:true},
  266. {field: 'fangfa_score', title: __('排除方法扣分'),editable:true},
  267. {field: 'jielun_score', title: __('修复结论扣分'),editable:true},
  268. {field: 'overtime_score', title: __('按每扣分'),editable:true},
  269. ]
  270. ]
  271. });
  272. // 为表格绑定事件
  273. Table.api.bindevent(table2);
  274. $("button[name=commonSearch]").css('display','none');
  275. },
  276. add: function () {
  277. Controller.api.bindevent();
  278. },
  279. edit: function () {
  280. Controller.api.bindevent();
  281. },
  282. api: {
  283. bindevent: function () {
  284. Form.api.bindevent($("form[role=form]"));
  285. }
  286. }
  287. };
  288. return Controller;
  289. });