class_exam_united.php 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248
  1. <script type="text/javascript">
  2. function in_array(search, array){
  3. for(var i in array){
  4. if(array[i]==search){
  5. return true;
  6. }
  7. }
  8. return false;
  9. }
  10. testFlag = "<?php echo $this->testFlag;?>";
  11. customTplsIds = new Array();
  12. var i = 0;
  13. <?php foreach(Yii::app()->params["custom_tpls_ids"] as $tplId){?>
  14. customTplsIds[i] = "<?php echo $tplId;?>";
  15. i++;
  16. <?php }?>
  17. jQuery(document).ready(function(){
  18. // 打印答案解析
  19. $(".answerAnalysis").click(function(){
  20. var element = this;
  21. var isEng = $(this).attr('isEng');
  22. layer.msg('您确定下载答案解析嘛?', {
  23. time: 0,
  24. btn: ['确定', '取消'],
  25. yes: function(index){
  26. layer.close(index);
  27. var wpCode = jQuery(element).attr("examId");
  28. if (!wpCode) {
  29. layer.msg('周周练id有误!');return false;
  30. }
  31. jQuery.post(
  32. '<?php echo $this->createUrl('print/createtempelate');?>',
  33. {"eid":wpCode},
  34. function(data){
  35. var obj = JSON.parse(data);
  36. if (obj.success == 1) {
  37. /*alert(obj.message);
  38. alert(obj);*/
  39. if(isEng == 1){
  40. evaluationClient.PrintSubjectDAJX(JSON.stringify(obj.object));
  41. }else{
  42. evaluationClient.newprintDAJX(JSON.stringify(obj.object));
  43. }
  44. } else {
  45. layer.msg(obj.message);
  46. }
  47. }
  48. );
  49. }
  50. });
  51. });
  52. // 根据年级筛选班级
  53. });
  54. </script>
  55. <style>
  56. .loading-pop{position: fixed;left: 0;top: 0;bottom: 0;right: 0;background: rgba(0,0,0,0.5);z-index: 200;}
  57. .loading-pop-msg{color: #fff;position: absolute;left: 50%;top: 50%;transform: translate(-50%,-50%);font-size: 22px;letter-spacing: 4px;}
  58. /*切换选择*/
  59. .tab-con{
  60. position: relative;
  61. height: 30px;
  62. width: 200px;
  63. background: #F2F2F2;
  64. border: 1px solid #01B677;
  65. border-radius: 15px;
  66. }
  67. .has-sel{
  68. background: #01B677;
  69. color: #fff;
  70. width: 50%;
  71. height: 30px;
  72. border-top-left-radius: 15px;
  73. border-bottom-left-radius: 15px;
  74. text-align: center;
  75. line-height: 30px;
  76. }
  77. .sel-opt{
  78. width: 50%;
  79. position: relative;
  80. color: #01B677;
  81. line-height: 30px;
  82. text-indent: 6px;
  83. cursor: pointer;
  84. }
  85. .sel-opt:after{
  86. content: '';
  87. border-left: 6px solid transparent;
  88. border-right: 6px solid transparent;
  89. border-top: 8px solid #01B677;
  90. position: absolute;
  91. right: 12px;
  92. top: 12px;
  93. }
  94. // .sel-opt select{
  95. // width: 100%;
  96. // height: 30px;
  97. // background: #F2F2F2;
  98. // color: #01B677;
  99. // text-indent: 6px;
  100. // font-size: inherit;
  101. // border-top-right-radius: 15px;
  102. // border-bottom-right-radius: 15px;
  103. // cursor: pointer;
  104. // }
  105. // .sel-opt select option{
  106. // position: relative;
  107. // }
  108. .points{
  109. position: absolute;
  110. top: -2px;
  111. right: 0;
  112. width: 10px;
  113. height: 10px;
  114. background: #F01516;
  115. border-radius: 50%;
  116. }
  117. .sel-cons{
  118. border: 1px solid #01B677;
  119. width: 50%;
  120. position: absolute;
  121. right: 0;
  122. top: 30px;
  123. text-indent: 10px;
  124. display: none;
  125. }
  126. .sc-lis{
  127. line-height: 30px;
  128. cursor: pointer;
  129. }
  130. .sc-lis span{
  131. position: relative;
  132. }
  133. .sc-lis .points{
  134. top: 2px;
  135. right: -16px;
  136. }
  137. .h_list span {font-size: 14px;}
  138. </style>
  139. <link rel="stylesheet" href="/fonts/fpdf/iconfont.css" />
  140. <link rel="stylesheet" href="/fonts/zip/iconfont.css" />
  141. <div class="main-content-inner">
  142. <!-- 导航栏开始-->
  143. <?php include(Yii::app()->basePath.'/views/layouts/view_navigation.php');?>
  144. <!-- 导航栏结束-->
  145. <div class="page-content">
  146. <div class="row" style="margin:0px;">
  147. <div class="col-xs-12">
  148. <!-- PAGE CONTENT BEGINS -->
  149. <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
  150. <div class="row">
  151. <form method="get" id="form1" action="<?php echo $this->createUrl("print/class_exam_united");?>">
  152. <div class="clearfix">
  153. <div class="dataTables_length margin-zy fl">
  154. <input type="text" class="form-control input-sm" placeholder="请输入班级名称" name="class_name" value="<?php echo $class_name;?>"> <input type="hidden" name="exam_group_id" value="<?php echo $exam_group_data->exam_group_id?>">
  155. <button class="label-primary-s bth-s" id="search" style="padding:4px 12px;">搜索</button>
  156. </div>
  157. <div style="float: right;margin-right: 30px;margin-top:12px; padding-bottom: 10px;" class="h_list">
  158. <a class="click-sc addbx" aria-hidden="true" title="下载试卷" href="<?php if(isset($task_exam['paper_template_url'])) echo $task_exam['paper_template_url'] ?>">下载试卷</a>
  159. <span class=" click-sc addbx" aria-hidden="true" title="下载答题卡" onclick="createTemplate('<?php echo $exam_id; ?>',4)">下载答题卡</span>
  160. <span class=" click-sc addbx answerAnalysis" examId="<?php echo $exam_id;?>" aria-hidden="true" title="下载答案解析">下载答案解析</span>
  161. <span class=" click-sc addbx click-delete answerAnalysis" id="delPaperStudentAll" aria-hidden="true" title="删除全部未考试学生">删除全部未考试学生</span>
  162. </div>
  163. </div>
  164. </form>
  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>名称</th>
  170. <th>班级</th>
  171. <th>是否打印</th>
  172. <th >答卷图片已上传/总数</th>
  173. <th >原卷已上传/总数</th>
  174. <th >操作</th>
  175. </tr>
  176. </thead>
  177. <tbody>
  178. <?php if(!empty($printList)):foreach($printList as $cl):?>
  179. <tr>
  180. <td style="max-width:260px"><?php
  181. $imgSrc = "";if($exam_group_data->mark_type > 0){$imgTitle="线上阅卷";$imgSrc.="/images/online/";}else{$imgTitle="线下阅卷";$imgSrc.="/images/offline/";}$imgSrc.="{$cl["paper_size"]}.png";$cursor = "pointer";echo "<img class='paperType' style='cursor:pointer;width:22px;height:22px;margin-right:5px;' title='{$imgTitle}' src='{$imgSrc}'/>";?>
  182. <?php echo $cl['print_name'];?>
  183. </td>
  184. <td style="max-width:100px"><?php if(isset($class_data[$cl['class_id']])){echo $class_data[$cl['class_id']];}?></td>
  185. <td><?php if(isset($exam_print[$cl['exam_id']]) && !empty($exam_print[$cl['exam_id']])){echo '已打印';}else{echo '未打印';}?></td>
  186. <td>
  187. <?php if(isset($exam_up_student[$cl['exam_id']])){echo count($exam_up_student[$cl['exam_id']]);}else{ echo 0;}?>/<?php if(isset($exam_student[$cl['exam_id']])){echo count($exam_student[$cl['exam_id']]);}else{ echo 0;}?>
  188. </td>
  189. <td>
  190. <?php if(isset($student_img_up_num[$cl['exam_id']])){echo count($student_img_up_num[$cl['exam_id']]);}else{ echo 0;}?>/<?php if(isset($exam_student[$cl['exam_id']])){echo count($exam_student[$cl['exam_id']]);}else{ echo 0;}?>
  191. </td>
  192. <td style="width:265px;">
  193. <span class="iconfont click-sc addbx" aria-hidden="true" title="选择学生" onclick="javascript:location.href='<?php echo $this->createUrl('print/change',array('cid'=>$cl['class_id'],'eid'=>$cl['exam_id'],'tid'=>$cl['type']));?>'">&#xe668;</span>
  194. <?php if(!$print['is_custom_tpl'] && $print['paper_tpl_type'] != 3){ ?><span class="iconfont click-sc addbx" aria-hidden="true" title="<?php if($print['paper_tpl_type'] == 2){echo '打印答题卡';}else{echo '打印试卷';}?>" onclick="<?php if($print["paper_tpl_type"] == 2 && !$print["answer_card_uploaded"]){?>layer.msg('请先上传答题卡模板');<?php }else{?>print('<?php echo $cl['class_id'];?>','<?php echo $cl['exam_id'];?>','0',<?php echo $print['is_tpl'];?>);<?php }?>">&#xe6bb;</span>
  195. <!-- <span class="iconfont icon-zip click-sc addbx print_pack" w_class_id="--><?php //echo $cl['class_id'];?><!--" w_exam_id="--><?php //echo $cl['exam_id']; ?><!--" title="打包打印" ></span>-->
  196. <?php }?>
  197. <?php
  198. if(in_array(Yii::app()->session['session_subject_id'],Yii::app()->params['mathSubjectId'])){
  199. if(isset($exam_student[$cl['exam_id']]) && isset($exam_up_student[$cl['exam_id']]) && count($exam_up_student[$cl['exam_id']]) == count($exam_student[$cl['exam_id']])){
  200. ?>
  201. <?php if($sub_id != 8):?>
  202. <span class="iconfont click-sc icon-yifasong addbx ruanyun" exam_id="<?php echo $cl['exam_id']; ?>" title="发送第三方,并生成提分方案"></span>
  203. <?php endif;?>
  204. <?php }}?>
  205. <?php if($exam_group_data->mark_type ==4 && $cl['status']==1 && $exam_group_data->import_score_type==0 )
  206. {
  207. ?>
  208. <span class="click-sc addbx" aria-hidden="true" title="恢复考试状态" onclick="renewExamStatClass('<?php echo $cl['exam_id']; ?>')">恢复考试状态</span>
  209. <?php
  210. }?>
  211. </td>
  212. </tr>
  213. <?php endforeach;else:?>
  214. <tr><td colspan="5">暂无数据!</td></tr>
  215. <?php endif;?>
  216. </tbody>
  217. </table>
  218. <?php if(!empty($page_total)):?>
  219. <div class="row">
  220. <div class="col-xs-6">
  221. &nbsp;
  222. </div>
  223. <div class="col-xs-6">
  224. <div class="dataTables_paginate paging_simple_numbers">
  225. <?php
  226. $this->widget('CLinkPager', array(
  227. 'header' => '',
  228. 'firstPageLabel'=> '首页',
  229. 'lastPageLabel' => '末页',
  230. 'prevPageLabel' => '上一页',
  231. 'nextPageLabel' => '下一页',
  232. 'pages' => $pages,
  233. 'maxButtonCount'=> 5,
  234. ));
  235. echo '共:'.$page_total.'条';
  236. ?>
  237. </div>
  238. </div>
  239. </div>
  240. <?php endif;?>
  241. </div>
  242. <!--上传模板弹窗-->
  243. <!-- PAGE CONTENT ENDS -->
  244. </div>
  245. </div>
  246. </div>
  247. </div>
  248. <div class="loading-pop" style="display:none;">
  249. <div class="loading-pop-msg">正在打包,请稍候···</div>
  250. </div>
  251. <!-- 弹窗 -->
  252. <div class="confirmbox-mask" style="display: none" id="fieldModal">
  253. <div class="class-modal">
  254. <i class="icon close_1 icon-close"></i>
  255. <div class="class-modal-head">添加考试班级</div>
  256. <form id="examSelect">
  257. <div class="class-modal-body">
  258. <p class="title">年级:高一 分科:文科</p>
  259. <div class="class_area">
  260. <div class="class_left">
  261. <p>A层班级</p>
  262. <input type="checkbox" class="checkAll">全选
  263. </div>
  264. <ul class="class_right area_1">
  265. </ul>
  266. <div class="clear"></div>
  267. <div class="class_left">
  268. <p>B层班级</p>
  269. <input type="checkbox" class="checkAll">全选
  270. </div>
  271. <ul class="class_right area_2">
  272. </ul>
  273. <div class="clear"></div>
  274. <div class="class_left">
  275. <p>C层班级</p>
  276. <input type="checkbox" class="checkAll">全选
  277. </div>
  278. <ul class="class_right area_3">
  279. </ul>
  280. </div>
  281. </div>
  282. <p class="class_btn">
  283. <input type="hidden" name="exam_gruop_id" value="0">
  284. <button type="button" class="setting_sumbit">确定</button>
  285. </p>
  286. </form>
  287. </div>
  288. </div>
  289. <script src="/js/jquery.ajaxfileupload.js"></script>
  290. <script type="text/javascript">
  291. $(document).ready(function(){
  292. /*var str = '<div class="points"></div>';
  293. $(".sc-lis").each(function(){
  294. if($(this).find(".points").length>0){
  295. $(".sel-opt").append(str);
  296. }
  297. });*/
  298. $(".sel-opt,.sel-cons").mouseover(function(){
  299. $(".sel-cons").show();
  300. }).mouseout(function(){
  301. $(".sel-cons").hide();
  302. });
  303. $(".sc-lis").click(function(){
  304. var data = {
  305. subjectId : $(this).attr('val')
  306. };
  307. $.post("<?php echo Yii::app()->createUrl('print/setSubjectId')?>",data,function(flags){
  308. if(flags)
  309. {
  310. location.reload();
  311. }else
  312. {
  313. alert('网络异常');
  314. }
  315. });
  316. $('.has-sel').text($(this).text());
  317. $(".sel-cons").hide();
  318. });
  319. $(".ruanyun").click(function(){
  320. var exam_id = $(this).attr('exam_id');
  321. layer.msg("确定发送吗?学生是否全部上传成绩", {
  322. time: 0,
  323. btn: ['确定', '取消'],
  324. yes: function(index){
  325. layer.close(index);
  326. $.ajax({
  327. url: "<?php echo $this->createUrl('print/send_ruanyun_pdf');?>",
  328. type: "POST",
  329. dataType: "json",
  330. data:{ examId: exam_id
  331. },
  332. success: function (data){
  333. if(data.status == 1){
  334. layer.msg('发送成功',{
  335. icon: 1
  336. }, function(){
  337. layer.closeAll();
  338. location.reload();
  339. });
  340. }else if(data.status == 2){
  341. layer.msg('发送失败,未上传成绩',{
  342. icon: 5
  343. }, function(){
  344. layer.closeAll();
  345. location.reload();
  346. });
  347. }else{
  348. layer.msg('发送失败',{
  349. icon: 5
  350. }, function(){
  351. layer.closeAll();
  352. location.reload();
  353. });
  354. }
  355. },
  356. error: function (data, status, e){ //服务器响应失败处理函数
  357. layer.msg('返回失败!',{
  358. icon: 5
  359. }, function(){
  360. layer.closeAll();
  361. });
  362. }
  363. });
  364. }
  365. });
  366. });
  367. $(".print_pack").click(function(){
  368. $(".loading-pop").show();
  369. var data = {
  370. exam_id:$(this).attr("w_exam_id")
  371. };
  372. $.post("<?php echo Yii::app()->createUrl('print/print_pack')?>",data,function(flags){
  373. var m = JSON.parse(flags);
  374. if(m.status==1)
  375. {
  376. html = ""+
  377. '<div style="padding:20px 30px 0px 30px">'+
  378. '<div style="padding:8px 0;">请复制下方链接打印包。</div>'+
  379. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>'+
  380. '<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>'+
  381. '</div>'+
  382. '</div>'+
  383. "";
  384. layer.open({
  385. type: 1,
  386. area: ['550px', '220px'],
  387. title: '打印包',
  388. content: html,
  389. success: function(index, layerObj){
  390. $(".loading-pop").hide();
  391. 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>');
  392. jQuery("#confirm, #cancel").on("click", function(){
  393. layer.close(layerObj);
  394. });
  395. jQuery("#copy").on("click", function(){
  396. jQuery("#url").select();
  397. });
  398. },
  399. end: function(){
  400. }
  401. });
  402. return;
  403. }else
  404. {
  405. layer.msg(m.result);
  406. $(".loading-pop").hide();return;
  407. }
  408. setTimeout(function() {
  409. $(".loading-pop").hide();
  410. }, 2000);
  411. });
  412. });
  413. $("#delPaperStudentAll").click(function(){
  414. // 判断是否有选中
  415. var studentsIds;
  416. layer.msg('确定删除全部未考试的学生吗?', {
  417. time: 0,
  418. btn: ['确定', '取消'],
  419. yes: function(index){
  420. layer.close(index);
  421. var data={
  422. "exam_group_id":"<?php echo $exam_group_id ?>",
  423. };
  424. jQuery.post(
  425. "<?php echo $this->createUrl("print/delExamStudentAll?");?>",data,function(data){
  426. var m =JSON.parse(data);
  427. if(m.status==1)
  428. {
  429. var icon = 6;
  430. layer.alert("删除成功", {icon: icon}, function(){
  431. location.replace(location.href);
  432. });
  433. }else if(m.status==2){
  434. var icon = 5;
  435. layer.alert("无未上传成绩的学生", {icon: icon}, function(){
  436. location.replace(location.href);
  437. });
  438. }else{
  439. var icon = 5;
  440. layer.alert("删除失败", {icon: icon}, function(){
  441. location.replace(location.href);
  442. });
  443. }
  444. });
  445. }
  446. });
  447. });
  448. });
  449. function objToJson(obj){
  450. var json = "{ ";
  451. for(var item in obj){
  452. json += "'"+item+"':'"+obj[item]+"',";
  453. }
  454. json += " }";
  455. return json;
  456. }
  457. function ccc(){
  458. layer.msg('敬请期待!', {
  459. time: 0,
  460. btn: ['确定', '取消'],
  461. yes: function(index){
  462. layer.close(index);
  463. return false;
  464. }
  465. });
  466. }
  467. function renewExamStat(exam_id) {
  468. if(!exam_id)
  469. {
  470. layer.msg('参数不正确!')
  471. }
  472. var msg = '您确定恢复本次考试状态吗?';
  473. layer.msg(msg, {
  474. time: 0,
  475. btn: ['确定', '取消'],
  476. yes: function(index){
  477. layer.close(index);
  478. $.ajax({
  479. url: "<?php echo $this->createUrl('paper/recover');?>",
  480. type: "POST",
  481. dataType: "json",
  482. data: {
  483. exam_id: exam_id,
  484. },
  485. success: function (data){
  486. var m = data;
  487. if(m.status == 1){
  488. layer.msg('恢复成功,可以继续上传试卷',{
  489. icon: 1
  490. }, function(){
  491. layer.closeAll();
  492. location.reload();
  493. });
  494. }else{
  495. layer.msg('恢复失败,'+m.msg,{
  496. icon: 5
  497. }, function(){
  498. layer.closeAll();
  499. location.reload();
  500. });
  501. }
  502. },
  503. error: function (data, status, e){ //服务器响应失败处理函数
  504. layer.msg('返回失败!',{
  505. icon: 5
  506. }, function(){
  507. layer.closeAll();
  508. });
  509. }
  510. });
  511. }
  512. });
  513. }
  514. function renewExamStatClass(exam_id) {
  515. if(!exam_id)
  516. {
  517. layer.msg('参数不正确!')
  518. }
  519. var msg = '您确定恢复本次考试状态吗?';
  520. layer.msg(msg, {
  521. time: 0,
  522. btn: ['确定', '取消'],
  523. yes: function(index){
  524. layer.close(index);
  525. $.ajax({
  526. url: "<?php echo $this->createUrl('paper/recover_one_class');?>",
  527. type: "POST",
  528. dataType: "json",
  529. data: {
  530. exam_id: exam_id,
  531. },
  532. success: function (data){
  533. var m = data;
  534. if(m.status == 1){
  535. layer.msg('恢复成功,可以继续上传试卷',{
  536. icon: 1
  537. }, function(){
  538. layer.closeAll();
  539. location.reload();
  540. });
  541. }else{
  542. layer.msg('恢复失败,'+m.msg,{
  543. icon: 5
  544. }, function(){
  545. layer.closeAll();
  546. location.reload();
  547. });
  548. }
  549. },
  550. error: function (data, status, e){ //服务器响应失败处理函数
  551. layer.msg('返回失败!',{
  552. icon: 5
  553. }, function(){
  554. layer.closeAll();
  555. });
  556. }
  557. });
  558. }
  559. });
  560. }
  561. function delExam(odj){
  562. if (!odj) return false;
  563. var classId = odj.getAttribute("w_class_id");
  564. var examId = odj.getAttribute("w_exam_id");
  565. var enable = odj.getAttribute("w_enable");
  566. if(enable == 0){
  567. return false;
  568. }
  569. if (!classId || !examId) return false;
  570. var msg = '您确定要删除此班的考试吗?';
  571. layer.msg(msg, {
  572. time: 0,
  573. btn: ['确定', '取消'],
  574. yes: function(index){
  575. layer.close(index);
  576. $.ajax({
  577. url: "<?php echo $this->createUrl('print/delexam');?>",
  578. type: "POST",
  579. dataType: "json",
  580. data: {
  581. examId: examId,
  582. classId:classId
  583. },
  584. success: function (data){
  585. if(data.status == 1){
  586. layer.msg('删除成功',{
  587. icon: 1
  588. }, function(){
  589. layer.closeAll();
  590. location.reload();
  591. });
  592. }else{
  593. layer.msg('删除失败',{
  594. icon: 5
  595. }, function(){
  596. layer.closeAll();
  597. location.reload();
  598. });
  599. }
  600. },
  601. error: function (data, status, e){ //服务器响应失败处理函数
  602. layer.msg('返回失败!',{
  603. icon: 5
  604. }, function(){
  605. layer.closeAll();
  606. });
  607. }
  608. });
  609. }
  610. });
  611. }
  612. // 确认上传成绩
  613. function uploadConfirm(classId, examId,className,is_uploaded_count,students_count) {
  614. //if (confirm('您确定已上传成绩了吗?')) {
  615. msg = "<div style='text-align:left;'>("+className+")已上传(<span style=' font-size:20px;color:#15ae68 ;font-weight: bold'>"+is_uploaded_count+"</span>)份试卷,还有(<span style='font-size:20px;color: red;font-weight: bold'>"+(students_count-is_uploaded_count)+"</span>)份试卷未上传!是否确认本班级试卷都已上传?<br/><br/><span style='color: red'>请注意!试卷上传确认后将不能再次上传本班的试卷!!!</span></div>";
  616. layer.msg(msg, {
  617. time: 0,
  618. btn: ['确定', '取消'],
  619. yes: function(index, layerObj){
  620. layer.close(index);
  621. $.ajax({
  622. url: "<?php echo $this->createUrl('print/uploadConfirm');?>",
  623. type: "POST",
  624. data: {
  625. classId: classId,
  626. examId: examId
  627. },
  628. beforeSend:function(){
  629. // 发送请求显示打印中
  630. layer.msg('确认中...', {time: 20000});
  631. },
  632. dataType: "JSON",
  633. success: function(data) {
  634. if (data.status == 1) {
  635. layer.msg('确认成功!');
  636. setTimeout(function(){location.reload();}, 1300);
  637. } else {
  638. layer.msg(data.error);
  639. }
  640. },
  641. complete:function(){
  642. },
  643. error:function(){
  644. }
  645. });
  646. }
  647. });
  648. //}
  649. }
  650. // 打印错题本
  651. function printBook(cid,eid,type){
  652. if (!cid || !eid || !type) {
  653. layer.msg("打印参数有误");return;
  654. }
  655. var message = '';
  656. var objUrl = '';
  657. if (type == 1) {
  658. message = "您确定要下载该班级纠错本吗?";
  659. objUrl = "<?php echo $this->createUrl('print/downloadwrongtopic');?>";
  660. divTitle = "下载错题本";
  661. improveName = "错题本";
  662. } else if (type == 2){
  663. message = "您确定要下载该班级个性化学习方案吗?";
  664. objUrl = "<?php echo $this->createUrl('print/downloadraisescheme');?>";
  665. divTitle = "下载个性化学习方案";
  666. improveName = "个性化学习方案";
  667. }else if (type == 3){
  668. message = "您确定要下载该班级个性化学习宝吗?";
  669. objUrl = "<?php echo $this->createUrl('print/downloadraisescheme');?>";
  670. divTitle = "下载个性化学习宝";
  671. improveName = "个性化学习宝";
  672. }
  673. else{
  674. layer.msg("打印参数有误");return;
  675. }
  676. html = ""+
  677. '<div style="padding:20px 30px 0px 30px">'+
  678. '<div style="padding:8px 0;">请复制下方链接下载'+improveName+'。</div>'+
  679. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>'+
  680. '<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>'+
  681. '</div>'+
  682. '</div>'+
  683. "";
  684. layer.msg(message, {
  685. time: 0,
  686. btn: ['确定', '取消'],
  687. yes: function(index){
  688. layer.close(index);
  689. msgIndex = layer.msg("下载中请稍后...", {"time": 3600000});
  690. // 更试卷打印时间
  691. $.post("<?php echo $this->createUrl('print/updatepaperprinttime');?>", {cid: cid, eid: eid,type:type } );
  692. /*if(type == 1)
  693. location.href = objUrl+"/cid/"+cid+"/eid/"+eid;
  694. else
  695. location.href = objUrl+"/cid/"+cid+"/eid/"+eid+"/type/"+type;*/
  696. startTime = (new Date()).getTime();
  697. showTip = true;
  698. tipShowed = false;
  699. toPromptTime = 3000;
  700. window.interval = setInterval(function(){
  701. execTime = (new Date()).getTime() - startTime;
  702. if(execTime > toPromptTime && showTip && !tipShowed){
  703. // msgIndex = layer.msg("该文件较大,请耐心等待...", {"time": 3600000});
  704. // tipShowed = true;
  705. }
  706. }, 1000);
  707. jQuery.get(
  708. "<?php echo $this->createUrl("print/getImproveFile");?>",
  709. {"examId": eid, "classId": cid, "type": type},
  710. function(data){
  711. data = JSON.parse(data);
  712. if(data.success == 1||data.success == 2){
  713. layer.open({
  714. type: 1,
  715. area: ['550px', '220px'],
  716. title: divTitle,
  717. content: html,
  718. success: function(index, layerObj){
  719. clearInterval(window.interval);
  720. msgIndex = layer.msg(data.limitinfo, {"time": 3000});
  721. clearInterval(window.interval);
  722. layer.close(msgIndex);
  723. jQuery("#downloadUrl").html('下载地址:<span style=""><input id="url" type="text" size="40" readonly value="'+data.downloadPath+'" /></span><button id="copy" class="label-primary-s bth-s" style="padding:4px 12px;margin:5px 0 10px 15px;">全选</button>');
  724. jQuery("#confirm, #cancel").on("click", function(){
  725. layer.close(layerObj);
  726. });
  727. jQuery("#copy").on("click", function(){
  728. jQuery("#url").select();
  729. });
  730. },
  731. end: function(){
  732. }
  733. });
  734. }
  735. else if(data.success == 0){
  736. clearInterval(window.interval);
  737. msgIndex = layer.msg(data.message, {"time": 3000});
  738. }
  739. }
  740. );
  741. }
  742. });
  743. }
  744. // 上传试卷模板
  745. function uploadTemplate(eid,name, type){
  746. if (!eid) {
  747. layer.msg('考试信息不存在!');
  748. return false;
  749. }
  750. if(type == 1)
  751. forCheckUrl = "<?php echo $this->createUrl('print/verifyTpl');?>";
  752. else
  753. forCheckUrl = "<?php echo $this->createUrl('print/checkanswercard');?>";
  754. $.post(forCheckUrl,{eid:eid},function(data){
  755. var obj = JSON.parse(data);
  756. var html ='<div class="layer_notice" style="padding:5px;">';
  757. html +='<table class="table table-striped table-bordered table-hover ">';
  758. html +='<thead class="thin-border-bottom">';
  759. html +='<tr>';
  760. html +='<th>试卷名称</th>';
  761. html +='<th>是否上传</th>';
  762. html +='<th>操作</th>';
  763. html +='</tr>';
  764. html +='</thead>';
  765. html +='<tbody class="content_tbody">';
  766. if (obj.success == 1) {
  767. html +='<td>'+name+'</td><td><span style="color:red;">已上传</span></td><td><input type="file" name="word_file" id="word_file" /></td></tr>';
  768. } else {
  769. html +='<td>'+name+'</td><td id="alreadUpload">未上传</td><td><input type="file" name="word_file" id="word_file" /></td></tr>';
  770. }
  771. html +='</tbody>';
  772. html +='</table>';
  773. html +='<span style="width:582px;display:inline-block;text-align:center;">';
  774. html +='<button class="btn btn-success btn-sm" onclick="uploadWord('+type+')"><i class="ace-icon fa fa-check bigger-110"></i>确定</button>';
  775. html +='</span>';
  776. html +='<input type="hidden" id="mpEid" value="'+eid+'">';
  777. html +='</div>';
  778. layer.open({
  779. type: 1,
  780. skin: 'layui-layer-rim', //加上边框
  781. area: ['600px', '300px'], //宽高
  782. content: html
  783. });
  784. });
  785. }
  786. function uploadWord(type) {
  787. var paramEid = $('#mpEid').val();
  788. if (!paramEid) {
  789. layer.msg('考试信息不存在!');
  790. return false;
  791. }
  792. var obj_file = $("#word_file").val();
  793. if (!obj_file) {
  794. layer.msg('请选择上传文件');
  795. return false;
  796. }
  797. var extStart = obj_file.lastIndexOf('.');
  798. var extName = obj_file.substring(extStart,obj_file.length).toLowerCase();
  799. if (extName != ".dotx" && extName != ".dotm") {
  800. layer.msg('模板格式有误,请上传dotx格式word!');
  801. return false;
  802. }
  803. $.ajaxFileUpload({
  804. url: "<?php echo $this->createUrl('print/uploadTpl');?>", //用于文件上传的服务器端请求地址
  805. secureuri: false, //是否需要安全协议,一般设置为false
  806. fileElementId: 'word_file', //文件上传域的ID
  807. dataType: 'text', //返回值类型 一般设置为json
  808. data:{"eid":paramEid, "type": type},
  809. success: function (data, status){
  810. var obj = JSON.parse(data);
  811. if (obj.success == 1) {
  812. layer.msg(obj.message,{
  813. icon: 1,
  814. }, function(){
  815. layer.closeAll();
  816. });
  817. $("#alreadUpload").html('<span style="color:red;">已上传</span>');
  818. location.reload();
  819. } else {
  820. layer.msg(obj.message,{
  821. icon: 5,
  822. }, function(){
  823. layer.closeAll();
  824. });
  825. }
  826. },
  827. error: function (data, status, e){ //服务器响应失败处理函数
  828. layer.msg('返回失败!',{
  829. icon: 5,
  830. }, function(){
  831. layer.closeAll();
  832. });
  833. }
  834. });
  835. return false;
  836. }
  837. // 搜索事件
  838. $("#search").click(function(){
  839. $("#form1").submit();
  840. });
  841. function print(cid,eid,tid,fg){
  842. if (!cid || !eid) return false;
  843. var msg = '';
  844. if (fg == 1) {
  845. msg = '打印答题卡';
  846. } else {
  847. msg = '您确定要打印该试卷嘛?';
  848. }
  849. layer.msg(msg, {
  850. time: 0,
  851. btn: ['确定', '取消'],
  852. yes: function(index){
  853. layer.close(index);
  854. ajaxPrint(cid, eid, tid);
  855. }
  856. });
  857. }
  858. function ajaxPrint(cid, eid, tid) {
  859. $.ajax({
  860. url:"<?php echo $this->createUrl('print/ajaxupdate');?>",
  861. type:"post",
  862. data:{cid:cid,eid:eid,tid:tid},
  863. dataType: "json",
  864. beforeSend:function(){
  865. // 发送请求显示打印中
  866. layer.msg('打印中', {icon: 16,time: 20000});
  867. },
  868. success:function(obj){
  869. var index = layer.msg();
  870. layer.close(index);
  871. if (obj.success == 1) {
  872. if (tid == 0) {//console.log(JSON.stringify(obj.message));
  873. evaluationClient.newprintPaper(JSON.stringify(obj.message));
  874. //alert('提交打印试卷成功!');
  875. } else if (tid == 1) {
  876. evaluationClient.printCTB(JSON.stringify(obj.message));
  877. //alert('提交打印错题本成功!');
  878. } else if (tid == 2) {
  879. evaluationClient.printTFFA(JSON.stringify(obj.message));
  880. //alert('提交打印提分册成功!');
  881. } else {
  882. layer.msg('操作错误!');
  883. }
  884. location.reload();
  885. } else {//alert(obj.message);
  886. layer.msg(obj.message);
  887. }
  888. },
  889. complete:function(){
  890. //layer.msg('打印失败!');
  891. //var index = layer.msg();
  892. //layer.close(index);
  893. },
  894. error:function(){
  895. //var index = layer.msg();
  896. //layer.close(index);
  897. }
  898. });
  899. }
  900. // 生成试卷模板
  901. function createTemplate (eid){
  902. if (!eid) {
  903. layer.msg('未找到考试信息');
  904. }
  905. var msg = '';
  906. msg = '您确定要下载答题卡嘛?';
  907. layer.msg(msg, {
  908. time: 0,
  909. btn: ['确定', '取消'],
  910. yes: function(index){
  911. layer.close(index);
  912. $.post('<?php echo $this->createUrl('print/create_united_tempelate');?>',{"eid":eid},function(data){
  913. var obj = JSON.parse(data);
  914. if (obj.success == 1) {
  915. evaluationClient.CreateSchoolPaper(JSON.stringify(obj.object));
  916. } else {
  917. layer.msg(obj.message);
  918. }
  919. });
  920. }
  921. });
  922. }
  923. function wb_html(odj){
  924. if (!odj) return false;
  925. var classId = odj.getAttribute("w_class_id");
  926. var examId = odj.getAttribute("w_exam_id");
  927. if (!classId || !examId) return false;
  928. var msg = '您确定要生成该班级的错题本吗?';
  929. layer.msg(msg, {
  930. time: 0,
  931. btn: ['确定', '取消'],
  932. yes: function(index){
  933. layer.close(index);
  934. $.ajax({
  935. url: "<?php echo $this->createUrl('client/wbhtml');?>",
  936. type: "POST",
  937. dataType: "json",
  938. data: {
  939. examId: examId,
  940. classId:classId
  941. },
  942. success: function (data){
  943. if(data > 0){
  944. layer.msg('操作成功,重新生成错题本',{
  945. icon: 1
  946. }, function(){
  947. layer.closeAll();
  948. });
  949. }else if(data==0){
  950. layer.msg('操作失败,此班无错题本',{
  951. icon: 5
  952. }, function(){
  953. layer.closeAll();
  954. });
  955. }
  956. else{
  957. layer.msg('操作失败,重新生成错题本',{
  958. icon: 5
  959. }, function(){
  960. layer.closeAll();
  961. });
  962. }
  963. },
  964. error: function (data, status, e){ //服务器响应失败处理函数
  965. layer.msg('返回失败!',{
  966. icon: 5
  967. }, function(){
  968. layer.closeAll();
  969. });
  970. }
  971. });
  972. }
  973. });
  974. }
  975. function isp2_html(odj){
  976. if (!odj) return false;
  977. var classId = odj.getAttribute("w_class_id");
  978. var examId = odj.getAttribute("w_exam_id");
  979. if (!classId || !examId) return false;
  980. var msg = '您确定要生成该班级的二步提分方案吗?';
  981. layer.msg(msg, {
  982. time: 0,
  983. btn: ['确定', '取消'],
  984. yes: function(index){
  985. layer.close(index);
  986. $.ajax({
  987. url: "<?php echo $this->createUrl('client/isp2html');?>",
  988. type: "POST",
  989. dataType: "json",
  990. data: {
  991. examId: examId,
  992. classId:classId
  993. },
  994. success: function (data){
  995. if(data > 0){
  996. layer.msg('操作成功,重新生成提分方案',{
  997. icon: 1
  998. }, function(){
  999. layer.closeAll();
  1000. });
  1001. }else if(data==0){
  1002. layer.msg('操作失败,此班无提分方案',{
  1003. icon: 5
  1004. }, function(){
  1005. layer.closeAll();
  1006. });
  1007. }
  1008. else{
  1009. layer.msg('操作失败,重新生成提分方案',{
  1010. icon: 5
  1011. }, function(){
  1012. layer.closeAll();
  1013. });
  1014. }
  1015. },
  1016. error: function (data, status, e){ //服务器响应失败处理函数
  1017. layer.msg('返回失败!',{
  1018. icon: 5
  1019. }, function(){
  1020. layer.closeAll();
  1021. });
  1022. }
  1023. });
  1024. }
  1025. });
  1026. }
  1027. function isp3_html(odj){
  1028. if (!odj) return false;
  1029. var classId = odj.getAttribute("w_class_id");
  1030. var examId = odj.getAttribute("w_exam_id");
  1031. if (!classId || !examId) return false;
  1032. var msg = '您确定要生成该班级的个性化学习宝吗?';
  1033. layer.msg(msg, {
  1034. time: 0,
  1035. btn: ['确定', '取消'],
  1036. yes: function(index){
  1037. layer.close(index);
  1038. $.ajax({
  1039. url: "<?php echo $this->createUrl('client/isp3html');?>",
  1040. type: "POST",
  1041. dataType: "json",
  1042. data: {
  1043. examId: examId,
  1044. classId:classId
  1045. },
  1046. success: function (data){
  1047. if(data > 0){
  1048. layer.msg('操作成功,重新生成提分方案',{
  1049. icon: 1
  1050. }, function(){
  1051. layer.closeAll();
  1052. });
  1053. }else if(data==0){
  1054. layer.msg('操作失败,此班无提分方案',{
  1055. icon: 5
  1056. }, function(){
  1057. layer.closeAll();
  1058. });
  1059. }
  1060. else{
  1061. layer.msg('操作失败,重新生成提分方案',{
  1062. icon: 5
  1063. }, function(){
  1064. layer.closeAll();
  1065. });
  1066. }
  1067. },
  1068. error: function (data, status, e){ //服务器响应失败处理函数
  1069. layer.msg('返回失败!',{
  1070. icon: 5
  1071. }, function(){
  1072. layer.closeAll();
  1073. });
  1074. }
  1075. });
  1076. }
  1077. });
  1078. }
  1079. // 隐藏试卷
  1080. function oprateExam(examId,flag){
  1081. if (examId) {
  1082. layer.msg('未找到周周练id');
  1083. }
  1084. var msg = '您确定要隐藏该试卷吗?';
  1085. if (flag == 0) {
  1086. msg = '您确定要恢复该试卷吗?';
  1087. }
  1088. layer.msg(msg, {
  1089. time: 0,
  1090. btn: ['确定', '取消'],
  1091. yes: function(index){
  1092. layer.close(index);
  1093. $.post('<?php echo $this->createUrl("print/oprateexam");?>',{examId:examId,flag:flag},function(data){
  1094. var obj = JSON.parse(data);
  1095. if (obj.success == 1) {
  1096. location.reload();
  1097. } else {
  1098. layer.msg(obj.message);
  1099. }
  1100. });
  1101. }
  1102. });
  1103. }
  1104. </script>