index.php 40 KB

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