exams.js 15 KB

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