english_reading.php 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927
  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. .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: #009965;
  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 {
  144. color: #000;
  145. }
  146. .class-modal-1 .btn_area {
  147. padding: 10px;
  148. border-top: 1px solid #aab6aa;
  149. margin-top: 10px;
  150. }
  151. .class-modal-1 .btn_area p {
  152. display: inline-block;
  153. }
  154. .class-modal-1 .btn_area button {
  155. margin-left: 5px;
  156. }
  157. .class-modal-1 .btn_area .cancel {
  158. background: #fff;
  159. color: #000;
  160. border: 1px solid #666;
  161. }
  162. .c-red-1 {
  163. color: #CC3300;
  164. font-size: 10px;
  165. display: inline-block;
  166. position: absolute;
  167. left: 15px;
  168. top: 18px;
  169. }
  170. .vtm {
  171. vertical-align: middle;
  172. }
  173. .pointer {
  174. cursor: pointer;
  175. }
  176. .dib {
  177. display: inline-block;
  178. }
  179. .pdp-con .pop-opt-con {
  180. border-top: 1px solid #ddd;
  181. padding-top: 20px;
  182. }
  183. .tit-sub-intro {
  184. color: #666;
  185. }
  186. .tit-sub-intro span {
  187. font-size: 12px;
  188. }
  189. .subsection {
  190. width: 44px;
  191. height: 24px;
  192. border: 1px solid #ddd;
  193. text-align: center;
  194. font-size: 12px;
  195. }
  196. .reduce-btn, .add-btn {
  197. width: 16px;
  198. height: 16px;
  199. line-height: 16px;
  200. text-align: center;
  201. color: #16AE68;
  202. border: 1px solid #16AE68;
  203. border-radius: 3px;
  204. font-size: 16px;
  205. font-weight: bold;
  206. margin-right: 6px;
  207. }
  208. .reduce-btn.forbidden, .add-btn.forbidden {
  209. color: #bbb;
  210. border: 1px solid #bbb;
  211. cursor: no-drop;
  212. }
  213. </style>
  214. <script type="text/javascript">
  215. function in_array(search, array) {
  216. for (var i in array) {
  217. if (array[i] == search) {
  218. return true;
  219. }
  220. }
  221. return false;
  222. }
  223. testFlag = "<?php echo $this->testFlag;?>";
  224. customTplsIds = new Array();
  225. var i = 0;
  226. <?php foreach(Yii::app()->params["custom_tpls_ids"] as $tplId){?>
  227. customTplsIds[i] = "<?php echo $tplId;?>";
  228. i++;
  229. <?php }?>
  230. jQuery(document).ready(function () {
  231. // 根据年级筛选班级
  232. jQuery("#grade").change(function () {
  233. var grade = $(this).val();
  234. if (!grade) return false;
  235. jQuery.post(
  236. '<?php echo $this->createUrl("print/getGradeClass");?>', {"grade": grade}, function (data) {
  237. data = JSON.parse(data);
  238. if (data.success == 1) {
  239. var classObj = $("#class");
  240. var html = "<option value=''>全部班级</option>";
  241. classObj.empty();
  242. $.each(data.message, function (i, n) {
  243. html += "<option value='" + n.class_id + "'>" + n.class_name + "</option>";
  244. });
  245. classObj.append(html);
  246. }
  247. }
  248. );
  249. });
  250. });
  251. </script>
  252. <link rel="stylesheet" href="/fonts/fpdf/iconfont.css"/>
  253. <div class="main-content-inner">
  254. <!-- 导航栏开始-->
  255. <?php include(Yii::app()->basePath . '/views/layouts/view_production_navigation.php'); ?>
  256. <!-- 导航栏结束-->
  257. <div class="page-content">
  258. <div class="row" style="margin:0px;">
  259. <div class="col-xs-12">
  260. <!-- PAGE CONTENT BEGINS -->
  261. <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
  262. <div class="row">
  263. <form method="get" id="form1" action="<?php echo $this->createUrl("print/english_reading",array('pt'=>$eProductType,'cg'=>$category)); ?>">
  264. <div class="col-xs-12">
  265. <div class="dataTables_length margin-zy clearfix">
  266. <select class="form-control" id="grade" name="grade">
  267. <option value="">年级</option>
  268. <option value="1" <?php if ($grade == 1) echo "selected"; ?>>高一</option>
  269. <option value="2" <?php if ($grade == 2) echo "selected"; ?>>高二</option>
  270. <option value="3" <?php if ($grade == 3) echo "selected"; ?>>高三</option>
  271. </select>
  272. <select class="form-control" id="class" name="classId">
  273. <option value="">全部班级</option>
  274. <?php foreach ($classes as $class) { ?>
  275. <option <?php if ((string)$classId === (string)$class["class_id"]) echo "selected=selected"; ?>
  276. value="<?php echo $class["class_id"]; ?>"><?php echo $class["class_name"]; ?></option>
  277. <?php } ?>
  278. </select>
  279. <input type="text" class="form-control input-sm" placeholder="请输入打印任务名称" name="name"
  280. value="<?php echo $printName; ?>">
  281. <button class="label-primary-s bth-s" id="search" style="padding:4px 12px;">搜索
  282. </button>
  283. <?php
  284. $link=Yii::app()->params['product_setting_url'] . "index.html#/WaiKanSet/WaiKanGenerate";
  285. $linkName='外刊宝';
  286. if(isset($category) && $category==2){
  287. $link=Yii::app()->params['product_setting_url'] . "index.html#/WaiKanSet/WaiKanSeparate?product_type={$eProductType}";
  288. if($eProductType==1){
  289. $linkName='基础宝';
  290. }elseif($eProductType==2){
  291. $linkName='外刊宝';
  292. }else{
  293. $linkName='热点宝';
  294. }
  295. }
  296. ?>
  297. <span style="font-size:13px;padding-left:2px;color:red;">提示:生成的<?php echo $linkName?>仅保留7天</span>
  298. <span class="fr ">
  299. <a href="<?php echo$link ?>"
  300. class="btn-garder">生成<?php echo $linkName?></a>
  301. <a id="selectPrint" href="javascript:void(0);" class="btn-garder">发送云印任务</a>
  302. <a id="batchPrint" href="javascript:void(0);" class="btn-garder">批量下载</a>
  303. <a id="batchPrintToolsWkb" href="javascript:void(0);" class="btn-garder">批量打印</a>
  304. </span>
  305. </div>
  306. </div>
  307. </form>
  308. </div>
  309. <table id="dynamic-table"
  310. class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable"
  311. style="font-size:12px">
  312. <thead>
  313. <tr>
  314. <th class="center">
  315. <input type="checkbox" class="ace selectAll"/>
  316. </th>
  317. <th>名称</th>
  318. <th>外刊类型</th>
  319. <th>班级</th>
  320. <th>已生成/总数</th>
  321. <th>是否下载/打印</th>
  322. <th>下载/打印时间</th>
  323. <th>操作</th>
  324. </tr>
  325. </thead>
  326. <tbody>
  327. <?php if (!empty($printList)):foreach ($printList as $cl): ?>
  328. <tr>
  329. <td>
  330. <?php if (Yii::app()->cache->getValue("cloud_print_task_english_reading" . $cl['week_id']) != 1) { ?>
  331. <input type="checkbox" class="ace myselect"
  332. value="<?php echo $cl['week_id']; ?>">
  333. <?php } ?>
  334. </td>
  335. <td style="max-width:260px" readingId="<?php echo $cl['reading_id'] ?>">
  336. <a href="<?php echo $this->createUrl('print/resetEnglishReading', array("readingId" => $cl['reading_id'])); ?>"><?php echo $cl['name']; ?></a>
  337. </td>
  338. <td>
  339. <?php echo isset($cl['recommend_mode_name']) ? $cl['recommend_mode_name'] : ""; ?>
  340. <br/>
  341. <?php echo isset($cl['product_type_name']) ? $cl['product_type_name'] : ""; ?>
  342. <?php echo isset($cl['type_name']) ? $cl['type_name'] : ""; ?>
  343. </td>
  344. <td style="max-width:100px"><?php echo $cl['class_name']; ?></td>
  345. <td><?php echo $cl['pdfCount'] . '/' . $cl['totalCount']; ?></td>
  346. <td><?php if ($cl['isDown']) {
  347. echo '已下载/打印';
  348. } else {
  349. echo '未下载/打印';
  350. } ?></td>
  351. <td><?php echo $cl['downTime']; ?></td>
  352. <td style="width:265px;">
  353. <span class="iconfont click-sc addbx printToolsWkb" aria-hidden="true" weekid="<?php echo (string)$cl['week_id']; ?>" title="打印<?php echo $linkName?>">&#xe6bb;</span>
  354. <span class="iconfont click-sc addbx" aria-hidden="true" title="下载<?php echo $linkName?>"
  355. onclick="printWeek('<?php echo (string)$cl['week_id']; ?>')"><img src="/images/download.png" style="margin-bottom:-2px;"></span>
  356. <span class="iconfont click-sc addbx" aria-hidden="true" title="选择学生下载<?php echo $linkName?>"
  357. onclick="javascript:location.href='<?php echo $this->createUrl('print/selectStuByEnglishReading', array('cg'=>$category,'pt'=>$eProductType,'weekId' => (string)$cl['week_id'])); ?>'">&#xe668;</span>
  358. <!-- 发送云印任务 -->
  359. <span class="iconfont click-sc addbx" <?php if (Yii::app()->cache->getValue("cloud_print_task_english_reading" . $cl['week_id']) == 1) echo 'style="background-color:gray"'; ?>
  360. aria-hidden="true"
  361. title="<?php if (Yii::app()->cache->getValue("cloud_print_task_english_reading" . $cl['week_id']) == 1) {
  362. echo '24小时内不可重复发送';
  363. } else {
  364. echo '发送云印任务';
  365. } ?>"
  366. onclick="sendCloudTask('<?php echo $cl['week_id']; ?>',<?php echo Yii::app()->cache->getValue("cloud_print_task_english_reading" . $cl['week_id']) == 1 ? 1 : 0; ?>)">云</span>
  367. <?php if (isset($cl['is_teacher']) && $cl['is_teacher']): ?>
  368. <span class="fa fa-file-pdf-o click-sc addbx" style="padding:0.5px 9px"
  369. aria-hidden="true" title="下载教师讲义"
  370. onclick="downPdfWKBTeacherPrint('<?php echo (string)$cl['week_id']; ?>')"></span>
  371. <?php endif; ?>
  372. </td>
  373. </tr>
  374. <?php endforeach; else: ?>
  375. <tr>
  376. <td colspan="8">暂无数据!</td>
  377. </tr>
  378. <?php endif; ?>
  379. </tbody>
  380. </table>
  381. <?php if (!empty($page_total)): ?>
  382. <div class="row">
  383. <div class="col-xs-6">
  384. &nbsp;
  385. </div>
  386. <div class="col-xs-6">
  387. <div class="dataTables_paginate paging_simple_numbers">
  388. <?php
  389. $this->widget('CLinkPager', array(
  390. 'header' => '',
  391. 'firstPageLabel' => '首页',
  392. 'lastPageLabel' => '末页',
  393. 'prevPageLabel' => '上一页',
  394. 'nextPageLabel' => '下一页',
  395. 'pages' => $pages,
  396. 'maxButtonCount' => 5,
  397. ));
  398. echo '共:' . $page_total . '条';
  399. ?>
  400. </div>
  401. </div>
  402. </div>
  403. <?php endif; ?>
  404. </div>
  405. <!--上传模板弹窗-->
  406. <!--发送云印任务弹窗-->
  407. <div class="confirmbox-mask" id="classModal-1" style="display: none;">
  408. <div class="class-modal-1">
  409. <i class="icon icon-close-1" style="color: white">X</i>
  410. <div class="class-modal-head-1">发送云印任务</div>
  411. <div class="class-modal-body-1">
  412. <div>
  413. <span>亲爱的学管:您正在发起云印任务,请核对以下云印任务数据!</span>
  414. <span style="float: right;">共<i id="task_count">0</i>条任务,<i id="total_print_num">0</i>份云印任务</span>
  415. </div>
  416. <table style="margin-top: 15px;"
  417. class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable">
  418. <thead>
  419. <tr>
  420. <th>序号</th>
  421. <th>任务名称</th>
  422. <th>班级</th>
  423. <th>已生成/已开通/可下载</th>
  424. <th>已下载</th>
  425. <th>云印份数</th>
  426. <th>备注</th>
  427. </tr>
  428. </thead>
  429. <tbody id="taskList">
  430. </tbody>
  431. </table>
  432. <div style="margin-top: 40px;">
  433. <span><img width="20px" height="20px" src="/images/icon-tip.svg">发送后,请至学管端【IMS-云印任务】模块查看任务进程,请等待云印中心打印后,寄回给学校!</span>
  434. <span style="margin-left:15px;float: right;"><input id="filter-uploaded"
  435. checked="checked" type="checkbox">过滤【已下载】的学生</span>
  436. </div>
  437. <div class="btn_area" style="text-align: center;">
  438. <input type="hidden" id="sendJson" name="sendJson" value="">
  439. <button id="sendCloudPrint" class="download">发送</button>
  440. <button class="cancel">取消</button>
  441. </div>
  442. </div>
  443. </div>
  444. </div>
  445. <!-- PAGE CONTENT ENDS -->
  446. </div>
  447. </div>
  448. </div>
  449. </div>
  450. <?php require_once "_print.php"?>
  451. <script src="/js/jquery.ajaxfileupload.js"></script>
  452. <script type="text/javascript">
  453. $(document).ready(function () {
  454. });
  455. function downpdf(weekId) {
  456. layer.msg('生成中,请稍后...', {time: 0, shade: 0.4})
  457. location.href = "<?php echo $this->createUrl("print/down_load")?>?weekId=" + weekId;
  458. layer.closeAll();
  459. }
  460. function objToJson(obj) {
  461. var json = "{ ";
  462. for (var item in obj) {
  463. json += "'" + item + "':'" + obj[item] + "',";
  464. }
  465. json += " }";
  466. return json;
  467. }
  468. function ccc() {
  469. layer.msg('敬请期待!', {
  470. time: 0,
  471. btn: ['确定', '取消'],
  472. yes: function (index) {
  473. layer.close(index);
  474. return false;
  475. }
  476. });
  477. }
  478. // 搜索事件
  479. $("#search").click(function () {
  480. $("#form1").submit();
  481. });
  482. function printWeek(weekId) {
  483. if (!weekId) {
  484. layer.msg("打印参数有误");
  485. return;
  486. }
  487. var message = "您确定要下载该班级<?php echo $linkName?>吗?";
  488. var divTitle = '下载<?php echo $linkName?>';
  489. var objUrl = '';
  490. html = "" +
  491. '<div style="padding:20px 30px 0px 30px">' +
  492. '<div style="padding:8px 0;">请复制下方链接下载<?php echo $linkName?>。</div>' +
  493. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>' +
  494. '<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>' +
  495. '</div>' +
  496. '</div>' +
  497. "";
  498. layer.msg(message, {
  499. time: 0,
  500. btn: ['确定', '取消'],
  501. yes: function (index) {
  502. layer.close(index);
  503. $.ajax({
  504. url: "<?php echo $this->createUrl('productdownload/getEnglishReadingFile');?>",
  505. type: "GET",
  506. dataType: "json",
  507. title: divTitle,
  508. data: {"weekId": weekId},
  509. timeout: <?php echo Yii::app()->params["product_download_time_limit"];?>,
  510. beforeSend: function () {
  511. layer.msg("下载中请稍后...", {"time": <?php echo Yii::app()->params["product_download_time_limit"];?>});
  512. },
  513. error: function (jqXHR, textStatus, errorThrown) {
  514. layer.closeAll();
  515. if (textStatus == "timeout") {
  516. $.ajax({
  517. type: 'GET',
  518. url: "<?php echo $this->createUrl("productdownload/addEnReadingTask");?>",
  519. data: {"weekId": weekId},
  520. dataType: "json",
  521. success: function (data) {
  522. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!', {
  523. icon: 1,
  524. yes: function () {
  525. layer.closeAll();
  526. }
  527. });
  528. }
  529. })
  530. } else {
  531. layer.msg('返回失败!', {
  532. icon: 5
  533. }, function () {
  534. layer.closeAll();
  535. });
  536. }
  537. },
  538. success: function (data) {
  539. layer.closeAll();
  540. if (data.success == 1 || data.success == 2) {
  541. layer.open({
  542. type: 1,
  543. area: ['550px', '220px'],
  544. title: divTitle,
  545. content: html,
  546. success: function (index, layerObj) {
  547. 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>');
  548. jQuery("#confirm, #cancel").on("click", function () {
  549. layer.close(layerObj);
  550. });
  551. jQuery("#copy").on("click", function () {
  552. jQuery("#url").select();
  553. });
  554. },
  555. end: function () {
  556. }
  557. });
  558. } else if (data.success == 3) {
  559. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!', {
  560. icon: 1,
  561. yes: function () {
  562. layer.closeAll();
  563. }
  564. });
  565. }
  566. else if (data.success == 0) {
  567. layer.msg(data.message, {"time": 3000});
  568. }
  569. },
  570. });
  571. }
  572. });
  573. }
  574. //发送云印任务
  575. function sendCloudTask(weekId, isDisable) {
  576. if (isDisable === 1) {
  577. return false;
  578. }
  579. //$('.confirmbox-mask').show();return false;
  580. if (!weekId) {
  581. layer.msg("参数有误");
  582. return;
  583. }
  584. var saveDataAry = [];
  585. var data1 = {"weekId": weekId};
  586. saveDataAry.push(data1);
  587. $.ajax({
  588. type: "POST",
  589. url: "<?php echo $this->createUrl("printCloud/generateEnglishReading");?>",
  590. dataType: "json",
  591. contentType: "application/json",
  592. data: JSON.stringify(saveDataAry),
  593. beforeSend: function () {
  594. layer.load(1, {
  595. shade: [0.1, '#fff'] //0.1透明度的白色背景
  596. });
  597. },
  598. success: function (data) {
  599. var index = layer.load();
  600. layer.close(index);
  601. if (data.status == 1) {
  602. $('#sendJson').attr('value', JSON.stringify(data));
  603. var con = '';
  604. var task_count = 0;
  605. var totalCount = 0;
  606. $.each(data.data, function (index, item) {
  607. var one_count = item.enable_download_count - item.download_count;
  608. totalCount += (one_count > 0 ? one_count : 0);
  609. if ((item.enable_download_count - item.download_count) > 0) {
  610. task_count += 1;
  611. }
  612. con += '<tr><td>' + (index + 1) + '</td><td>' + item.taskName + '</td><td>' + item.clazzName + '</td><td>'
  613. + 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>'
  614. + item.download_count + '</td><td>' + (one_count > 0 ? one_count : 0) + '</td><td>' + (one_count > 0 ? '可发送' : '不可发送')
  615. + '</td></tr>'
  616. });
  617. $('#task_count').html(task_count);
  618. $('#total_print_num').html(totalCount);
  619. $('#taskList').html(con);
  620. $('#filter-uploaded').prop("checked", true)
  621. $('.confirmbox-mask').show();
  622. } else if (data.status == 0) {
  623. layer.msg(data.message);
  624. }
  625. }
  626. }
  627. );
  628. }
  629. //批量发送云印任务
  630. $("#selectPrint").click(function () {
  631. // 判断是否有选中
  632. if (!$("input[class='ace myselect']").is(':checked')) {
  633. layer.msg('至少选择一个目标!');
  634. return false;
  635. }
  636. var result = [];
  637. $(".myselect").each(function (m, n) {
  638. if ($(this).prop('checked')) {
  639. if ($(this).val() /*&& $(this).attr("stnm")*/) {
  640. result.push($(this).val());
  641. }
  642. }
  643. });
  644. var saveDataAry = [];
  645. var data1 = [];
  646. for (i = 0; i < result.length; i++) {
  647. var weekId = result[i];
  648. data1 = {"weekId": weekId};
  649. saveDataAry.push(data1);
  650. }
  651. $.ajax({
  652. type: "POST",
  653. url: "<?php echo $this->createUrl("printCloud/generateEnglishReading");?>",
  654. dataType: "json",
  655. contentType: "application/json",
  656. data: JSON.stringify(saveDataAry),
  657. beforeSend: function () {
  658. layer.load(1, {
  659. shade: [0.1, '#fff'] //0.1透明度的白色背景
  660. });
  661. },
  662. success: function (data) {
  663. var index = layer.load();
  664. layer.close(index);
  665. if (data.status == 1) {
  666. $('#sendJson').attr('value', JSON.stringify(data));
  667. var con = '';
  668. var task_count = 0;
  669. var totalCount = 0;
  670. $.each(data.data, function (index, item) {
  671. var one_count = item.enable_download_count - item.download_count;
  672. totalCount += (one_count > 0 ? one_count : 0);
  673. if ((item.enable_download_count - item.download_count) > 0) {
  674. task_count += 1;
  675. }
  676. con += '<tr><td>' + (index + 1) + '</td><td>' + item.taskName + '</td><td>' + item.clazzName + '</td><td>'
  677. + 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>'
  678. + item.download_count + '</td><td>' + (one_count > 0 ? one_count : 0) + '</td><td>' + (one_count > 0 ? '可发送' : '不可发送')
  679. + '</td></tr>'
  680. });
  681. $('#task_count').html(task_count);
  682. $('#total_print_num').html(totalCount);
  683. $('#taskList').html(con);
  684. $('#filter-uploaded').prop("checked", true);
  685. $('.confirmbox-mask').show();
  686. } else if (data.status == 0) {
  687. layer.msg(data.message);
  688. }
  689. }
  690. }
  691. );
  692. });
  693. // 全选\反选
  694. $(".selectAll").click(function () {
  695. if ($(this).prop("checked")) {
  696. var s_obj = $(".myselect");
  697. var s_len = s_obj.length;
  698. for (var i = 0; i < s_len; i++) {
  699. if (!s_obj[i].disabled) {
  700. s_obj[i].checked = true;
  701. }
  702. }
  703. } else {
  704. $(".myselect").prop("checked", false);
  705. }
  706. });
  707. //过滤已下载学生
  708. $('#filter-uploaded').click(function () {
  709. if ($(this).is(':checked')) {
  710. var totalCount = 0;
  711. var task_count = 0;
  712. $('#taskList tr').each(function () {
  713. var enable_count = parseInt($(this).children("td:eq(3)").children('i').html());
  714. var dowanload_count = parseInt($(this).children("td:eq(4)").html());
  715. $(this).children("td:eq(5)").html((enable_count - dowanload_count) > 0 ? (enable_count - dowanload_count) : 0);
  716. totalCount += ((enable_count - dowanload_count) > 0 ? (enable_count - dowanload_count) : 0);
  717. if ((enable_count - dowanload_count) == 0) {
  718. $(this).children("td:eq(6)").html('不可发送');
  719. } else {
  720. $(this).children("td:eq(6)").html('可发送');
  721. task_count += 1;
  722. }
  723. });
  724. $('#task_count').html(task_count);
  725. $('#total_print_num').html(totalCount)
  726. } else {
  727. var totalCount = 0;
  728. var task_count = 0;
  729. $('#taskList tr').each(function () {
  730. var enable_count = $(this).children("td:eq(3)").children('i').html();
  731. $(this).children("td:eq(5)").html(enable_count);
  732. totalCount += parseInt(enable_count);
  733. if (enable_count == 0) {
  734. $(this).children("td:eq(6)").html('不可发送');
  735. } else {
  736. $(this).children("td:eq(6)").html('可发送');
  737. task_count += 1;
  738. }
  739. });
  740. $('#task_count').html(task_count);
  741. $('#total_print_num').html(totalCount);
  742. $('#filter-uploaded').attr('isFilter', 0)
  743. }
  744. });
  745. //发送云印任务(真正发送)
  746. $('#sendCloudPrint').click(function () {
  747. var task_count = parseInt($('#task_count').html());
  748. if (task_count === 0) {
  749. layer.msg('没有可发送的任务');
  750. return false;
  751. }
  752. var json_data = $('#sendJson').val();
  753. var is_filter = $('#filter-uploaded').is(':checked') ? 1 : 0;
  754. $.post({
  755. url: "<?php echo $this->createUrl("printCloud/sendEnglishReadingTask");?>",
  756. data: {
  757. 'json_data': json_data,
  758. 'is_filter': is_filter,
  759. },
  760. dataType: "json",
  761. beforeSend: function () {
  762. layer.load(1, {
  763. shade: [0.1, '#fff'] //0.1透明度的白色背景
  764. });
  765. },
  766. success: function (data) {
  767. var index = layer.load();
  768. layer.close(index);
  769. if (data.status == 1) {
  770. layer.msg('操作成功,请耐心等待后台打包');
  771. $('.confirmbox-mask').hide();
  772. location.reload();
  773. } else if (data.status == 0) {
  774. layer.msg(data.message);
  775. }
  776. }
  777. });
  778. });
  779. $('.confirmbox-mask .icon-close-1').click(function () {
  780. $('.confirmbox-mask').hide();
  781. });
  782. $('.confirmbox-mask .cancel').click(function () {
  783. $('.confirmbox-mask').hide();
  784. });
  785. //批量下载
  786. $("#batchPrint").click(function () {
  787. var message = "您确定要批量下载该产品吗?";
  788. // 判断是否有选中
  789. if (!$("input[class='ace myselect']").is(':checked')) {
  790. layer.msg('至少选择一个目标!');
  791. return false;
  792. }
  793. var result = [];
  794. $(".myselect").each(function (m, n) {
  795. if ($(this).prop('checked')) {
  796. if ($(this).val() /*&& $(this).attr("stnm")*/) {
  797. result.push($(this).val());
  798. }
  799. }
  800. });
  801. var saveDataAry = [];
  802. var data1 = [];
  803. for (i = 0; i < result.length; i++) {
  804. var weekId = result[i];
  805. data1 = {"weekId": weekId};
  806. saveDataAry.push(data1);
  807. }
  808. layer.msg(message, {
  809. time: 0,
  810. btn: ['确定', '取消'],
  811. yes: function (index) {
  812. layer.close(index);
  813. $.ajax({
  814. type: "POST",
  815. url: "<?php echo $this->createUrl('productdownload/batchEnReading');?>",
  816. dataType: "json",
  817. contentType: "application/json",
  818. data: JSON.stringify(saveDataAry),
  819. success: function (data) {
  820. layer.closeAll();
  821. if (data.success == 1) {
  822. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!', {
  823. icon: 1,
  824. yes: function () {
  825. layer.closeAll();
  826. }
  827. });
  828. } else {
  829. layer.msg(data.message);
  830. }
  831. },
  832. });
  833. }
  834. });
  835. });
  836. </script>