index.php 42 KB

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