exams.js 14 KB

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