product.php 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978
  1. <style>
  2. .nav-btns{
  3. margin: 10px 20px;
  4. }
  5. .nav-btns>a{
  6. display: inline-block;
  7. width: 120px;
  8. border: 1px solid #40c180;
  9. text-align: center;
  10. line-height: 30px;
  11. }
  12. .active{
  13. color: #fff;
  14. background-color: #40c180;
  15. }
  16. .fr{
  17. float: right;
  18. }
  19. .filter * {
  20. font-size: 14px;
  21. }
  22. .filter label {
  23. font-weight: bold;
  24. }
  25. .filter select {
  26. height: 36px;
  27. font-size: 14px;
  28. margin-left: 10px;
  29. }
  30. .filter select:nth-child(2) {
  31. width: 82px;
  32. }
  33. .filter select:nth-child(3) {
  34. width: 110px;
  35. }
  36. .filter button {
  37. border: none;
  38. background: #009965;
  39. width: 111px;
  40. height: 36px;
  41. border-radius: 3px;
  42. font-size: 14px;
  43. color: #fff;
  44. outline: none;
  45. cursor: pointer;
  46. margin-left: 10px;
  47. }
  48. .showClassInfo{
  49. cursor: pointer;
  50. }
  51. .list table {
  52. width: 96%;
  53. margin-top: 20px;
  54. text-align: center;
  55. border-right: 1px solid #ccc;
  56. margin:20px auto 0 auto;
  57. }
  58. .list table th {
  59. background: #f2f2f2;
  60. border: 1px solid #ccc;
  61. border-right: none;
  62. padding: 12px 15px;
  63. }
  64. .list table td {
  65. border: 1px solid #ccc;
  66. border-right: none;
  67. border-top: none;
  68. padding: 12px 15px;
  69. font-weight: bold;
  70. }
  71. .list table tr:nth-child(even) {
  72. background: #f2f2f2;
  73. }
  74. .list .tl {
  75. text-align: left;
  76. }
  77. .list .red {
  78. color: #cc3400;
  79. }
  80. .list .green {
  81. color: #079b67;
  82. }
  83. .icon {
  84. display: inline-block;
  85. background: center/contain no-repeat;
  86. width: 25px;
  87. height: 25px;
  88. cursor: pointer;
  89. vertical-align: middle;
  90. }
  91. .list .subjects {
  92. line-height: 22px;
  93. font-size: 0;
  94. }
  95. .list .icon{
  96. margin: 0 4px;
  97. }
  98. .list .subjects span {
  99. display: inline-block;
  100. font-size: 16px;
  101. word-break: keep-all;
  102. margin: 0 4px;
  103. }
  104. .confirmbox {
  105. background: #fff;
  106. border: 1px solid #cccccc;
  107. border-radius: 3px;
  108. padding: 40px 40px 30px;
  109. text-align: center;
  110. position: fixed;
  111. left: 50%;
  112. top: 50%;
  113. transform: translate(-50%, -50%);
  114. z-index: 99;
  115. }
  116. .confirmbox-mask {
  117. background: rgba(0, 0, 0, .7);
  118. left: 0;
  119. right: 0;
  120. top: 0;
  121. bottom: 0;
  122. z-index: 99;
  123. position: fixed;
  124. }
  125. .btn_area button {
  126. border: none;
  127. background: #009965;
  128. width: 111px;
  129. height: 36px;
  130. border-radius: 3px;
  131. font-size: 14px;
  132. color: #fff;
  133. outline: none;
  134. cursor: pointer;
  135. }
  136. .btn_area button.save {
  137. display: block;
  138. margin: 40px auto;
  139. }
  140. .confirmbox .confirmbox-btns {
  141. margin-top: 40px;
  142. }
  143. .class-modal-body .classes {
  144. margin-bottom: 10px;
  145. }
  146. .class-modal-body .classes > div {
  147. display: inline-block;
  148. max-width: 640px;
  149. vertical-align: top;
  150. }
  151. .class-modal-body .classes a {
  152. text-decoration: none;
  153. display: inline-block;
  154. margin: 0 5px 5px;
  155. color: #136bfb;
  156. font-size: 14px;
  157. }
  158. .class-modal-body .classes a.active {
  159. color: #fc091b
  160. }
  161. .class-modal .icon-close{
  162. position: absolute;
  163. right: 20px;
  164. top: 20px;
  165. }
  166. .class-modal-1 {
  167. width: auto;
  168. background: #fff;
  169. border-radius: 5px;
  170. position: absolute;
  171. top: 50%;
  172. left: 50%;
  173. transform: translate(-50%, -50%);
  174. }
  175. .class-modal-head-1 {
  176. font-size: 14px;
  177. text-align: left;
  178. color:#fff;
  179. line-height:30px;
  180. background: #2977ff;
  181. padding-left:15px;
  182. }
  183. .class-modal-body-1{
  184. padding:15px;
  185. }
  186. .class-modal-body-1 h2,.class-modal-body-1 h3{
  187. font-size:14px;
  188. font-weight:normal;
  189. margin-top:10px;
  190. }
  191. .class-modal-body-1 h3 span{
  192. font-size:10px;
  193. color:#ccc;
  194. }
  195. .class-modal-body-1 label{
  196. display: inline-block;
  197. font-weight: normal;
  198. margin-right: 15px;
  199. height:30px;
  200. position: relative;
  201. }
  202. .class-modal-1 .icon-close-1{
  203. position: absolute;
  204. right: 10px;
  205. top:5px;
  206. }
  207. .class-modal-1 .class_area{
  208. height:115px;
  209. border:1px solid #ccc;
  210. padding:5px;
  211. overflow-y: auto;
  212. margin-bottom:15px;
  213. }
  214. .class-modal-1 .checkAll{
  215. position:absolute;
  216. right:5px;
  217. top:115px;
  218. }
  219. .class-modal-1 .subsection{
  220. }
  221. .class-modal-1 .btn p{color:#000;}
  222. .class-modal-1 .btn_area{
  223. padding: 10px;
  224. border-top: 1px solid #aab6aa;
  225. margin-top:10px;
  226. }
  227. .class-modal-1 .btn_area p{
  228. display: inline-block;
  229. }
  230. .class-modal-1 .btn_area button{
  231. margin-left:5px;
  232. }
  233. .class-modal-1 .btn_area .cancel{
  234. background: #fff;
  235. color:#000;
  236. border:1px solid #666;
  237. }
  238. .c-red-1 {
  239. color: #CC3300;
  240. font-size:10px;
  241. display: inline-block;
  242. position:absolute;
  243. left:15px;
  244. top:18px;
  245. }
  246. .vtm{vertical-align: middle;}
  247. .pointer{cursor: pointer;}
  248. .dib{display: inline-block;}
  249. .pdp-con .pop-opt-con{border-top: 1px solid #ddd;padding-top: 20px;}
  250. .tit-sub-intro{color: #666;}
  251. .tit-sub-intro span{font-size: 12px;}
  252. .subsection{width: 44px;height: 24px;border: 1px solid #ddd;text-align: center;font-size: 12px;}
  253. .reduce-btn,.add-btn{width: 16px;height: 16px;line-height: 16px;text-align: center;color: #16AE68;border: 1px solid #16AE68;border-radius: 3px;font-size: 16px;font-weight: bold;margin-right: 6px;}
  254. .reduce-btn.forbidden,.add-btn.forbidden{color: #bbb;border: 1px solid #bbb;cursor: no-drop;}
  255. /*打印历史产品弹框*/
  256. .modal-content{position: absolute;left: 50%;top: 50%;padding-top: 40px; width: 500px;background: #fff; transform: translate(-50%,-50%);}
  257. .modal-title{position: absolute;top: 0;left: 0;padding-left: 20px; width: 100%;height: 40px;line-height: 40px;background: #009965;color:#fff;}
  258. .modal-title em{width: 40px;height: 40px;text-align: center;font-size: 20px;cursor: pointer;}
  259. .modal-btn{text-align: center;margin:10px 0;}
  260. .modal-btn a{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #50d2c2;color: #fff;}
  261. .modal-btn{text-align: center;margin:10px 0;}
  262. .modal-btn a{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #009965;color: #fff;}
  263. .modal-btn .close3{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #fff;color: #000;border:1px solid #555;border-radius: 3px;}
  264. .modal1_multi{position: fixed;top: 0;left: 0;width: 100%;height: 100%;font-size:14px;display:none ;background: rgba(0,0,0,.4)}
  265. .modal1_multi .model-score-m{width:80%;margin:5px auto;height: 20px;}
  266. .model-rule{width:80%;margin:8px auto;text-align: left;font-size:12px;}
  267. .modal1_multi .model-score-m label{margin:5px 0;font-size: 12px;color:red;font-weight: initial}
  268. </style>
  269. <script type="text/javascript">
  270. jQuery(document).ready(function(){
  271. // 根据年级筛选班级
  272. jQuery("#grade").change(function(){
  273. var grade = $(this).val();
  274. var subjectId='<?php echo $subjectId?>';
  275. if (!grade) return false;
  276. jQuery.post(
  277. '<?php echo $this->createUrl("print/getGradeClass");?>',{"grade": grade,"subjectId":subjectId},function(data){
  278. data = JSON.parse(data);
  279. var html = "<option value=''>全部班级</option>";
  280. if(data.success == 1){
  281. var classObj = $("#class");
  282. classObj.empty();
  283. $.each(data.message,function(i,n){
  284. html += "<option value='"+n.class_id+"'>" + n.class_name + "</option>";
  285. });
  286. }
  287. classObj.append(html);
  288. }
  289. );
  290. });
  291. });
  292. </script>
  293. <link rel="stylesheet" href="/fonts/fpdf/iconfont.css" />
  294. <div class="main-content-inner">
  295. <!-- 导航栏开始-->
  296. <?php include(Yii::app()->basePath.'/views/layouts/view_production_navigation.php');?>
  297. <!-- 导航栏结束-->
  298. <div class="page-content">
  299. <div class="row" style="margin:0px;">
  300. <div class="col-xs-12">
  301. <!-- PAGE CONTENT BEGINS -->
  302. <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
  303. <div class="row">
  304. <form method="get" id="form1" action="<?php echo $this->createUrl("junior/product",array('type'=>$type));?>">
  305. <div class="col-xs-12">
  306. <div class="dataTables_length margin-zy">
  307. <select class="form-control" id="grade" name="grade">
  308. <option value="0">年级</option>
  309. <?php
  310. if(Yii::app()->params['grade_config']){
  311. foreach (Yii::app()->params['grade_config'] as $id=> $val){
  312. if($grade==$id){
  313. echo '<option value="'.$id.'" selected >'.$val['grade_name'].'</option>';
  314. }else{
  315. echo '<option value="'.$id.'" >'.$val['grade_name'].'</option>';
  316. }
  317. }
  318. }
  319. ?>
  320. </select>
  321. <select class="form-control" id="class" name="classId">
  322. <option value="">全部班级</option>
  323. <?php foreach($classes as $class){?>
  324. <option <?php if((string)$classId == (string)$class["class_id"]) echo "selected";?> value="<?php echo $class["class_id"];?>"><?php echo $class["class_name"];?></option>
  325. <?php }?>
  326. </select>
  327. <input type="text" class="form-control input-sm" placeholder="请输入打印任务名称" name="name" value="<?php echo $printName;?>">
  328. <button class="label-primary-s bth-s" id="search" style="padding:4px 12px;">搜索</button>
  329. <span style="font-size:13px;padding-left:2px;color:red;">
  330. 提示:生成的错题本、个性化学习宝仅保留7天
  331. </span>
  332. <div class="dataTables_filter" id="dynamic-table_filter" style="float: right;">
  333. <a id="batchPrint" href="javascript:void(0);" class="btn label-primary-green btn-sm">批量下载</a>
  334. <a href="javascript:void(0);" class="btn label-primary-green btn-sm" id="selectPrint">
  335. <i style="font-style: normal;" class="fa fa-print"></i> 发送云印任务
  336. </a>
  337. </div>
  338. </div>
  339. </div>
  340. </form>
  341. </div>
  342. <table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable" style="font-size:12px">
  343. <thead>
  344. <tr>
  345. <th class="center">
  346. <input type="checkbox" class="ace selectAll" />
  347. </th>
  348. <th>名称</th>
  349. <th>班级</th>
  350. <th>完成日期</th>
  351. <th >已生成/总数</th>
  352. <th>是否下载</th>
  353. <th >操作</th>
  354. </tr>
  355. </thead>
  356. <tbody>
  357. <?php if(!empty($printList)):?>
  358. <?php foreach($printList as $cl):?>
  359. <tr>
  360. <td>
  361. <?php if(!$cl['is_cloud_print']){?>
  362. <input type="checkbox" class="ace myselect" value="<?php echo $cl['class_id'].'_'.$cl['exam_id'].'_'.$type.'_0'; ?>">
  363. <?php }?>
  364. </td>
  365. <td style="max-width:260px">
  366. <?php if($cl['isDown']==0) { echo "<span style='color: #ff0000;font-weight: bold;'>【New】</span>";};
  367. echo "<a href=".$this->createUrl("print/getExamClass",array("examGroupId" => $cl['exam_group_id'],"printType"=>"exam_product","productType"=>$type,"subjectId"=>$duo_sub_id)).">{$cl['print_name']}</a>"
  368. ?>
  369. </td>
  370. <td style="max-width:100px"><?php echo $cl['class_name'];?></td>
  371. <td><?php if(!empty($cl['complete_time'])){ echo date('Y-m-d H:i',$cl['complete_time']);}?></td>
  372. <td><span style="color: green;"><?php echo $cl['pdfCount'];?></span>/<span><?php echo $cl['totalCount'];?></span></td>
  373. <td><?php echo $cl["isDown"] ? '已下载' : '未下载';?></td>
  374. <td style="width:265px;">
  375. <span class="iconfont click-sc addbx" aria-hidden="true" title="下载<?php echo $desc;?>" onclick="printBook('<?php echo $cl['class_id'];?>','<?php echo $cl['exam_id'];?>',<?php echo $type;?>)">&#xe6bb;</span>
  376. <span class="iconfont click-sc addbx" aria-hidden="true" title="选择学生下载<?php echo $desc;?>" onclick="javascript:location.href='<?php echo $this->createUrl('junior/product_stu',array('type'=>$type,'cid'=>$cl['class_id'],'eid'=>$cl['exam_id']));?>'">&#xe668;</span>
  377. <span class="fa fa-file-pdf-o click-sc addbx" style="padding:0.5px 9px" aria-hidden="true" title="下载教学宝" onclick="downpdf('<?php echo (string)$cl['exam_id'];?>','<?php echo (string)$cl['class_id'];?>',<?php echo $type;?>,<?php echo $type==1?1:0;?>)"></span>
  378. <!-- 发送云印任务 -->
  379. <span class="iconfont click-sc addbx" <?php if($cl['is_cloud_print'] == 1) echo 'style="background-color:gray"';?> aria-hidden="true" title="<?php if($cl['is_cloud_print'] == 1){echo ' 24小时内不可重复发送';}else{echo '发送云印任务';}?>" onclick="sendCloudTask('<?php echo $cl['class_id'];?>','<?php echo $cl['exam_id'];?>',<?php echo $type;?>,<?php echo $cl['is_cloud_print'] == 1 ? 1 :0;?>)">云</span>
  380. </td>
  381. </tr>
  382. <?php endforeach;?>
  383. <?php endif;?>
  384. </tbody>
  385. </table>
  386. <?php if(!empty($page_total)):?>
  387. <div class="row">
  388. <div class="col-xs-6">
  389. &nbsp;
  390. </div>
  391. <div class="col-xs-6">
  392. <div class="dataTables_paginate paging_simple_numbers">
  393. <?php
  394. $this->widget('CLinkPager', array(
  395. 'header' => '',
  396. 'firstPageLabel'=> '首页',
  397. 'lastPageLabel' => '末页',
  398. 'prevPageLabel' => '上一页',
  399. 'nextPageLabel' => '下一页',
  400. 'pages' => $pages,
  401. 'maxButtonCount'=> 5,
  402. ));
  403. echo '共:'.$page_total.'条';
  404. ?>
  405. </div>
  406. </div>
  407. </div>
  408. <?php endif;?>
  409. </div>
  410. <!--发送云印任务弹窗-->
  411. <div class="confirmbox-mask" id="classModal-1" style="display: none;">
  412. <div class="class-modal-1">
  413. <i class="icon icon-close-1" style="color: white">X</i><div class="class-modal-head-1">发送云印任务</div>
  414. <div class="class-modal-body-1">
  415. <div>
  416. <span>亲爱的学管:您正在发起云印任务,请核对以下云印任务数据!</span>
  417. <span style="float: right;">共<i id="task_count">0</i>条任务,<i id="total_print_num">0</i>份云印任务</span>
  418. </div>
  419. <table style="margin-top: 15px;" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable">
  420. <thead>
  421. <tr>
  422. <th>序号</th>
  423. <th>任务名称</th>
  424. <th>班级</th>
  425. <th>完成日期</th>
  426. <th>已生成/已开通/可下载</th>
  427. <th>已下载</th>
  428. <th>云印份数</th>
  429. <th>备注</th>
  430. </tr>
  431. </thead>
  432. <tbody id="taskList">
  433. </tbody>
  434. </table>
  435. <div style="margin-top: 40px;">
  436. <span><img width="20px" height="20px" src="/images/icon-tip.svg">发送后,请至学管端【IMS-云印任务】模块查看任务进程,请等待云印中心打印后,寄回给学校!</span>
  437. <span style="margin-left:15px;float: right;"><input id="filter-uploaded" checked="checked" type="checkbox">过滤【已下载】的学生</span>
  438. </div>
  439. <div class="btn_area" style="text-align: center;">
  440. <input type="hidden" id="sendJson" name="sendJson" value="">
  441. <button id="sendCloudPrint" class="download">发送</button>
  442. <button class="cancel">取消</button>
  443. </div>
  444. </div>
  445. </div>
  446. </div>
  447. <!-- PAGE CONTENT ENDS -->
  448. </div>
  449. </div>
  450. </div>
  451. </div>
  452. <script src="/js/jquery.ajaxfileupload.js"></script>
  453. <script type="text/javascript">
  454. $(document).ready(function(){
  455. $(".sel-opt,.sel-cons").mouseover(function(){
  456. $(".sel-cons").show();
  457. }).mouseout(function(){
  458. $(".sel-cons").hide();
  459. });
  460. $(".sc-lis").click(function(){
  461. var data = {
  462. subjectId : $(this).attr('val')
  463. };
  464. $.post("<?php echo Yii::app()->createUrl('print/setSubjectId')?>",data,function(flags){
  465. if(flags)
  466. {
  467. location.reload();
  468. }else
  469. {
  470. alert('网络异常');
  471. }
  472. });
  473. $('.has-sel').text($(this).text());
  474. $(".sel-cons").hide();
  475. });
  476. });
  477. // 打印错题本
  478. function printBook(cid,eid,type){
  479. if (!cid || !eid || !type) {
  480. layer.msg("打印参数有误");return;
  481. }
  482. var message = "您确定要下载该班级<?php echo $desc;?>吗?";
  483. var divTitle = "下载错题本";
  484. var improveName = "错题本";
  485. html = ""+
  486. '<div style="padding:20px 30px 0px 30px">'+
  487. '<div style="padding:8px 0;">请复制下方链接下载'+improveName+'。</div>'+
  488. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>'+
  489. '<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>'+
  490. '</div>'+
  491. '</div>'+
  492. "";
  493. layer.msg(message, {
  494. time: 0,
  495. btn: ['确定', '取消'],
  496. yes: function(index){
  497. layer.close(index);
  498. $.ajax({
  499. url: "<?php echo $this->createUrl('productdownexam/getUrl');?>",
  500. type: "GET",
  501. dataType: "json",
  502. data: {"examId": eid, "classId": cid, "type": type,"printType":"<?php echo $printType;?>"},
  503. timeout: <?php echo Yii::app()->params["product_download_time_limit"];?>,
  504. beforeSend:function(){
  505. layer.msg("下载中请稍后...",{"time": <?php echo Yii::app()->params["product_download_time_limit"];?>});
  506. },
  507. error: function (jqXHR, textStatus, errorThrown) {
  508. if(textStatus=="timeout"){
  509. $.ajax({
  510. type:'GET',
  511. url: "<?php echo $this->createUrl("productdownexam/addTask");?>",
  512. data: {"examId": eid, "classId": cid, "type": type,"printType":"<?php echo $printType;?>"},
  513. dataType: "json",
  514. success:function (data) {
  515. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!',{
  516. icon: 1,
  517. yes:function(){
  518. layer.closeAll();
  519. }
  520. });
  521. }
  522. })
  523. }else {
  524. layer.msg('返回失败!',{
  525. icon: 5
  526. }, function(){
  527. layer.closeAll();
  528. });
  529. }
  530. },
  531. success: function (data){
  532. layer.closeAll();
  533. if(data.success == 1||data.success == 2){
  534. layer.open({
  535. type: 1,
  536. area: ['550px', '220px'],
  537. title: divTitle,
  538. content: html,
  539. success: function(index, layerObj){
  540. // 更试卷打印时间
  541. //$.post("<?php //echo $this->createUrl('print/updatepaperprinttime');?>//", {cid: cid, eid: eid,type:type } );
  542. 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>');
  543. jQuery("#confirm, #cancel").on("click", function(){
  544. layer.close(layerObj);
  545. });
  546. jQuery("#copy").on("click", function(){
  547. jQuery("#url").select();
  548. });
  549. },
  550. end: function(){
  551. }
  552. });
  553. }else if(data.success == 3){
  554. // 更试卷打印时间
  555. //$.post("<?php //echo $this->createUrl('print/updatepaperprinttime');?>//", {cid: cid, eid: eid,type:type } );
  556. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!',{
  557. icon: 1,
  558. yes:function(){
  559. layer.closeAll();
  560. }
  561. });
  562. }
  563. else if(data.success == 0){
  564. layer.msg(data.message, {"time": 3000});
  565. }
  566. },
  567. });
  568. }
  569. });
  570. }
  571. // 搜索事件
  572. $("#search").click(function(){
  573. $("#form1").submit();
  574. });
  575. $('.confirmbox-mask .icon-close-1').click(function () {
  576. $('.confirmbox-mask').hide();
  577. })
  578. $('.confirmbox-mask .cancel').click(function () {
  579. $('.confirmbox-mask').hide();
  580. })
  581. //发送云印任务
  582. function sendCloudTask(cid,eid,type,isDisable){
  583. if(isDisable === 1){
  584. return false;
  585. }
  586. //$('.confirmbox-mask').show();return false;
  587. if (!cid || !eid || !type) {
  588. layer.msg("参数有误");return;
  589. }
  590. // 更试卷打印时间
  591. var saveDataAry=[];
  592. var data1={"examId": eid, "classId": cid, "type": type,"printType":"<?php echo $printType;?>"};
  593. saveDataAry.push(data1);
  594. $.ajax({
  595. type: "POST",
  596. url: "<?php echo $this->createUrl("printCloud/generateExamProduct");?>",
  597. dataType: "json",
  598. contentType: "application/json",
  599. data: JSON.stringify(saveDataAry),
  600. beforeSend:function(){
  601. layer.load(1, {
  602. shade: [0.1,'#fff'] //0.1透明度的白色背景
  603. });
  604. },
  605. success:function(data) {
  606. var index = layer.load();
  607. layer.close(index);
  608. if (data.status == 1) {
  609. $('#sendJson').attr('value', JSON.stringify(data));
  610. var con = '';
  611. var task_count = 0;
  612. var totalCount = 0;
  613. $.each(data.data, function(index, item) {
  614. var one_count = item.enable_download_count - item.download_count;
  615. totalCount += (one_count>0?one_count:0);
  616. if((item.enable_download_count - item.download_count)>0) {
  617. task_count += 1;
  618. }
  619. con += '<tr><td>' + (index + 1) + '</td><td>' + item.taskName + '</td><td>' + item.clazzName + '</td><td>' + item.complete_time + '</td><td>'
  620. + item.generate_count + '/' + item.dredge_count + '/' + '<i style="color: green">' + item.enable_download_count + '</i><input type="hidden" name="drege_count" value="'+ item.enable_download_count +'"></td><td>'
  621. + item.download_count + '</td><td>' + (one_count>0?one_count:0) + '</td><td>' + (one_count>0?'可发送':'不可发送')
  622. + '</td></tr>'
  623. });
  624. $('#task_count').html(task_count);
  625. $('#total_print_num').html(totalCount);
  626. $('#taskList').html(con);
  627. $('#filter-uploaded').attr({'cid':cid, 'eid':eid, 'typeId':type, 'printType':"<?php echo $printType;?>"});
  628. $('#filter-uploaded').prop("checked", true)
  629. $('.confirmbox-mask').show();
  630. } else if (data.status == 0) {
  631. layer.msg(data.message);
  632. }
  633. }
  634. }
  635. );
  636. }
  637. //批量发送云印任务
  638. $("#selectPrint").click(function() {
  639. // 判断是否有选中
  640. if (!$("input[class='ace myselect']").is(':checked')) {
  641. layer.msg('至少选择一个目标!');
  642. return false;
  643. }
  644. var result = [];
  645. $(".myselect").each(function(m,n){
  646. if ($(this).prop('checked')) {
  647. if ($(this).val() /*&& $(this).attr("stnm")*/) {
  648. result.push($(this).val());
  649. }
  650. }
  651. })
  652. var sp = [];
  653. var cid = 0;
  654. var eid = 0;
  655. var type = 0;
  656. var isDisable = 0;
  657. var saveDataAry=[];
  658. var data1 = [];
  659. for(i=0;i<result.length;i++)
  660. {
  661. sp = result[i].split('_');
  662. cid = sp[0];
  663. eid = sp[1];
  664. type = sp[2];
  665. isDisable = sp[3];
  666. if(isDisable == 1 || !cid || !eid || !type) continue;
  667. // 更试卷打印时间
  668. //$.post("<?php //echo $this->createUrl('print/updatepaperprinttime');?>//", {cid: cid, eid: eid,type:type } );
  669. //alert(cid);alert(eid);alert(type);alert(printType);
  670. data1 = {"examId": eid, "classId": cid, "type": type,"printType":"<?php echo $printType;?>"};
  671. saveDataAry.push(data1);
  672. }
  673. $.ajax({
  674. type: "POST",
  675. url: "<?php echo $this->createUrl("printCloud/generateExamProduct");?>",
  676. dataType: "json",
  677. contentType: "application/json",
  678. data: JSON.stringify(saveDataAry),
  679. beforeSend:function(){
  680. layer.load(1, {
  681. shade: [0.1,'#fff'] //0.1透明度的白色背景
  682. });
  683. },
  684. success:function(data) {
  685. var index = layer.load();
  686. layer.close(index);
  687. if (data.status == 1) {
  688. $('#sendJson').attr('value', JSON.stringify(data));
  689. var con = '';
  690. var task_count = 0;
  691. var totalCount = 0;
  692. $.each(data.data, function(index, item) {
  693. var one_count = item.enable_download_count - item.download_count;
  694. totalCount += (one_count>0?one_count:0);
  695. if((item.enable_download_count - item.download_count)>0) {
  696. task_count += 1;
  697. }
  698. con += '<tr><td>' + (index + 1) + '</td><td>' + item.taskName + '</td><td>' + item.clazzName + '</td><td>' + item.complete_time + '</td><td>'
  699. + item.generate_count + '/' + item.dredge_count + '/' + '<i style="color: green">' + item.enable_download_count + '</i><input type="hidden" name="drege_count" value="'+ item.enable_download_count +'"></td><td>'
  700. + item.download_count + '</td><td>' + (one_count>0?one_count:0) + '</td><td>' + (one_count>0?'可发送':'不可发送')
  701. + '</td></tr>'
  702. });
  703. $('#task_count').html(task_count);
  704. $('#total_print_num').html(totalCount);
  705. $('#taskList').html(con);
  706. $('#filter-uploaded').attr({'cid':cid, 'eid':eid, 'typeId':type, 'printType':"<?php echo $printType;?>"});
  707. $('#filter-uploaded').prop("checked", true);
  708. $('.confirmbox-mask').show();
  709. } else if (data.status == 0) {
  710. layer.msg(data.message);
  711. }
  712. }
  713. }
  714. );
  715. });
  716. // 全选\反选
  717. $(".selectAll").click(function(){
  718. if ($(this).prop("checked")) {
  719. var s_obj = $(".myselect");
  720. var s_len = s_obj.length;
  721. for (var i=0;i<s_len;i++) {
  722. if (!s_obj[i].disabled) {
  723. s_obj[i].checked=true;
  724. }
  725. }
  726. } else {
  727. $(".myselect").prop("checked",false);
  728. }
  729. });
  730. //过滤已下载学生
  731. $('#filter-uploaded').click(function () {
  732. if($(this).is(':checked')){
  733. var totalCount = 0;
  734. var task_count = 0;
  735. $('#taskList tr').each(function () {
  736. var enable_count = parseInt($(this).children("td:eq(4)").children('i').html());
  737. var dowanload_count = parseInt($(this).children("td:eq(5)").html());
  738. $(this).children("td:eq(6)").html((enable_count-dowanload_count)>0?(enable_count-dowanload_count):0);
  739. totalCount += ((enable_count-dowanload_count)>0?(enable_count-dowanload_count):0);
  740. if((enable_count-dowanload_count)==0){
  741. $(this).children("td:eq(7)").html('不可发送');
  742. }else{
  743. $(this).children("td:eq(7)").html('可发送');
  744. task_count += 1;
  745. }
  746. });
  747. $('#task_count').html(task_count);
  748. $('#total_print_num').html(totalCount)
  749. }else {
  750. var totalCount = 0;
  751. var task_count = 0;
  752. $('#taskList tr').each(function () {
  753. var enable_count = $(this).children("td:eq(4)").children('i').html();
  754. $(this).children("td:eq(6)").html(enable_count);
  755. totalCount += parseInt(enable_count);
  756. if(enable_count==0){
  757. $(this).children("td:eq(7)").html('不可发送');
  758. }else{
  759. $(this).children("td:eq(7)").html('可发送');
  760. task_count += 1;
  761. }
  762. });
  763. $('#task_count').html(task_count);
  764. $('#total_print_num').html(totalCount);
  765. $('#filter-uploaded').attr('isFilter',0)
  766. }
  767. });
  768. //发送云印任务(真正发送)
  769. $('#sendCloudPrint').click(function (){
  770. var task_count = parseInt($('#task_count').html());
  771. if(task_count === 0){
  772. layer.msg('没有可发送的任务');
  773. return false;
  774. }
  775. var json_data = $('#sendJson').val();
  776. var is_filter = $('#filter-uploaded').is(':checked') ? 1 : 0;
  777. $.post({
  778. url: "<?php echo $this->createUrl("printCloud/sendExamProductTask");?>",
  779. data: {
  780. 'json_data' : json_data,
  781. 'is_filter' : is_filter,
  782. 'printType':"<?php echo $printType;?>"
  783. },
  784. dataType: "json",
  785. beforeSend:function(){
  786. layer.load(1, {
  787. shade: [0.1,'#fff'] //0.1透明度的白色背景
  788. });
  789. },
  790. success:function(data) {
  791. var index = layer.load();
  792. layer.close(index);
  793. if (data.status == 1) {
  794. layer.msg('操作成功,请耐心等待后台打包');
  795. $('.confirmbox-mask').hide();
  796. location.reload();
  797. } else if (data.status == 0) {
  798. layer.msg(data.message);
  799. }
  800. }
  801. });
  802. })
  803. //批量下载
  804. $("#batchPrint").click(function(){
  805. var message = "您确定要批量下载该产品吗?";
  806. // 判断是否有选中
  807. if (!$("input[class='ace myselect']").is(':checked')) {
  808. layer.msg('至少选择一个目标!');
  809. return false;
  810. }
  811. var result = [];
  812. $(".myselect").each(function(m,n){
  813. if ($(this).prop('checked')) {
  814. if ($(this).val() /*&& $(this).attr("stnm")*/) {
  815. result.push($(this).val());
  816. }
  817. }
  818. })
  819. var sp = [];
  820. var cid = 0;
  821. var eid = 0;
  822. var type = 0;
  823. var saveDataAry=[];
  824. var data1 = [];
  825. for(i=0;i<result.length;i++)
  826. {
  827. sp = result[i].split('_');
  828. cid = sp[0];
  829. eid = sp[1];
  830. type = sp[2];
  831. if(!cid || !eid || !type) continue;
  832. var absent_filter = $("input[name='absent-filter']").is(':checked') ? 1 : 0;
  833. data1 = {"examId": eid, "classId": cid, "type": type,"absent_filter":absent_filter,"printType":"<?php echo $printType;?>"};
  834. saveDataAry.push(data1);
  835. }
  836. layer.msg(message, {
  837. time: 0,
  838. btn: ['确定', '取消'],
  839. yes: function(index){
  840. layer.close(index);
  841. $.ajax({
  842. type: "POST",
  843. url: "<?php echo $this->createUrl('productdownexam/batch');?>",
  844. dataType: "json",
  845. contentType: "application/json",
  846. data: JSON.stringify(saveDataAry),
  847. success: function (data){
  848. layer.closeAll();
  849. if(data.success == 1) {
  850. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!', {
  851. icon: 1,
  852. yes: function () {
  853. layer.closeAll();
  854. }
  855. });
  856. }else {
  857. layer.msg(data.message);
  858. }
  859. },
  860. });
  861. }
  862. });
  863. });
  864. function downpdf(examId, classId, type, isWb) {
  865. layer.msg('生成中,请稍后...', { time: 0, shade: 0.4 })
  866. var _url = "<?php echo $this->createUrl("junior/teach")?>";
  867. $.get(_url, {examId: examId, classId: classId, type:type, isWb:isWb}, function(data) {
  868. //$.get("<?php //echo $this->createUrl('export/academicr') ?>//", {examId: examId, classId: classId}, function(data) {
  869. var m = JSON.parse(data);
  870. if (m.status == 0)
  871. {
  872. if (m.is_create == 1) {
  873. setTimeout(function() {
  874. layer.closeAll()
  875. }, 500);
  876. } else {
  877. layer.closeAll()
  878. }
  879. location.href="<?php echo $this->createUrl("export/down_load")?>?examId="+examId;
  880. } else
  881. {
  882. setTimeout(function() {
  883. layer.closeAll()
  884. }, 500);
  885. layer.msg(m.error)
  886. // alert(m.error);
  887. }
  888. });
  889. }
  890. </script>