mrv.php 32 KB

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