change.php 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976
  1. <style>
  2. /*切换选择*/
  3. .tab-con{
  4. position: relative;
  5. height: 30px;
  6. width: 200px;
  7. background: #F2F2F2;
  8. border: 1px solid #01B677;
  9. border-radius: 15px;
  10. }
  11. .has-sel{
  12. background: #01B677;
  13. color: #fff;
  14. width: 50%;
  15. height: 30px;
  16. border-top-left-radius: 15px;
  17. border-bottom-left-radius: 15px;
  18. text-align: center;
  19. line-height: 30px;
  20. }
  21. .sel-opt{
  22. width: 50%;
  23. position: relative;
  24. color: #01B677;
  25. line-height: 30px;
  26. text-indent: 6px;
  27. cursor: pointer;
  28. }
  29. .sel-opt:after{
  30. content: '';
  31. border-left: 6px solid transparent;
  32. border-right: 6px solid transparent;
  33. border-top: 8px solid #01B677;
  34. position: absolute;
  35. right: 12px;
  36. top: 12px;
  37. }
  38. // .sel-opt select{
  39. // width: 100%;
  40. // height: 30px;
  41. // background: #F2F2F2;
  42. // color: #01B677;
  43. // text-indent: 6px;
  44. // font-size: inherit;
  45. // border-top-right-radius: 15px;
  46. // border-bottom-right-radius: 15px;
  47. // cursor: pointer;
  48. // }
  49. // .sel-opt select option{
  50. // position: relative;
  51. // }
  52. .points{
  53. position: absolute;
  54. top: -2px;
  55. right: 0;
  56. width: 10px;
  57. height: 10px;
  58. background: #F01516;
  59. border-radius: 50%;
  60. }
  61. .sel-cons{
  62. border: 1px solid #01B677;
  63. width: 50%;
  64. position: absolute;
  65. right: 0;
  66. top: 30px;
  67. text-indent: 10px;
  68. display: none;
  69. }
  70. .sc-lis{
  71. line-height: 30px;
  72. cursor: pointer;
  73. }
  74. .sc-lis span{
  75. position: relative;
  76. }
  77. .sc-lis .points{
  78. top: 2px;
  79. right: -16px;
  80. }
  81. .add-class-list{position:relative}
  82. .class-add-list{
  83. position: absolute;
  84. background-color: #f9f9f9;
  85. min-width: 103px;
  86. box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  87. padding: 0;
  88. left: -5px;
  89. top: 33px;
  90. display: none;
  91. color: rgb(51, 51, 51);
  92. z-index:1000;
  93. }
  94. .class-add-list a{
  95. display: flex;
  96. }
  97. </style>
  98. <div class="main-content-inner">
  99. <!-- 导航栏开始-->
  100. <?php include(Yii::app()->basePath.'/views/layouts/view_navigation.php');?>
  101. <!-- 导航栏结束-->
  102. <div class="page-content">
  103. <div class="row" style="margin:0px">
  104. <div class="col-xs-12">
  105. <!-- PAGE CONTENT BEGINS -->
  106. <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
  107. <div class="row">
  108. <div class="col-xs-4">
  109. <form method="get" id="form1" action="<?php echo $this->createUrl("third/change");?>">
  110. <div class="dataTables_length" style="margin: 6px 0px;">
  111. <div class="dataTables_length">
  112. <label><input type="text" class="form-control input-sm" placeholder="请输入学生姓名" name="sname" value="<?php echo $sname;?>"></label>
  113. <!--<button class="btn btn-minier btn-primary" id="search">搜索</button>-->
  114. <button style="padding:4px 12px;"class="label-primary-s bth-s">搜索</button>
  115. </div>
  116. </div>
  117. <input type="hidden" name="cid" class="clid" value="<?php echo $class_id;?>" />
  118. <input type="hidden" name="eid" class="emid" value="<?php echo $exam_id;?>" />
  119. <input type="hidden" name="tid" value="<?php echo $type_id;?>" />
  120. </form>
  121. </div>
  122. <div class="col-xs-8">
  123. <div class="dataTables_filter" id="dynamic-table_filter" style="padding-top:15px;text-align: right;">
  124. <a href="javascript:void(0);" class="btn label-primary-green btn-sm" id="addPaperStudent">
  125. <i style="font-style: normal;" ></i>添加考试学生
  126. </a>
  127. <a href="javascript:void(0);" class="btn click-delete btn-sm" id="delPaperStudent">
  128. <i style="font-style: normal;" ></i>选择删除考试学生
  129. </a>
  130. <a href="javascript:void(0);" class="btn click-delete btn-sm" id="delPaperStudentAll">
  131. <i style="font-style: normal;" ></i>删除全部未考试学生
  132. </a>
  133. <?php
  134. if($use_answer_card_online_qrcode){
  135. // if(!$isCustomTpl ){
  136. ?>
  137. <a href="javascript:void(0);" code="2" class="btn label-primary-green btn-sm" id="createTempNew">
  138. 批量生成
  139. </a>
  140. <a href="javascript:void(0);" code="1" class="btn label-primary-green btn-sm" id="selectPrintNew">
  141. <i style="font-style: normal;" class="fa fa-print"></i>
  142. 批量打印
  143. </a>
  144. <a href="javascript:void(0);" code="3" class="btn label-primary-green btn-sm" id="printPaperNew">
  145. 批量下载
  146. </a>
  147. <!--
  148. <div href="javascript:void(0);" class="btn label-primary-green btn-sm add-class-list" >
  149. <i style="font-style: normal;" class="fa "></i>订单学生操作
  150. <div class="class-add-list">
  151. <a href="javascript:void(0);" class="btn label-primary-green btn-sm createTempByOrder">订单学生生成</a>
  152. <a href="javascript:void(0);" class="btn label-primary-green btn-sm selectPrintByOrder">订单学生打印</a>
  153. <a href="javascript:void(0);" class="btn label-primary-green btn-sm printPaperByOrder">订单学生下载</a>
  154. </div>
  155. </div>
  156. -->
  157. <?php }?>
  158. </div>
  159. </div>
  160. </div>
  161. <div class="row">
  162. <div class="col-xs-12" style="font-weight:bold;padding:0px 15px">
  163. <?php echo $className;?> <?php echo $paperName;?>(使用<?php if($examInfo->school_card_status==0){if(Yii::app()->session['school_id']>999){echo '系统准考证号,长度为9位';}else{ echo '系统准考证号,长度为8位';}}else{echo '学校准考证号,长度为'.$examInfo->school_card_length.'位';}?>)
  164. </div>
  165. </div>
  166. <table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable" style="font-size:12px">
  167. <thead>
  168. <tr>
  169. <th class="center">
  170. <!--<label class="pos-rel">
  171. <input type="checkbox" class="selectAll">
  172. <span class="lbl"></span>
  173. </label>-->
  174. <input type="checkbox" class="ace selectAll">
  175. </th>
  176. <th>学生名称</th>
  177. <th>学生编号</th>
  178. <th>系统准考证</th>
  179. <th>学校准考证</th>
  180. <th>身份证号</th>
  181. <th>答卷图片是否已上传</th>
  182. <?php if(!isset($under_line)):?>
  183. <th>原卷是否已上传</th>
  184. <?php endif;?>
  185. <th>成绩是否已生成</th>
  186. <?php if($use_answer_card_online_qrcode):?>
  187. <th>在线答题卡</th>
  188. <?php endif;?>
  189. </tr>
  190. </thead>
  191. <tbody>
  192. <?php if(!empty($result)):foreach($result as $rt):?>
  193. <tr>
  194. <td class="center">
  195. <!--<label class="pos-rel">
  196. <input type="checkbox" class="ace myselect" value="<?php echo $rt['studentCode'];?>" stnm="<?php echo $rt['studentName'];?>">
  197. <span class="lbl"></span>
  198. </label>-->
  199. <input type="checkbox" class="ace myselect" value="<?php echo $rt['studentCode'];?>" stnm="<?php echo $rt['studentName'];?>" online="<?php echo $rt['online_created']?>">
  200. </td>
  201. <td><?php echo $rt['studentName'];?></td>
  202. <td><?php echo $rt['studentCode'];?></td>
  203. <td><?php echo $rt['student_card'];?></td>
  204. <td><?php echo $rt['school_student_card'];?></td>
  205. <td><?php echo $rt['id_number'];?></td>
  206. <?php if(!isset($under_line)):?>
  207. <td><?php echo $rt['upload_answer_img'] ? "<span style='color:green'>是</span>" : "<span style='color:red'>否</span>";?></td>
  208. <?php endif;?>
  209. <td><?php echo $rt['student_img_paper'] ? "<span style='color:green'>是</span>" : "<span style='color:red'>否</span>";?></td>
  210. <td><?php echo $rt['is_complete'] ? "<span style='color:green'>是</span>" : "<span style='color:red'>否</span>";?></td>
  211. <?php if($use_answer_card_online_qrcode):?>
  212. <td><?php echo $rt['online_created'] ? "<span style='color:green'>是</span>" : "<span style='color:red'>否</span>";?></td>
  213. <?php endif;?>
  214. </tr>
  215. <?php endforeach;else:?>
  216. <tr><td colspan="5">暂无数据!</td></tr>
  217. <?php endif;?>
  218. </tbody>
  219. </table>
  220. <input type="hidden" name="paperId" id="paperId" value="<?php echo $paper_id;?>" />
  221. <input type="hidden" name="wpCode" id="wpCode" value="<?php echo $exam_id;?>" />
  222. <input type="hidden" name="schoolId" id="schoolId" value="<?php echo Yii::app()->session['school_id'];?>" />
  223. <input type="hidden" name="wpType" id="wpType" value="<?php echo $wp_type;?>" />
  224. <input type="hidden" name="className" id="className" value="<?php echo $className;?>" />
  225. <input type="hidden" name="paperName" id="paperName" value="<?php echo $paperName;?>" />
  226. <input type="hidden" name="isFeedback" id="isFeedback" value="<?php echo $isFeedback;?>" />
  227. </div>
  228. <!-- PAGE CONTENT ENDS -->
  229. </div>
  230. </div>
  231. </div>
  232. </div>
  233. <script type="text/javascript">
  234. //客户端发送打印弹窗(客户端调用)
  235. function sendToPrint(){
  236. $('#classModal-1').hide();
  237. $('input[name=code]').val(0);
  238. layer.msg('已成功发送至下载/打印列表');
  239. }
  240. var isNewVersion=2;
  241. $(document).ready(function(){
  242. /*var str = '<div class="points"></div>';
  243. $(".sc-lis").each(function(){
  244. if($(this).find(".points").length>0){
  245. $(".sel-opt").append(str);
  246. }
  247. });*/
  248. $(".sel-opt,.sel-cons").mouseover(function(){
  249. $(".sel-cons").show();
  250. }).mouseout(function(){
  251. $(".sel-cons").hide();
  252. });
  253. $(".sc-lis").click(function(){
  254. var data = {
  255. subjectId : $(this).attr('val')
  256. };
  257. $.post("<?php echo Yii::app()->createUrl('print/setSubjectId')?>",data,function(flags){
  258. if(flags)
  259. {
  260. location.reload();
  261. }else
  262. {
  263. alert('网络异常');
  264. }
  265. });
  266. $('.has-sel').text($(this).text());
  267. $(".sel-cons").hide();
  268. });
  269. //批量生成
  270. $('#createTempNew').click(function(){
  271. var code=$(this).attr('code');
  272. // 判断是否有选中
  273. if (!$("input[class='ace myselect']").is(':checked')) {
  274. layer.msg('请至少选择一个学生!');return false;
  275. }
  276. createOnline();
  277. });
  278. //批量打印
  279. $('#selectPrintNew').click(function(){
  280. var code=$(this).attr('code');
  281. // 判断是否有选中
  282. if (!$("input[class='ace myselect']").is(':checked')) {
  283. layer.msg('请至少选择一个学生!');return false;
  284. }
  285. printOnline();
  286. });
  287. //批量下载
  288. $('#printPaperNew').click(function(){
  289. var code=$(this).attr('code');
  290. // 判断是否有选中
  291. if (!$("input[class='ace myselect']").is(':checked')) {
  292. layer.msg('请至少选择一个学生!');return false;
  293. }
  294. downloadOnline();
  295. });
  296. //生成在线答题卡
  297. function createOnline(){
  298. // 判断是否有选中
  299. if (!$("input[class='ace myselect']").is(':checked')) {
  300. layer.msg('请至少选择一个学生!');return false;
  301. }
  302. var student_ids = [];
  303. var class_name='<?php echo $className?>';
  304. $(".myselect").each(function(m,n){
  305. if ($(this).prop('checked')) {
  306. student_ids.push($(this).val()) ;
  307. }
  308. });
  309. var data = {
  310. exam_id:"<?php echo $exam_id ?>",
  311. students:student_ids,
  312. class_name:class_name
  313. };
  314. var index=layer.msg('正在发送请求,请稍候',{time:0});
  315. $.post("<?php echo Yii::app()->createUrl('print/sendCreateOnlineStudents')?>",data,function(flags){
  316. //$.post("<?php echo Yii::app()->createUrl('print/sendCreateOnline')?>",data,function(flags){
  317. var m = JSON.parse(flags);
  318. if(m.status==1)
  319. {
  320. layer.close(index);
  321. layer.alert("模板生成中", {icon: 6}, function(){
  322. location.replace(location.href);
  323. });
  324. }else
  325. {
  326. layer.msg(m.msg);
  327. }
  328. });
  329. }
  330. //打印在线答题卡
  331. function printOnline(){
  332. // 判断是否有选中
  333. if (!$("input[class='ace myselect']").is(':checked')) {
  334. layer.msg('请至少选择一个学生!');return false;
  335. }
  336. var student_ids = [];
  337. var class_name='<?php echo $className?>';
  338. $(".myselect").each(function(m,n){
  339. if ($(this).prop('checked')) {
  340. student_ids.push($(this).val()) ;
  341. }
  342. });
  343. var data = {
  344. exam_id:"<?php echo $exam_id ?>",
  345. students:student_ids,
  346. };
  347. $.post("<?php echo Yii::app()->createUrl('print/printPdfOnline')?>",data,function(flags){
  348. var m = JSON.parse(flags);
  349. if(m.success==1)
  350. {
  351. if(isNewVersion==1){
  352. params={
  353. exam_id:"<?php echo $exam_id ?>",
  354. student_id:student_ids,
  355. };
  356. evaluationClient.NewPrintPDF(JSON.stringify(params));
  357. }else if(isNewVersion==2){
  358. let $param={"typeId":14,"params":{"examIds":["<?php echo $exam_id ?>"],"classIds":["<?php echo $class_id;?>"],"studentIds":student_ids}}
  359. evaluationClient.BulkPrintPDF(JSON.stringify($param))
  360. }else{
  361. evaluationClient.PrintPDF(flags);
  362. }
  363. // 更试卷打印时间
  364. $.post("<?php echo $this->createUrl('print/updateOnlinePaperPrintTime');?>", {cid: $(".clid").val(), eid: $(".emid").val(),type:0 } );
  365. }else
  366. {
  367. if(m.msg!=undefined){
  368. layer.msg(m.msg);
  369. }else{
  370. layer.msg('打印失败');
  371. }
  372. }
  373. });
  374. }
  375. //下载在线答题卡
  376. function downloadOnline(){
  377. // 判断是否有选中
  378. if (!$("input[class='ace myselect']").is(':checked')) {
  379. layer.msg('请至少选择一个学生!');return false;
  380. }
  381. var student_ids = '';
  382. var finishCheck = 0;
  383. var failCheck = 0;
  384. $(".myselect").each(function(m,n){
  385. if ($(this).prop('checked')) {
  386. if($(this).attr("online") == 1){
  387. finishCheck = 1;
  388. if ($(this).val() && $(this).attr("stnm")) {
  389. student_ids = student_ids +$(this).val()+',';
  390. }
  391. }else{
  392. failCheck = 1;
  393. }
  394. }
  395. });
  396. if(!finishCheck){
  397. layer.msg('当前选中的学生中,还未有已经生成的,请重新勾选~',{'btn':['确定'],time:0});
  398. return false;
  399. }
  400. var data = {
  401. exam_id:"<?php echo $exam_id ?>",
  402. student_id:student_ids
  403. };
  404. var text = '';
  405. if(finishCheck && failCheck){
  406. text = '当前批量打印选中的学生有存在还未生成的,默认只会打印已经生成的,请知悉!';
  407. }
  408. if(finishCheck && !failCheck){
  409. text = '确定下载选中学生吗?';
  410. }
  411. layer.msg(text,
  412. {
  413. btn:['确定','取消'],
  414. time: 0,
  415. yes:function(){
  416. layer.closeAll();
  417. if(isNewVersion>=1){
  418. evaluationClient.NewDownLoadPDF(JSON.stringify(data));
  419. }else{
  420. console.log('old');
  421. $(".loading-pop").show();
  422. $.post("<?php echo Yii::app()->createUrl('print/downloadOnlineBatch')?>",data,function(flags){
  423. var m = JSON.parse(flags);
  424. if(m.status==1)
  425. {
  426. var html = ""+
  427. '<div style="padding:20px 30px 0px 30px">'+
  428. '<div style="padding:8px 0;">请复制下方链接打印包。</div>'+
  429. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>'+
  430. '<div class="row" style="margin:30px auto 0px auto;text-align:center"><button id="confirm" class="label-primary-s bth-s" style="padding:4px 12px;margin:5px 0 10px 15px;background:gray;border-color:gray;">关闭</button>'+
  431. '</div>'+
  432. '</div>'+
  433. "";
  434. //
  435. layer.open({
  436. type: 1,
  437. area: ['550px', '220px'],
  438. title: '打印包',
  439. content: html,
  440. success: function(index, layerObj){
  441. $(".loading-pop").hide();
  442. jQuery("#downloadUrl").html('下载地址:<span style=""><input id="url" type="text" size="40" readonly value="'+m.result+'" /></span><button id="copy" class="label-primary-s bth-s" style="padding:4px 12px;margin:5px 0 10px 15px;">全选</button>');
  443. jQuery("#confirm, #cancel").on("click", function(){
  444. layer.close(layerObj);
  445. });
  446. jQuery("#copy").on("click", function(){
  447. jQuery("#url").select();
  448. });
  449. },
  450. end: function(){
  451. }
  452. });
  453. return;
  454. }else {
  455. layer.msg(m.result);
  456. $(".loading-pop").hide();return;
  457. }
  458. $(".loading-pop").hide();
  459. return;
  460. });
  461. }
  462. // 更试卷打印时间
  463. $.post("<?php echo $this->createUrl('print/updateOnlinePaperPrintTime');?>", {cid: $(".clid").val(), eid: $(".emid").val(),type:0 } );
  464. }
  465. }
  466. );
  467. }
  468. })
  469. function ccc(){
  470. layer.msg('敬请期待!', {
  471. time: 0,
  472. btn: ['确定', '取消'],
  473. yes: function(index){
  474. layer.close(index);
  475. return false;
  476. }
  477. });
  478. }
  479. $(function(){
  480. // 全选\反选
  481. $(".selectAll").click(function(){
  482. if ($(this).prop("checked")) {
  483. $(".myselect").prop("checked",true);
  484. } else {
  485. $(".myselect").prop("checked",false);
  486. }
  487. });
  488. $("body").delegate("#stu_select_all","click",function(){
  489. $(this).closest("table").find("tbody .myselect").prop("checked",$(this).prop("checked"))
  490. });
  491. $("#addPaperStudent").click(function(){
  492. var studentsIds;
  493. var html1="";
  494. var html = ""+'<table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable" style="font-size:12px"><thead><tr><th><input type="checkbox" class="stu selectAll" id="stu_select_all"></th><th>学生名称</th><th>学生编号</th></tr></thead><tbody>';
  495. <?php if($no_paper_student){
  496. foreach($no_paper_student as $v)
  497. {
  498. ?>
  499. html1=html1+'<tr><td><input type="checkbox" class="stu myselect" value="<?php echo $v['student_id']?>"></td><td><?php echo $v['realname']?></td><td><?php echo $v['student_id']?></td></tr>'
  500. <?php } }else{?>
  501. html1='<tr><td colspan="3">没有新的学生</td></tr>';
  502. <?php }?>
  503. html=html+html1;
  504. html=html+'</tbody></table>'+'<div class="row" style="margin:15px auto; text-align: center;"><button id="confirm" class="label-primary-s bth-s" style="padding:4px 12px;margin:20px 0 0 15px">确定</button>'+
  505. '<button id="cancel" class="label-primary-s bth-s" style="border:gray;background:gray;padding:4px 12px;margin:20px 0 0 25px">取消</button></div>';
  506. layer.open({
  507. type: 1,
  508. area: ['450px', '280px'],
  509. title: "为本次考试添加本班学生",
  510. content: html,
  511. success: function(index, layerObj){
  512. jQuery("#cancel").on("click", function(){
  513. layer.closeAll();
  514. });
  515. jQuery("#confirm").on("click", function(){
  516. if (!$("input[class='stu myselect']").is(':checked'))
  517. {
  518. layer.msg('请至少选择一个学生!');return false;
  519. }
  520. jQuery("input[class='stu myselect']").each(function()
  521. {
  522. if(jQuery(this).is(":checked") && typeof(jQuery(this).val())!= "undefined")
  523. {
  524. studentsIds += ","+jQuery(this).val();
  525. }
  526. });
  527. if(studentsIds)
  528. {
  529. studentsIds = studentsIds.replace("undefined,",'');
  530. }
  531. var data={
  532. "studentsIds":studentsIds,
  533. "exam_id":"<?php echo $exam_id ?>",
  534. "paper_id":"<?php echo $paper_id ?>",
  535. "class_id":"<?php echo $class_id?>"
  536. };
  537. jQuery.post(
  538. "<?php echo $this->createUrl("print/addPaperStudent");?>",
  539. data,
  540. function(data){
  541. var m =JSON.parse(data);
  542. if(m.status==1)
  543. {
  544. var icon = 6;
  545. layer.alert("添加成功", {icon: icon}, function(){
  546. location.replace(location.href);
  547. });
  548. }else if(m.status==2){
  549. var icon = 5;
  550. layer.alert("添加失败,学生已在本次考试中", {icon: icon}, function(){
  551. location.replace(location.href);
  552. });
  553. }else if(m.status==3){
  554. var icon = 5;
  555. layer.alert("添加失败,学生:"+m.result+"已参加其它考试", {icon: icon}, function(){
  556. location.replace(location.href);
  557. });
  558. }else{
  559. var icon = 5;
  560. layer.alert("添加失败", {icon: icon}, function(){
  561. location.replace(location.href);
  562. });
  563. }
  564. }
  565. );
  566. layer.closeAll();
  567. });
  568. },
  569. end: function(){
  570. }
  571. });
  572. });
  573. $("#delPaperStudent").click(function(){
  574. // 判断是否有选中
  575. var studentsIds;
  576. if (!$("input[class='ace myselect']").is(':checked'))
  577. {
  578. layer.msg('请至少选择一个学生!');return false;
  579. }
  580. feedback=false;
  581. jQuery("input[class='ace myselect']").each(function()
  582. {
  583. if(jQuery(this).is(":checked") && typeof(jQuery(this).val())!= "undefined")
  584. {
  585. studentsIds += ","+jQuery(this).val();
  586. if($(this).closest('tr').find('td').eq(6).find('span').html()=='是'){
  587. feedback=true;
  588. }
  589. }
  590. });
  591. if(feedback){
  592. layer.msg('学生已上传成绩不能删除!');return false;
  593. }else{
  594. msg='确定删除选中的学生吗?';
  595. }
  596. layer.msg(msg, {
  597. time: 0,
  598. btn: ['确定', '取消'],
  599. yes: function(index){
  600. layer.close(index);
  601. if(studentsIds)
  602. {
  603. studentsIds = studentsIds.replace("undefined,",'');
  604. }
  605. var data={
  606. "studentsIds":studentsIds,
  607. "exam_id":"<?php echo $exam_id ?>",
  608. "paper_id":"<?php echo $paper_id ?>",
  609. "class_id":"<?php echo $class_id?>",
  610. };
  611. jQuery.post(
  612. "<?php echo $this->createUrl("print/delPaperStudent?");?>",data,function(data){
  613. var m =JSON.parse(data);
  614. if(m.status==1)
  615. {
  616. var icon = 6;
  617. layer.alert("删除成功", {icon: icon}, function(){
  618. location.replace(location.href);
  619. });
  620. }else if(m.status==2){
  621. var icon = 5;
  622. layer.alert("不能删除已上传成绩的学生", {icon: icon}, function(){
  623. location.replace(location.href);
  624. });
  625. }else{
  626. var icon = 5;
  627. layer.alert("删除失败", {icon: icon}, function(){
  628. location.replace(location.href);
  629. });
  630. }
  631. });
  632. }
  633. });
  634. });
  635. $("#delPaperStudentAll").click(function(){
  636. // 判断是否有选中
  637. var studentsIds;
  638. if($('input[name=isFeedback]').val()==1){
  639. msg='所选考生中含有已上传答题卡的考生,删除后,上传总数量与阅卷任务量将会与考生数量不一致,请谨慎操作!';
  640. }else{
  641. msg='确定删除全部未考试的学生吗?';
  642. }
  643. layer.msg(msg, {
  644. time: 0,
  645. btn: ['确定', '取消'],
  646. yes: function(index){
  647. layer.close(index);
  648. var data={
  649. "exam_id":"<?php echo $exam_id ?>",
  650. "paper_id":"<?php echo $paper_id ?>",
  651. "class_id":"<?php echo $class_id?>",
  652. };
  653. jQuery.post(
  654. "<?php echo $this->createUrl("print/delPaperStudentAll?");?>",data,function(data){
  655. var m =JSON.parse(data);
  656. if(m.status==1)
  657. {
  658. var icon = 6;
  659. layer.alert("删除成功", {icon: icon}, function(){
  660. location.replace(location.href);
  661. });
  662. }else if(m.status==2){
  663. var icon = 5;
  664. layer.alert("无未上传成绩的学生", {icon: icon}, function(){
  665. location.replace(location.href);
  666. });
  667. }else{
  668. var icon = 5;
  669. layer.alert("删除失败", {icon: icon}, function(){
  670. location.replace(location.href);
  671. });
  672. }
  673. });
  674. }
  675. });
  676. });
  677. // 打印答案解析
  678. $("#printAnswer").click(function(){
  679. layer.msg('您确定下载答案解析嘛?', {
  680. time: 0,
  681. btn: ['确定', '取消'],
  682. yes: function(index){
  683. layer.close(index);
  684. var wpCode = $("#wpCode").val();
  685. if (!wpCode) {
  686. layer.msg('周周练id有误!');return false;
  687. }
  688. jQuery.post(
  689. '<?php echo $this->createUrl('print/createtempelate');?>',
  690. {"eid":wpCode},
  691. function(data){
  692. var obj = JSON.parse(data);
  693. if (obj.success == 1) {
  694. //alert(obj.message);
  695. //alert(obj);
  696. evaluationClient.printDAJX(JSON.stringify(obj.object));
  697. } else {
  698. layer.msg(obj.message);
  699. }
  700. }
  701. );
  702. }
  703. });
  704. });
  705. /*在线答题卡订单学生操作*/
  706. $(".add-class-list").hover(function(){
  707. $('.class-add-list').toggle();
  708. });
  709. $('.createTempByOrder').click(function(){
  710. createOnlineByOrder();
  711. });
  712. $('.selectPrintByOrder').click(function(){
  713. printOnlineByOrder();
  714. });
  715. $('.printPaperByOrder').click(function(){
  716. downloadOnlineByOrder();
  717. });
  718. //生成在线答题卡
  719. function createOnlineByOrder(){
  720. var class_name='<?php echo $className?>';
  721. var data = {
  722. exam_id:"<?php echo $exam_id ?>",
  723. class_name:class_name,
  724. check_order:1
  725. };
  726. text = '确定生成本班所有订单学生的在线答题卡吗?';
  727. layer.msg(text,
  728. {
  729. btn:['确定','取消'],
  730. time: 0,
  731. yes:function(){
  732. var index=layer.msg('正在发送请求,请稍候',{time:0});
  733. $.post("<?php echo Yii::app()->createUrl('print/sendCreateOnlineStudents')?>",data,function(flags){
  734. var m = JSON.parse(flags);
  735. if(m.status==1)
  736. {
  737. layer.close(index);
  738. layer.alert("模板生成中", {icon: 6}, function(){
  739. location.replace(location.href);
  740. });
  741. }else
  742. {
  743. layer.msg(m.msg);
  744. }
  745. });
  746. }
  747. })
  748. }
  749. //打印在线答题卡
  750. function printOnlineByOrder(){
  751. var data = {
  752. exam_id:"<?php echo $exam_id ?>",
  753. check_order:1
  754. };
  755. text = '确定打印本班所有订单学生的在线答题卡吗?';
  756. layer.msg(text,
  757. {
  758. btn:['确定','取消'],
  759. time: 0,
  760. yes:function(){
  761. $.post("<?php echo Yii::app()->createUrl('print/PrintPdfOnlineByOrder')?>",data,function(flags){
  762. var m = JSON.parse(flags);
  763. if(m.success==1)
  764. {
  765. students=m.students;
  766. if(m.all_created==0){
  767. layer.msg('订单学生存在还未生成的,默认只会打印已经生成的,请知悉!',{
  768. btn:['确定','取消'],
  769. time: 0,
  770. yes:function(){
  771. params={
  772. exam_id:"<?php echo $exam_id ?>",
  773. student_id:students
  774. };
  775. let $param={"typeId":14,"params":{"examIds":["<?php echo $exam_id ?>"],"classIds":["<?php echo $class_id?>"],"studentIds":students}}
  776. if(isNewVersion==1){
  777. evaluationClient.NewPrintPDF(JSON.stringify(params));
  778. }else if(isNewVersion==2){
  779. evaluationClient.BulkPrintPDF(JSON.stringify($param))
  780. }
  781. // 更试卷打印时间
  782. $.post("<?php echo $this->createUrl('print/updateOnlinePaperPrintTime');?>", {cid: $(".clid").val(), eid: $(".emid").val(),type:0 } );
  783. }
  784. })
  785. }else{
  786. params={
  787. exam_id:"<?php echo $exam_id ?>",
  788. student_id:students
  789. };
  790. let $param={"typeId":14,"params":{"examIds":["<?php echo $exam_id ?>"],"classIds":["<?php echo $class_id?>"],"studentIds":students}}
  791. // evaluationClient.BulkPrintPDF(JSON.stringify($param))
  792. if(isNewVersion==1){
  793. evaluationClient.NewPrintPDF(JSON.stringify(params));
  794. }else if(isNewVersion==2){
  795. evaluationClient.BulkPrintPDF(JSON.stringify($param))
  796. }
  797. // evaluationClient.NewPrintPDF(JSON.stringify(params));
  798. // 更试卷打印时间
  799. $.post("<?php echo $this->createUrl('print/updateOnlinePaperPrintTime');?>", {cid: $(".clid").val(), eid: $(".emid").val(),type:0 });
  800. }
  801. }else
  802. {
  803. if(m.msg!=undefined){
  804. layer.msg(m.msg);
  805. }else{
  806. layer.msg('打印失败');
  807. }
  808. }
  809. });
  810. }
  811. })
  812. }
  813. //下载在线答题卡
  814. function downloadOnlineByOrder(){
  815. var data = {
  816. exam_id:"<?php echo $exam_id ?>",
  817. };
  818. text = '确定下载本班所有订单学生的在线答题卡吗?';
  819. layer.msg(text,
  820. {
  821. btn:['确定','取消'],
  822. time: 0,
  823. yes:function(){
  824. //读取订单学生列表
  825. $.ajax({
  826. url:'<?php echo $this->createUrl('print/printPdfOnlineByOrder')?>',
  827. type:'POST',
  828. dataType:'json',
  829. data:data,
  830. success:function(res){
  831. if(res.success==1){
  832. students=res.students;
  833. if(res.all_created==0){
  834. layer.msg('订单学生存在还未生成的,默认只会下载已经生成的,请知悉!',{
  835. btn:['确定','取消'],
  836. time: 0,
  837. yes:function(){
  838. var data = {
  839. exam_id:"<?php echo $exam_id ?>",
  840. student_id:students
  841. };
  842. evaluationClient.NewDownLoadPDF(JSON.stringify(data));
  843. // 更试卷打印时间
  844. $.post("<?php echo $this->createUrl('print/updateOnlinePaperPrintTime');?>", {cid: $(".clid").val(), eid: $(".emid").val(),type:0 } );
  845. }
  846. })
  847. }else{
  848. var data = {
  849. exam_id:"<?php echo $exam_id ?>",
  850. student_id:students
  851. };
  852. evaluationClient. NewDownLoadPDF(JSON.stringify(data));
  853. // 更试卷打印时间
  854. $.post("<?php echo $this->createUrl('print/updateOnlinePaperPrintTime');?>", {cid: $(".clid").val(), eid: $(".emid").val(),type:0 } );
  855. }
  856. }else{
  857. if(res.msg!=undefined){
  858. layer.msg(res.msg);
  859. }else{
  860. layer.msg('下载失败');
  861. }
  862. }
  863. }
  864. });
  865. }
  866. }
  867. );
  868. }
  869. })
  870. </script>