product.php 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979
  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("productexam/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="batchPrintToolsFfb" href="javascript:void(0);" class="btn label-primary-green btn-sm">批量打印</a>
  334. <a id="batchPrint" href="javascript:void(0);" class="btn label-primary-green btn-sm">批量下载</a>
  335. <a href="javascript:void(0);" class="btn label-primary-green btn-sm" id="selectPrint">
  336. <i style="font-style: normal;" class="fa fa-print"></i> 发送云印任务
  337. </a>
  338. </div>
  339. </div>
  340. </div>
  341. </form>
  342. </div>
  343. <table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable" style="font-size:12px">
  344. <thead>
  345. <tr>
  346. <th class="center">
  347. <input type="checkbox" class="ace selectAll" />
  348. </th>
  349. <th>名称</th>
  350. <th>班级</th>
  351. <th>完成日期</th>
  352. <th >已生成/总数</th>
  353. <th>是否下载/打印</th>
  354. <th >操作</th>
  355. </tr>
  356. </thead>
  357. <tbody>
  358. <?php if(!empty($printList)):?>
  359. <?php foreach($printList as $cl):?>
  360. <tr>
  361. <td>
  362. <?php if(!$cl['is_cloud_print']){?>
  363. <input type="checkbox" class="ace myselect" value="<?php echo $cl['class_id'].'_'.$cl['exam_id'].'_'.$type.'_0'; ?>">
  364. <?php }?>
  365. </td>
  366. <td style="max-width:260px">
  367. <?php if($cl['isDown']==0) { echo "<span style='color: #ff0000;font-weight: bold;'>【New】</span>";};
  368. 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>"
  369. ?>
  370. </td>
  371. <td style="max-width:100px"><?php echo $cl['class_name'];?></td>
  372. <td><?php if(!empty($cl['complete_time'])){ echo date('Y-m-d H:i',$cl['complete_time']);}?></td>
  373. <td><span style="color: green;"><?php echo $cl['pdfCount'];?></span>/<span><?php echo $cl['totalCount'];?></span></td>
  374. <td><?php echo $cl["isDown"] ? '已下载/打印' : '未下载/打印';?></td>
  375. <td style="width:265px;">
  376. <span class="iconfont click-sc addbx printToolsFfb" aria-hidden="true" printType="" type="<?php echo $type;?>" eid="<?php echo $cl['exam_id'];?>" cid="<?php echo $cl['class_id'];?>" title="打印<?php echo $desc;?>" >&#xe6bb;</span>
  377. <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;?>)"><img src="/images/download.png" style="margin-bottom:-4px;"></span>
  378. <span class="iconfont click-sc addbx" aria-hidden="true" title="选择学生下载<?php echo $desc;?>" onclick="javascript:location.href='<?php echo $this->createUrl('productexam/product_stu',array('type'=>$type,'cid'=>$cl['class_id'],'eid'=>$cl['exam_id']));?>'">&#xe668;</span>
  379. <!-- 发送云印任务 -->
  380. <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>
  381. </td>
  382. </tr>
  383. <?php endforeach;?>
  384. <?php endif;?>
  385. </tbody>
  386. </table>
  387. <?php if(!empty($page_total)):?>
  388. <div class="row">
  389. <div class="col-xs-6">
  390. &nbsp;
  391. </div>
  392. <div class="col-xs-6">
  393. <div class="dataTables_paginate paging_simple_numbers">
  394. <?php
  395. $this->widget('CLinkPager', array(
  396. 'header' => '',
  397. 'firstPageLabel'=> '首页',
  398. 'lastPageLabel' => '末页',
  399. 'prevPageLabel' => '上一页',
  400. 'nextPageLabel' => '下一页',
  401. 'pages' => $pages,
  402. 'maxButtonCount'=> 5,
  403. ));
  404. echo '共:'.$page_total.'条';
  405. ?>
  406. </div>
  407. </div>
  408. </div>
  409. <?php endif;?>
  410. </div>
  411. <!--发送云印任务弹窗-->
  412. <div class="confirmbox-mask" id="classModal-1" style="display: none;">
  413. <div class="class-modal-1">
  414. <i class="icon icon-close-1" style="color: white">X</i><div class="class-modal-head-1">发送云印任务</div>
  415. <div class="class-modal-body-1">
  416. <div>
  417. <span>亲爱的学管:您正在发起云印任务,请核对以下云印任务数据!</span>
  418. <span style="float: right;">共<i id="task_count">0</i>条任务,<i id="total_print_num">0</i>份云印任务</span>
  419. </div>
  420. <table style="margin-top: 15px;" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable">
  421. <thead>
  422. <tr>
  423. <th>序号</th>
  424. <th>任务名称</th>
  425. <th>班级</th>
  426. <th>完成日期</th>
  427. <th>已生成/已开通/可下载</th>
  428. <th>已下载</th>
  429. <th>云印份数</th>
  430. <th>备注</th>
  431. </tr>
  432. </thead>
  433. <tbody id="taskList">
  434. </tbody>
  435. </table>
  436. <div style="margin-top: 40px;">
  437. <span><img width="20px" height="20px" src="/images/icon-tip.svg">发送后,请至学管端【IMS-云印任务】模块查看任务进程,请等待云印中心打印后,寄回给学校!</span>
  438. <span style="margin-left:15px;float: right;"><input id="filter-uploaded" checked="checked" type="checkbox">过滤【已下载】的学生</span>
  439. </div>
  440. <div class="btn_area" style="text-align: center;">
  441. <input type="hidden" id="sendJson" name="sendJson" value="">
  442. <button id="sendCloudPrint" class="download">发送</button>
  443. <button class="cancel">取消</button>
  444. </div>
  445. </div>
  446. </div>
  447. </div>
  448. <!-- PAGE CONTENT ENDS -->
  449. </div>
  450. </div>
  451. </div>
  452. </div>
  453. <?php include(Yii::app()->basePath.'/views/print/_print.php');?>
  454. <script src="/js/jquery.ajaxfileupload.js"></script>
  455. <script type="text/javascript">
  456. $(document).ready(function(){
  457. $(".sel-opt,.sel-cons").mouseover(function(){
  458. $(".sel-cons").show();
  459. }).mouseout(function(){
  460. $(".sel-cons").hide();
  461. });
  462. $(".sc-lis").click(function(){
  463. var data = {
  464. subjectId : $(this).attr('val')
  465. };
  466. $.post("<?php echo Yii::app()->createUrl('print/setSubjectId')?>",data,function(flags){
  467. if(flags)
  468. {
  469. location.reload();
  470. }else
  471. {
  472. alert('网络异常');
  473. }
  474. });
  475. $('.has-sel').text($(this).text());
  476. $(".sel-cons").hide();
  477. });
  478. });
  479. // 打印错题本
  480. function printBook(cid,eid,type){
  481. if (!cid || !eid || !type) {
  482. layer.msg("打印参数有误");return;
  483. }
  484. var message = "您确定要下载该班级<?php echo $desc;?>吗?";
  485. var divTitle = "下载<?php echo $desc;?>";
  486. var improveName = "<?php echo $desc;?>";
  487. html = ""+
  488. '<div style="padding:20px 30px 0px 30px">'+
  489. '<div style="padding:8px 0;">请复制下方链接下载'+improveName+'。</div>'+
  490. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>'+
  491. '<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>'+
  492. '</div>'+
  493. '</div>'+
  494. "";
  495. layer.msg(message, {
  496. time: 0,
  497. btn: ['确定', '取消'],
  498. yes: function(index){
  499. layer.close(index);
  500. $.ajax({
  501. url: "<?php echo $this->createUrl('productdownexam/getUrl');?>",
  502. type: "GET",
  503. dataType: "json",
  504. data: {"examId": eid, "classId": cid, "type": type,"printType":"<?php echo $printType;?>"},
  505. timeout: <?php echo Yii::app()->params["product_download_time_limit"];?>,
  506. beforeSend:function(){
  507. layer.msg("下载中请稍后...",{"time": <?php echo Yii::app()->params["product_download_time_limit"];?>});
  508. },
  509. error: function (jqXHR, textStatus, errorThrown) {
  510. if(textStatus=="timeout"){
  511. $.ajax({
  512. type:'GET',
  513. url: "<?php echo $this->createUrl("productdownexam/addTask");?>",
  514. data: {"examId": eid, "classId": cid, "type": type,"printType":"<?php echo $printType;?>"},
  515. dataType: "json",
  516. success:function (data) {
  517. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!',{
  518. icon: 1,
  519. yes:function(){
  520. layer.closeAll();
  521. }
  522. });
  523. }
  524. })
  525. }else {
  526. layer.msg('返回失败!',{
  527. icon: 5
  528. }, function(){
  529. layer.closeAll();
  530. });
  531. }
  532. },
  533. success: function (data){
  534. layer.closeAll();
  535. if(data.success == 1||data.success == 2){
  536. layer.open({
  537. type: 1,
  538. area: ['550px', '220px'],
  539. title: divTitle,
  540. content: html,
  541. success: function(index, layerObj){
  542. // 更试卷打印时间
  543. //$.post("<?php //echo $this->createUrl('print/updatepaperprinttime');?>//", {cid: cid, eid: eid,type:type } );
  544. 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>');
  545. jQuery("#confirm, #cancel").on("click", function(){
  546. layer.close(layerObj);
  547. });
  548. jQuery("#copy").on("click", function(){
  549. jQuery("#url").select();
  550. });
  551. },
  552. end: function(){
  553. }
  554. });
  555. }else if(data.success == 3){
  556. // 更试卷打印时间
  557. //$.post("<?php //echo $this->createUrl('print/updatepaperprinttime');?>//", {cid: cid, eid: eid,type:type } );
  558. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!',{
  559. icon: 1,
  560. yes:function(){
  561. layer.closeAll();
  562. }
  563. });
  564. }
  565. else if(data.success == 0){
  566. layer.msg(data.message, {"time": 3000});
  567. }
  568. },
  569. });
  570. }
  571. });
  572. }
  573. // 搜索事件
  574. $("#search").click(function(){
  575. $("#form1").submit();
  576. });
  577. $('.confirmbox-mask .icon-close-1').click(function () {
  578. $('.confirmbox-mask').hide();
  579. })
  580. $('.confirmbox-mask .cancel').click(function () {
  581. $('.confirmbox-mask').hide();
  582. })
  583. //发送云印任务
  584. function sendCloudTask(cid,eid,type,isDisable){
  585. if(isDisable === 1){
  586. return false;
  587. }
  588. //$('.confirmbox-mask').show();return false;
  589. if (!cid || !eid || !type) {
  590. layer.msg("参数有误");return;
  591. }
  592. // 更试卷打印时间
  593. var saveDataAry=[];
  594. var data1={"examId": eid, "classId": cid, "type": type,"printType":"<?php echo $printType;?>"};
  595. saveDataAry.push(data1);
  596. $.ajax({
  597. type: "POST",
  598. url: "<?php echo $this->createUrl("printCloud/generateExamProduct");?>",
  599. dataType: "json",
  600. contentType: "application/json",
  601. data: JSON.stringify(saveDataAry),
  602. beforeSend:function(){
  603. layer.load(1, {
  604. shade: [0.1,'#fff'] //0.1透明度的白色背景
  605. });
  606. },
  607. success:function(data) {
  608. var index = layer.load();
  609. layer.close(index);
  610. if (data.status == 1) {
  611. $('#sendJson').attr('value', JSON.stringify(data));
  612. var con = '';
  613. var task_count = 0;
  614. var totalCount = 0;
  615. $.each(data.data, function(index, item) {
  616. var one_count = item.enable_download_count - item.download_count;
  617. totalCount += (one_count>0?one_count:0);
  618. if((item.enable_download_count - item.download_count)>0) {
  619. task_count += 1;
  620. }
  621. con += '<tr><td>' + (index + 1) + '</td><td>' + item.taskName + '</td><td>' + item.clazzName + '</td><td>' + item.complete_time + '</td><td>'
  622. + 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>'
  623. + item.download_count + '</td><td>' + (one_count>0?one_count:0) + '</td><td>' + (one_count>0?'可发送':'不可发送')
  624. + '</td></tr>'
  625. });
  626. $('#task_count').html(task_count);
  627. $('#total_print_num').html(totalCount);
  628. $('#taskList').html(con);
  629. $('#filter-uploaded').attr({'cid':cid, 'eid':eid, 'typeId':type, 'printType':"<?php echo $printType;?>"});
  630. $('#filter-uploaded').prop("checked", true)
  631. $('.confirmbox-mask').show();
  632. } else if (data.status == 0) {
  633. layer.msg(data.message);
  634. }
  635. }
  636. }
  637. );
  638. }
  639. //批量发送云印任务
  640. $("#selectPrint").click(function() {
  641. // 判断是否有选中
  642. if (!$("input[class='ace myselect']").is(':checked')) {
  643. layer.msg('至少选择一个目标!');
  644. return false;
  645. }
  646. var result = [];
  647. $(".myselect").each(function(m,n){
  648. if ($(this).prop('checked')) {
  649. if ($(this).val() /*&& $(this).attr("stnm")*/) {
  650. result.push($(this).val());
  651. }
  652. }
  653. })
  654. var sp = [];
  655. var cid = 0;
  656. var eid = 0;
  657. var type = 0;
  658. var isDisable = 0;
  659. var saveDataAry=[];
  660. var data1 = [];
  661. for(i=0;i<result.length;i++)
  662. {
  663. sp = result[i].split('_');
  664. cid = sp[0];
  665. eid = sp[1];
  666. type = sp[2];
  667. isDisable = sp[3];
  668. if(isDisable == 1 || !cid || !eid || !type) continue;
  669. // 更试卷打印时间
  670. //$.post("<?php //echo $this->createUrl('print/updatepaperprinttime');?>//", {cid: cid, eid: eid,type:type } );
  671. //alert(cid);alert(eid);alert(type);alert(printType);
  672. data1 = {"examId": eid, "classId": cid, "type": type,"printType":"<?php echo $printType;?>"};
  673. saveDataAry.push(data1);
  674. }
  675. $.ajax({
  676. type: "POST",
  677. url: "<?php echo $this->createUrl("printCloud/generateExamProduct");?>",
  678. dataType: "json",
  679. contentType: "application/json",
  680. data: JSON.stringify(saveDataAry),
  681. beforeSend:function(){
  682. layer.load(1, {
  683. shade: [0.1,'#fff'] //0.1透明度的白色背景
  684. });
  685. },
  686. success:function(data) {
  687. var index = layer.load();
  688. layer.close(index);
  689. if (data.status == 1) {
  690. $('#sendJson').attr('value', JSON.stringify(data));
  691. var con = '';
  692. var task_count = 0;
  693. var totalCount = 0;
  694. $.each(data.data, function(index, item) {
  695. var one_count = item.enable_download_count - item.download_count;
  696. totalCount += (one_count>0?one_count:0);
  697. if((item.enable_download_count - item.download_count)>0) {
  698. task_count += 1;
  699. }
  700. con += '<tr><td>' + (index + 1) + '</td><td>' + item.taskName + '</td><td>' + item.clazzName + '</td><td>' + item.complete_time + '</td><td>'
  701. + 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>'
  702. + item.download_count + '</td><td>' + (one_count>0?one_count:0) + '</td><td>' + (one_count>0?'可发送':'不可发送')
  703. + '</td></tr>'
  704. });
  705. $('#task_count').html(task_count);
  706. $('#total_print_num').html(totalCount);
  707. $('#taskList').html(con);
  708. $('#filter-uploaded').attr({'cid':cid, 'eid':eid, 'typeId':type, 'printType':"<?php echo $printType;?>"});
  709. $('#filter-uploaded').prop("checked", true);
  710. $('.confirmbox-mask').show();
  711. } else if (data.status == 0) {
  712. layer.msg(data.message);
  713. }
  714. }
  715. }
  716. );
  717. });
  718. // 全选\反选
  719. $(".selectAll").click(function(){
  720. if ($(this).prop("checked")) {
  721. var s_obj = $(".myselect");
  722. var s_len = s_obj.length;
  723. for (var i=0;i<s_len;i++) {
  724. if (!s_obj[i].disabled) {
  725. s_obj[i].checked=true;
  726. }
  727. }
  728. } else {
  729. $(".myselect").prop("checked",false);
  730. }
  731. });
  732. //过滤已下载学生
  733. $('#filter-uploaded').click(function () {
  734. if($(this).is(':checked')){
  735. var totalCount = 0;
  736. var task_count = 0;
  737. $('#taskList tr').each(function () {
  738. var enable_count = parseInt($(this).children("td:eq(4)").children('i').html());
  739. var dowanload_count = parseInt($(this).children("td:eq(5)").html());
  740. $(this).children("td:eq(6)").html((enable_count-dowanload_count)>0?(enable_count-dowanload_count):0);
  741. totalCount += ((enable_count-dowanload_count)>0?(enable_count-dowanload_count):0);
  742. if((enable_count-dowanload_count)==0){
  743. $(this).children("td:eq(7)").html('不可发送');
  744. }else{
  745. $(this).children("td:eq(7)").html('可发送');
  746. task_count += 1;
  747. }
  748. });
  749. $('#task_count').html(task_count);
  750. $('#total_print_num').html(totalCount)
  751. }else {
  752. var totalCount = 0;
  753. var task_count = 0;
  754. $('#taskList tr').each(function () {
  755. var enable_count = $(this).children("td:eq(4)").children('i').html();
  756. $(this).children("td:eq(6)").html(enable_count);
  757. totalCount += parseInt(enable_count);
  758. if(enable_count==0){
  759. $(this).children("td:eq(7)").html('不可发送');
  760. }else{
  761. $(this).children("td:eq(7)").html('可发送');
  762. task_count += 1;
  763. }
  764. });
  765. $('#task_count').html(task_count);
  766. $('#total_print_num').html(totalCount);
  767. $('#filter-uploaded').attr('isFilter',0)
  768. }
  769. });
  770. //发送云印任务(真正发送)
  771. $('#sendCloudPrint').click(function (){
  772. var task_count = parseInt($('#task_count').html());
  773. if(task_count === 0){
  774. layer.msg('没有可发送的任务');
  775. return false;
  776. }
  777. var json_data = $('#sendJson').val();
  778. var is_filter = $('#filter-uploaded').is(':checked') ? 1 : 0;
  779. $.post({
  780. url: "<?php echo $this->createUrl("printCloud/sendExamProductTask");?>",
  781. data: {
  782. 'json_data' : json_data,
  783. 'is_filter' : is_filter,
  784. 'printType':"<?php echo $printType;?>"
  785. },
  786. dataType: "json",
  787. beforeSend:function(){
  788. layer.load(1, {
  789. shade: [0.1,'#fff'] //0.1透明度的白色背景
  790. });
  791. },
  792. success:function(data) {
  793. var index = layer.load();
  794. layer.close(index);
  795. if (data.status == 1) {
  796. layer.msg('操作成功,请耐心等待后台打包');
  797. $('.confirmbox-mask').hide();
  798. location.reload();
  799. } else if (data.status == 0) {
  800. layer.msg(data.message);
  801. }
  802. }
  803. });
  804. })
  805. //批量下载
  806. $("#batchPrint").click(function(){
  807. var message = "您确定要批量下载该产品吗?";
  808. // 判断是否有选中
  809. if (!$("input[class='ace myselect']").is(':checked')) {
  810. layer.msg('至少选择一个目标!');
  811. return false;
  812. }
  813. var result = [];
  814. $(".myselect").each(function(m,n){
  815. if ($(this).prop('checked')) {
  816. if ($(this).val() /*&& $(this).attr("stnm")*/) {
  817. result.push($(this).val());
  818. }
  819. }
  820. })
  821. var sp = [];
  822. var cid = 0;
  823. var eid = 0;
  824. var type = 0;
  825. var saveDataAry=[];
  826. var data1 = [];
  827. for(i=0;i<result.length;i++)
  828. {
  829. sp = result[i].split('_');
  830. cid = sp[0];
  831. eid = sp[1];
  832. type = sp[2];
  833. if(!cid || !eid || !type) continue;
  834. var absent_filter = $("input[name='absent-filter']").is(':checked') ? 1 : 0;
  835. data1 = {"examId": eid, "classId": cid, "type": type,"absent_filter":absent_filter,"printType":"<?php echo $printType;?>"};
  836. saveDataAry.push(data1);
  837. }
  838. layer.msg(message, {
  839. time: 0,
  840. btn: ['确定', '取消'],
  841. yes: function(index){
  842. layer.close(index);
  843. $.ajax({
  844. type: "POST",
  845. url: "<?php echo $this->createUrl('productdownexam/batch');?>",
  846. dataType: "json",
  847. contentType: "application/json",
  848. data: JSON.stringify(saveDataAry),
  849. success: function (data){
  850. layer.closeAll();
  851. if(data.success == 1) {
  852. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!', {
  853. icon: 1,
  854. yes: function () {
  855. layer.closeAll();
  856. }
  857. });
  858. }else {
  859. layer.msg(data.message);
  860. }
  861. },
  862. });
  863. }
  864. });
  865. });
  866. function downpdf(examId, classId, type) {
  867. layer.msg('生成中,请稍后...', { time: 0, shade: 0.4 })
  868. var _url = "<?php echo $this->createUrl("productexam/method_pdf")?>";
  869. $.get(_url, {examId: examId, classId: classId, type:type}, function(data) {
  870. //$.get("<?php //echo $this->createUrl('export/academicr') ?>//", {examId: examId, classId: classId}, function(data) {
  871. var m = JSON.parse(data);
  872. if (m.status == 0)
  873. {
  874. if (m.is_create == 1) {
  875. setTimeout(function() {
  876. layer.closeAll()
  877. }, 500);
  878. } else {
  879. layer.closeAll()
  880. }
  881. location.href="<?php echo $this->createUrl("export/down_load")?>?examId="+examId;
  882. } else
  883. {
  884. setTimeout(function() {
  885. layer.closeAll()
  886. }, 500);
  887. layer.msg(m.error)
  888. // alert(m.error);
  889. }
  890. });
  891. }
  892. </script>