index.php 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803
  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{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. jQuery(document).ready(function(){
  188. // 根据年级筛选班级
  189. jQuery("#grade").change(function(){
  190. var grade = $(this).val();
  191. if (!grade) return false;
  192. jQuery.post(
  193. '<?php echo $this->createUrl("print/getGradeClass");?>',{"grade": grade},function(data){
  194. data = JSON.parse(data);
  195. if(data.success == 1){
  196. var classObj = $("#class");
  197. var html = "<option value=''>全部班级</option>";
  198. classObj.empty();
  199. $.each(data.message,function(i,n){
  200. html += "<option value='"+n.class_id+"'>" + n.class_name + "</option>";
  201. });
  202. classObj.append(html);
  203. }
  204. }
  205. );
  206. });
  207. });
  208. </script>
  209. <link rel="stylesheet" href="/fonts/fpdf/iconfont.css" />
  210. <div class="main-content-inner">
  211. <!-- 导航栏开始-->
  212. <?php include(Yii::app()->basePath.'/views/layouts/view_production_navigation.php');?>
  213. <!-- 导航栏结束-->
  214. <div class="page-content">
  215. <div class="row" style="margin:0px;">
  216. <div class="col-xs-12">
  217. <!-- PAGE CONTENT BEGINS -->
  218. <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
  219. <div class="row">
  220. <form method="get" id="form1" action="<?php echo $this->createUrl("htb/index");?>">
  221. <div class="col-xs-12">
  222. <div class="dataTables_length margin-zy clearfix">
  223. <select class="form-control" id="grade" name="grade">
  224. <option value="">年级</option>
  225. <option value="1" <?php if($grade == 1) echo "selected";?>>高一</option>
  226. <option value="2" <?php if($grade == 2) echo "selected";?>>高二</option>
  227. <option value="3" <?php if($grade == 3) echo "selected";?>>高三</option>
  228. </select>
  229. <select class="form-control" id="class" name="classId">
  230. <option value="">全部班级</option>
  231. <?php foreach($classes as $class){?>
  232. <option <?php if((string)$classId === (string)$class["class_id"]) echo "selected=selected";?> value="<?php echo $class["class_id"];?>"><?php echo $class["class_name"];?></option>
  233. <?php }?>
  234. </select>
  235. <input type="text" class="form-control input-sm" placeholder="请输入打印任务名称" name="name" value="<?php echo $printName;?>">
  236. <button class="label-primary-s bth-s" id="search" style="padding:4px 12px;">搜索</button>
  237. <span class="fr ">
  238. <a href="<?php echo $this->createUrl("htb/setting");?>" class="btn-garder">选择内容生成</a>
  239. <a id="batchPrint" href="javascript:void(0);" class="btn-garder">批量下载</a>
  240. <a id="batchPrintToolsHtb" href="javascript:void(0);" class="btn-garder">批量打印</a>
  241. <a id="selectPrint" href="javascript:void(0);" class="btn-garder">发送云印任务</a>
  242. </span>
  243. </div>
  244. </div>
  245. </form>
  246. </div>
  247. <table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable" style="font-size:12px">
  248. <thead>
  249. <tr>
  250. <th class="center">
  251. <input type="checkbox" class="ace selectAll" />
  252. </th>
  253. <th>名称</th>
  254. <th>班级</th>
  255. <th>已生成/总数</th>
  256. <th>是否下载/打印</th>
  257. <th>下载/打印时间</th>
  258. <th >操作</th>
  259. </tr>
  260. </thead>
  261. <tbody>
  262. <?php if(!empty($printList)):foreach($printList as $cl):?>
  263. <tr>
  264. <td>
  265. <?php if(Yii::app()->cache->getValue("cloud_print_task_htb_".$cl['htb_id']) != 1){?>
  266. <input type="checkbox" class="ace myselect" value="<?php echo $cl['htb_id'];?>">
  267. <?php }?>
  268. </td>
  269. <td style="max-width:260px">
  270. <?php if($cl['is_new_version']){ ?>
  271. <a href="<?php echo $this->createUrl('htb/resetHtb',array('htbGroupId'=>(string)$cl['htb_group_id'])); ?>"><?php echo $cl['name'];?></a>
  272. <?php }else{?>
  273. <a href="javascript:" title="旧数据无重置功能"><?php echo $cl['name'];?></a>
  274. <?php }?>
  275. </td>
  276. <td style="max-width:100px"><?php echo $cl['class_name'];?></td>
  277. <td><?php echo $cl['pdfCount'].'/'.$cl['totalCount'];?></td>
  278. <td><?php if($cl['isDown']){echo '已下载/打印';}else{echo '未下载/打印';}?></td>
  279. <td><?php echo $cl['downTime'];?></td>
  280. <td style="width:265px;">
  281. <span class="iconfont click-sc addbx printToolsHtb" hid="<?php echo (string)$cl['htb_id'];?>" aria-hidden="true" title="打印好题本" >&#xe6bb;</span>
  282. <span class="iconfont click-sc addbx" aria-hidden="true" title="下载好题本" onclick="printWeek('<?php echo (string)$cl['htb_id'];?>')"><img src="/images/download.png" style="margin-bottom:-2px;"></span>
  283. <span class="iconfont click-sc addbx" aria-hidden="true" title="选择学生下载好题本" onclick="javascript:location.href='<?php echo $this->createUrl('htb/selectStu',array('htbId'=>(string)$cl['htb_id']));?>'">&#xe668;</span>
  284. <!-- 发送云印任务 -->
  285. <span class="iconfont click-sc addbx" <?php if(Yii::app()->cache->getValue("cloud_print_task_htb_".$cl['htb_id']) == 1) echo 'style="background-color:gray"';?> aria-hidden="true" title="<?php if(Yii::app()->cache->getValue("cloud_print_task_htb_".$cl['htb_id']) == 1){echo '24小时内不可重复发送';}else{echo '发送云印任务';}?>" onclick="sendCloudTask('<?php echo $cl['htb_id'];?>',<?php echo Yii::app()->cache->getValue("cloud_print_task_htb_".$cl['htb_id']) == 1 ? 1 :0;?>)">云</span>
  286. </td>
  287. </tr>
  288. <?php endforeach;else:?>
  289. <tr><td colspan="8">暂无数据!</td></tr>
  290. <?php endif;?>
  291. </tbody>
  292. </table>
  293. <?php if(!empty($page_total)):?>
  294. <div class="row">
  295. <div class="col-xs-6">
  296. &nbsp;
  297. </div>
  298. <div class="col-xs-6">
  299. <div class="dataTables_paginate paging_simple_numbers">
  300. <?php
  301. $this->widget('CLinkPager', array(
  302. 'header' => '',
  303. 'firstPageLabel'=> '首页',
  304. 'lastPageLabel' => '末页',
  305. 'prevPageLabel' => '上一页',
  306. 'nextPageLabel' => '下一页',
  307. 'pages' => $pages,
  308. 'maxButtonCount'=> 5,
  309. ));
  310. echo '共:'.$page_total.'条';
  311. ?>
  312. </div>
  313. </div>
  314. </div>
  315. <?php endif;?>
  316. </div>
  317. <!--上传模板弹窗-->
  318. <!--发送云印任务弹窗-->
  319. <div class="confirmbox-mask" id="classModal-1" style="display: none;">
  320. <div class="class-modal-1">
  321. <i class="icon icon-close-1" style="color: white">X</i><div class="class-modal-head-1">发送云印任务</div>
  322. <div class="class-modal-body-1">
  323. <div>
  324. <span>亲爱的学管:您正在发起云印任务,请核对以下云印任务数据!</span>
  325. <span style="float: right;">共<i id="task_count">0</i>条任务,<i id="total_print_num">0</i>份云印任务</span>
  326. </div>
  327. <table style="margin-top: 15px;" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable">
  328. <thead>
  329. <tr>
  330. <th>序号</th>
  331. <th>任务名称</th>
  332. <th>班级</th>
  333. <th>已生成/已开通/可下载</th>
  334. <th>已下载</th>
  335. <th>云印份数</th>
  336. <th>备注</th>
  337. </tr>
  338. </thead>
  339. <tbody id="taskList">
  340. </tbody>
  341. </table>
  342. <div style="margin-top: 40px;">
  343. <span><img width="20px" height="20px" src="/images/icon-tip.svg">发送后,请至学管端【IMS-云印任务】模块查看任务进程,请等待云印中心打印后,寄回给学校!</span>
  344. <span style="margin-left:15px;float: right;"><input id="filter-uploaded" checked="checked" type="checkbox">过滤【已下载】的学生</span>
  345. </div>
  346. <div class="btn_area" style="text-align: center;">
  347. <input type="hidden" id="sendJson" name="sendJson" value="">
  348. <button id="sendCloudPrint" class="download">发送</button>
  349. <button class="cancel">取消</button>
  350. </div>
  351. </div>
  352. </div>
  353. </div>
  354. <!-- PAGE CONTENT ENDS -->
  355. </div>
  356. </div>
  357. </div>
  358. </div>
  359. <?php include(Yii::app()->basePath.'/views/print/_print.php');?>
  360. <script src="/js/jquery.ajaxfileupload.js"></script>
  361. <script type="text/javascript">
  362. $(document).ready(function(){
  363. });
  364. function objToJson(obj){
  365. var json = "{ ";
  366. for(var item in obj){
  367. json += "'"+item+"':'"+obj[item]+"',";
  368. }
  369. json += " }";
  370. return json;
  371. }
  372. function ccc(){
  373. layer.msg('敬请期待!', {
  374. time: 0,
  375. btn: ['确定', '取消'],
  376. yes: function(index){
  377. layer.close(index);
  378. return false;
  379. }
  380. });
  381. }
  382. // 搜索事件
  383. $("#search").click(function(){
  384. $("#form1").submit();
  385. });
  386. function printWeek(mrId){
  387. if (!mrId) {
  388. layer.msg("打印参数有误");return;
  389. }
  390. var message = "您确定要下载该班级好题本吗?";
  391. var divTitle = '下载好题本';
  392. var objUrl = '';
  393. html = ""+
  394. '<div style="padding:20px 30px 0px 30px">'+
  395. '<div style="padding:8px 0;">请复制下方链接下载好题本。</div>'+
  396. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>'+
  397. '<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>'+
  398. '</div>'+
  399. '</div>'+
  400. "";
  401. layer.msg(message, {
  402. time: 0,
  403. btn: ['确定', '取消'],
  404. yes: function(index){
  405. layer.close(index);
  406. $.ajax({
  407. url: "<?php echo $this->createUrl('productdownload/getHtbFile');?>",
  408. type: "GET",
  409. dataType: "json",
  410. title: divTitle,
  411. data: {"htbId": mrId},
  412. timeout: <?php echo Yii::app()->params["product_download_time_limit"];?>,
  413. beforeSend:function(){
  414. layer.msg("下载中请稍后...",{"time": <?php echo Yii::app()->params["product_download_time_limit"];?>});
  415. },
  416. error: function (jqXHR, textStatus, errorThrown) {
  417. layer.closeAll();
  418. if(textStatus=="timeout"){
  419. $.ajax({
  420. type:'GET',
  421. url: "<?php echo $this->createUrl("productdownload/addHtbTask");?>",
  422. data: {"htbId": mrId},
  423. dataType: "json",
  424. success:function (data) {
  425. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!',{
  426. icon: 1,
  427. yes:function(){
  428. layer.closeAll();
  429. }
  430. });
  431. }
  432. })
  433. }else {
  434. layer.msg('返回失败!',{
  435. icon: 5
  436. }, function(){
  437. layer.closeAll();
  438. });
  439. }
  440. },
  441. success: function (data){
  442. layer.closeAll();
  443. if(data.success == 1||data.success == 2){
  444. layer.open({
  445. type: 1,
  446. area: ['550px', '220px'],
  447. title: divTitle,
  448. content: html,
  449. success: function(index, layerObj){
  450. 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>');
  451. jQuery("#confirm, #cancel").on("click", function(){
  452. layer.close(layerObj);
  453. });
  454. jQuery("#copy").on("click", function(){
  455. jQuery("#url").select();
  456. });
  457. },
  458. end: function(){
  459. }
  460. });
  461. }else if(data.success == 3){
  462. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!',{
  463. icon: 1,
  464. yes:function(){
  465. layer.closeAll();
  466. }
  467. });
  468. }
  469. else if(data.success == 0){
  470. layer.msg(data.message, {"time": 3000});
  471. }
  472. },
  473. });
  474. }
  475. });
  476. }
  477. //发送云印任务
  478. function sendCloudTask(htb_id,isDisable){
  479. if(isDisable === 1){
  480. return false;
  481. }
  482. //$('.confirmbox-mask').show();return false;
  483. if (!htb_id) {
  484. layer.msg("参数有误");return;
  485. }
  486. var saveDataAry=[];
  487. var data1={"htb_id": htb_id};
  488. saveDataAry.push(data1);
  489. $.ajax({
  490. type: "POST",
  491. url: "<?php echo $this->createUrl("printCloud/generateHtb");?>",
  492. dataType: "json",
  493. contentType: "application/json",
  494. data: JSON.stringify(saveDataAry),
  495. beforeSend:function(){
  496. layer.load(1, {
  497. shade: [0.1,'#fff'] //0.1透明度的白色背景
  498. });
  499. },
  500. success:function(data) {
  501. var index = layer.load();
  502. layer.close(index);
  503. if (data.status == 1) {
  504. $('#sendJson').attr('value', JSON.stringify(data));
  505. var con = '';
  506. var task_count = 0;
  507. var totalCount = 0;
  508. $.each(data.data, function(index, item) {
  509. var one_count = item.enable_download_count - item.download_count;
  510. totalCount += (one_count>0?one_count:0);
  511. if((item.enable_download_count - item.download_count)>0) {
  512. task_count += 1;
  513. }
  514. con += '<tr><td>' + (index + 1) + '</td><td>' + item.taskName + '</td><td>' + item.clazzName + '</td><td>'
  515. + 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>'
  516. + item.download_count + '</td><td>' + (one_count>0?one_count:0) + '</td><td>' + (one_count>0?'可发送':'不可发送')
  517. + '</td></tr>'
  518. });
  519. $('#task_count').html(task_count);
  520. $('#total_print_num').html(totalCount);
  521. $('#taskList').html(con);
  522. $('#filter-uploaded').prop("checked", true)
  523. $('.confirmbox-mask').show();
  524. } else if (data.status == 0) {
  525. layer.msg(data.message);
  526. }
  527. }
  528. }
  529. );
  530. }
  531. //批量发送云印任务
  532. $("#selectPrint").click(function() {
  533. // 判断是否有选中
  534. if (!$("input[class='ace myselect']").is(':checked')) {
  535. layer.msg('至少选择一个目标!');
  536. return false;
  537. }
  538. var result = [];
  539. $(".myselect").each(function(m,n){
  540. if ($(this).prop('checked')) {
  541. if ($(this).val() /*&& $(this).attr("stnm")*/) {
  542. result.push($(this).val());
  543. }
  544. }
  545. });
  546. var saveDataAry=[];
  547. var data1 = [];
  548. for(i=0;i<result.length;i++)
  549. {
  550. var htb_id = result[i];
  551. data1 = {"htb_id": htb_id};
  552. saveDataAry.push(data1);
  553. }
  554. $.ajax({
  555. type: "POST",
  556. url: "<?php echo $this->createUrl("printCloud/generateHtb");?>",
  557. dataType: "json",
  558. contentType: "application/json",
  559. data: JSON.stringify(saveDataAry),
  560. beforeSend:function(){
  561. layer.load(1, {
  562. shade: [0.1,'#fff'] //0.1透明度的白色背景
  563. });
  564. },
  565. success:function(data) {
  566. var index = layer.load();
  567. layer.close(index);
  568. if (data.status == 1) {
  569. $('#sendJson').attr('value', JSON.stringify(data));
  570. var con = '';
  571. var task_count = 0;
  572. var totalCount = 0;
  573. $.each(data.data, function(index, item) {
  574. var one_count = item.enable_download_count - item.download_count;
  575. totalCount += (one_count>0?one_count:0);
  576. if((item.enable_download_count - item.download_count)>0) {
  577. task_count += 1;
  578. }
  579. con += '<tr><td>' + (index + 1) + '</td><td>' + item.taskName + '</td><td>' + item.clazzName + '</td><td>'
  580. + 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>'
  581. + item.download_count + '</td><td>' + (one_count>0?one_count:0) + '</td><td>' + (one_count>0?'可发送':'不可发送')
  582. + '</td></tr>'
  583. });
  584. $('#task_count').html(task_count);
  585. $('#total_print_num').html(totalCount);
  586. $('#taskList').html(con);
  587. $('#filter-uploaded').prop("checked", true);
  588. $('.confirmbox-mask').show();
  589. } else if (data.status == 0) {
  590. layer.msg(data.message);
  591. }
  592. }
  593. }
  594. );
  595. });
  596. // 全选\反选
  597. $(".selectAll").click(function(){
  598. if ($(this).prop("checked")) {
  599. var s_obj = $(".myselect");
  600. var s_len = s_obj.length;
  601. for (var i=0;i<s_len;i++) {
  602. if (!s_obj[i].disabled) {
  603. s_obj[i].checked=true;
  604. }
  605. }
  606. } else {
  607. $(".myselect").prop("checked",false);
  608. }
  609. });
  610. //过滤已下载学生
  611. $('#filter-uploaded').click(function () {
  612. if($(this).is(':checked')){
  613. var totalCount = 0;
  614. var task_count = 0;
  615. $('#taskList tr').each(function () {
  616. var enable_count = parseInt($(this).children("td:eq(3)").children('i').html());
  617. var dowanload_count = parseInt($(this).children("td:eq(4)").html());
  618. $(this).children("td:eq(5)").html((enable_count-dowanload_count)>0?(enable_count-dowanload_count):0);
  619. totalCount += ((enable_count-dowanload_count)>0?(enable_count-dowanload_count):0);
  620. if((enable_count-dowanload_count)==0){
  621. $(this).children("td:eq(6)").html('不可发送');
  622. }else{
  623. $(this).children("td:eq(6)").html('可发送');
  624. task_count += 1;
  625. }
  626. });
  627. $('#task_count').html(task_count);
  628. $('#total_print_num').html(totalCount)
  629. }else {
  630. var totalCount = 0;
  631. var task_count = 0;
  632. $('#taskList tr').each(function () {
  633. var enable_count = $(this).children("td:eq(3)").children('i').html();
  634. $(this).children("td:eq(5)").html(enable_count);
  635. totalCount += parseInt(enable_count);
  636. if(enable_count==0){
  637. $(this).children("td:eq(6)").html('不可发送');
  638. }else{
  639. $(this).children("td:eq(6)").html('可发送');
  640. task_count += 1;
  641. }
  642. });
  643. $('#task_count').html(task_count);
  644. $('#total_print_num').html(totalCount);
  645. $('#filter-uploaded').attr('isFilter',0)
  646. }
  647. });
  648. //发送云印任务(真正发送)
  649. $('#sendCloudPrint').click(function (){
  650. var task_count = parseInt($('#task_count').html());
  651. if(task_count === 0){
  652. layer.msg('没有可发送的任务');
  653. return false;
  654. }
  655. var json_data = $('#sendJson').val();
  656. var is_filter = $('#filter-uploaded').is(':checked') ? 1 : 0;
  657. $.post({
  658. url: "<?php echo $this->createUrl("printCloud/sendHtbTask");?>",
  659. data: {
  660. 'json_data' : json_data,
  661. 'is_filter' : is_filter,
  662. },
  663. dataType: "json",
  664. beforeSend:function(){
  665. layer.load(1, {
  666. shade: [0.1,'#fff'] //0.1透明度的白色背景
  667. });
  668. },
  669. success:function(data) {
  670. var index = layer.load();
  671. layer.close(index);
  672. if (data.status == 1) {
  673. layer.msg('操作成功,请耐心等待后台打包');
  674. $('.confirmbox-mask').hide();
  675. location.reload();
  676. } else if (data.status == 0) {
  677. layer.msg(data.message);
  678. }
  679. }
  680. });
  681. });
  682. $('.confirmbox-mask .icon-close-1').click(function () {
  683. $('.confirmbox-mask').hide();
  684. });
  685. $('.confirmbox-mask .cancel').click(function () {
  686. $('.confirmbox-mask').hide();
  687. });
  688. //批量下载
  689. $("#batchPrint").click(function(){
  690. var message = "您确定要批量下载该产品吗?";
  691. // 判断是否有选中
  692. if (!$("input[class='ace myselect']").is(':checked')) {
  693. layer.msg('至少选择一个目标!');
  694. return false;
  695. }
  696. var result = [];
  697. $(".myselect").each(function(m,n){
  698. if ($(this).prop('checked')) {
  699. if ($(this).val() /*&& $(this).attr("stnm")*/) {
  700. result.push($(this).val());
  701. }
  702. }
  703. });
  704. var saveDataAry=[];
  705. var data1 = [];
  706. for(i=0;i<result.length;i++)
  707. {
  708. var htbId = result[i];
  709. data1 = {"htbId": htbId};
  710. saveDataAry.push(data1);
  711. }
  712. layer.msg(message, {
  713. time: 0,
  714. btn: ['确定', '取消'],
  715. yes: function(index){
  716. layer.close(index);
  717. $.ajax({
  718. type: "POST",
  719. url: "<?php echo $this->createUrl('productdownload/batchHtb');?>",
  720. dataType: "json",
  721. contentType: "application/json",
  722. data: JSON.stringify(saveDataAry),
  723. success: function (data){
  724. layer.closeAll();
  725. if(data.success == 1) {
  726. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!', {
  727. icon: 1,
  728. yes: function () {
  729. layer.closeAll();
  730. }
  731. });
  732. }else {
  733. layer.msg(data.message);
  734. }
  735. },
  736. });
  737. }
  738. });
  739. });
  740. </script>