holiday_index.php 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967
  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. .tab-con-btn {
  178. height: 31px;
  179. width: 210px;
  180. background: #F2F2F2;
  181. border: 1px solid #2977ff;
  182. border-radius: 15px;
  183. display: inline-block;
  184. text-align: center;
  185. }
  186. .has-sel {
  187. background: #01B677;
  188. color: #fff;
  189. width: 50%;
  190. height: 30px;
  191. border-top-left-radius: 15px;
  192. border-bottom-left-radius: 15px;
  193. text-align: center;
  194. line-height: 30px;
  195. }
  196. .tab_btn {
  197. display: inline-block;
  198. width: 100px;
  199. padding: 0;
  200. border: 0;
  201. outline: none;
  202. margin: 0;
  203. background: #F2F2F2;
  204. border-radius: inherit;
  205. cursor: pointer;
  206. }
  207. </style>
  208. <script type="text/javascript">
  209. function in_array(search, array){
  210. for(var i in array){
  211. if(array[i]==search){
  212. return true;
  213. }
  214. }
  215. return false;
  216. }
  217. testFlag = "<?php echo $this->testFlag;?>";
  218. customTplsIds = new Array();
  219. var i = 0;
  220. <?php foreach(Yii::app()->params["custom_tpls_ids"] as $tplId){?>
  221. customTplsIds[i] = "<?php echo $tplId;?>";
  222. i++;
  223. <?php }?>
  224. jQuery(document).ready(function(){
  225. // 根据年级筛选班级
  226. jQuery("#grade").change(function(){
  227. var grade = $(this).val();
  228. if (!grade) return false;
  229. jQuery.post(
  230. '<?php echo $this->createUrl("print/getGradeClass");?>',{"grade": grade},function(data){
  231. data = JSON.parse(data);
  232. if(data.success == 1){
  233. var classObj = $("#class");
  234. var html = "<option value=''>全部班级</option>";
  235. classObj.empty();
  236. $.each(data.message,function(i,n){
  237. html += "<option value='"+n.class_id+"'>" + n.class_name + "</option>";
  238. });
  239. classObj.append(html);
  240. }
  241. }
  242. );
  243. });
  244. });
  245. </script>
  246. <link rel="stylesheet" href="/fonts/fpdf/iconfont.css" />
  247. <div class="main-content-inner">
  248. <!-- 导航栏开始-->
  249. <?php include(Yii::app()->basePath.'/views/layouts/view_production_navigation.php');?>
  250. <!-- 导航栏结束-->
  251. <div class="page-content">
  252. <div class="row" style="margin:0px;">
  253. <div class="col-xs-12">
  254. <!-- PAGE CONTENT BEGINS -->
  255. <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
  256. <div class="row">
  257. <form method="get" id="form1" action="<?php echo $this->createUrl("export/holiday_index");?>">
  258. <div class="col-xs-12">
  259. <div class="dataTables_length margin-zy clearfix">
  260. <div class="tab-con-btn">
  261. <span class="tab_btn has-sel">学生产品</span>
  262. <span class="tab_btn" onclick="location.href='<?php echo $this->createUrl('export/holiday_teacher_index');?>'">教师产品</span>
  263. </div>
  264. <select class="form-control" id="grade" name="grade">
  265. <option value="">年级</option>
  266. <option value="1" <?php if($grade == 1) echo "selected";?>>高一</option>
  267. <option value="2" <?php if($grade == 2) echo "selected";?>>高二</option>
  268. <option value="3" <?php if($grade == 3) echo "selected";?>>高三</option>
  269. </select>
  270. <select class="form-control" id="class" name="classId">
  271. <option value="">全部班级</option>
  272. <?php foreach($classes as $class){?>
  273. <?php if(!$class['class_id']){continue;}?>
  274. <option <?php if((string)$classId === (string)$class["class_id"]) echo "selected=selected";?> value="<?php echo $class["class_id"];?>"><?php echo $class["class_name"];?></option>
  275. <?php }?>
  276. </select>
  277. <select class="form-control" id="semesterId" name="semesterId">
  278. <?php foreach($semsters as $semster){?>
  279. <option <?php if((string)$semsterId === (string)$semster["semester_id"]) echo "selected=selected";?> value="<?php echo $semster["semester_id"];?>"><?php echo $semster["semester_name"];?></option>
  280. <?php }?>
  281. </select>
  282. <button class="label-primary-s bth-s" id="search" style="padding:4px 12px;">搜索</button>
  283. <span style="font-size:13px;padding-left:2px;color:red;">
  284. 提示:数据更新要第2天下载,请提前一天更新。报告生成保存7天,7天后请重新下载
  285. </span>
  286. <span class="fr ">
  287. <?php // if(isset($is_all_pdf) && $is_all_pdf):?>
  288. <span style="color:red">
  289. <?php // if(isset($create_time) && $create_time):?>
  290. <?php // echo date("m月d日",$create_time+86400).'已更新';?>
  291. <?php // endif;?>
  292. </span>
  293. <?php // else:?>
  294. <span style="color:red">
  295. <?php // if(isset($create_time) && $create_time):?>
  296. <?php // echo date("m月d日",$create_time).'已重置,更新报告需1-2天,正在更新';?>
  297. <?php // endif;?>
  298. </span>
  299. <?php // endif;?>
  300. <a id="batchUpdate" href="javascript:void(0);" class="btn-garder">批量更新</a>
  301. <a id="batchPrint" href="javascript:void(0);" class="btn-garder">批量下载</a>
  302. <a id="selectPrint" href="javascript:void(0);" class="btn-garder">发送云印任务</a>
  303. <a id="batchPrintToolsJqbg" href="javascript:void(0);" class="btn-garder">批量打印</a>
  304. </span>
  305. </div>
  306. </div>
  307. </form>
  308. </div>
  309. <table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable" style="font-size:12px">
  310. <thead>
  311. <tr>
  312. <th class="center">
  313. <input type="checkbox" class="ace selectAll" />
  314. </th>
  315. <th>生成日期</th>
  316. <th>班级</th>
  317. <th>名称</th>
  318. <th>学期</th>
  319. <th>报告已生成/总数</th>
  320. <th>是否下载/打印</th>
  321. <th>数据是否生成</th>
  322. <th>操作</th>
  323. </tr>
  324. </thead>
  325. <tbody>
  326. <?php if(!empty($printList)):foreach($printList as $cl):?>
  327. <?php if(!$cl['class_id']){continue;}?>
  328. <tr>
  329. <td>
  330. <?php if(Yii::app()->cache->getValue("cloud_print_holiday_report_".$cl['report_id']) != 1){?>
  331. <input type="checkbox" class="ace myselect" value="<?php echo $cl['report_id'];?>">
  332. <?php }?>
  333. </td>
  334. <td><?php echo isset($cl['create_time'])?$cl['create_time']:"";?></td>
  335. <td style="max-width:100px"><?php echo $cl['class_name'];?></td>
  336. <td style="max-width:260px" reportId="<?php echo $cl['report_id']?>">
  337. <?php echo $cl['report_name'];?>
  338. <!--<a href="<?php // echo $this->createUrl('print/resetEnglishReading',array("readingId"=>$cl['reading_id']));?>"></a>-->
  339. </td>
  340. <td><?php echo isset($cl['semester_name'])?$cl['semester_name']:"";?></td>
  341. <td><?php echo $cl['pdfCount'].'/'.$cl['totalCount'];?></td>
  342. <td><?php if($cl['isDown']){echo '已下载/打印';}else{echo '未下载/打印';}?></td>
  343. <td><?php echo isset($data_status) && $data_status?'已生成':'未生成';?></td>
  344. <td style="width:265px;">
  345. <span class="iconfont click-sc addbx printToolsJqbg" rid="<?php echo (string)$cl['report_id'];?>" aria-hidden="true" title="打印假期报告" >&#xe6bb;</span>
  346. <span class="iconfont click-sc addbx" aria-hidden="true" title="下载假期报告" onclick="printWeek('<?php echo (string)$cl['report_id'];?>')"><img src="/images/download.png" style="margin-bottom:-2px;"></span>
  347. <span class="iconfont click-sc addbx" aria-hidden="true" title="选择学生下载假期报告" onclick="javascript:location.href='<?php echo $this->createUrl('export/selectStuByHolidayReport',array('reportId'=>(string)$cl['report_id']));?>'">&#xe668;</span>
  348. <!-- 发送云印任务 -->
  349. <span class="iconfont click-sc addbx" <?php if(Yii::app()->cache->getValue("cloud_print_holiday_report_".$cl['report_id']) == 1) echo 'style="background-color:gray"';?> aria-hidden="true" title="<?php if(Yii::app()->cache->getValue("cloud_print_holiday_report_".$cl['report_id']) == 1){echo '24小时内不可重复发送';}else{echo '发送云印任务';}?>" onclick="sendCloudTask('<?php echo $cl['report_id'];?>',<?php echo Yii::app()->cache->getValue("cloud_print_holiday_report_".$cl['report_id']) == 1 ? 1 :0;?>)">云</span>
  350. <span style=" display: inline-block;
  351. width: 28px;
  352. height: 28px;
  353. vertical-align: -1px;
  354. padding: 2px;" class="iconfont click-sc addbx" aria-hidden="true" title="更新pdf" onclick="resetReport('<?php echo (string)$cl['report_id'];?>','<?php echo (string)$cl['class_id'];?>','<?php echo (string)$cl['semester_id'];?>','<?php echo (string)$cl['reset_times'];?>')"><img src="/images/report-reset.png" style="width: 65%;
  355. height: auto;"/></span>
  356. </td>
  357. </tr>
  358. <?php endforeach;else:?>
  359. <tr><td colspan="8">暂无数据!</td></tr>
  360. <?php endif;?>
  361. </tbody>
  362. </table>
  363. <?php if(!empty($page_total)):?>
  364. <div class="row">
  365. <div class="col-xs-6">
  366. <span style="color:red">提示:如有学生进行转班,请点击相应班级后的更新pdf按钮</span>
  367. &nbsp;
  368. </div>
  369. <div class="col-xs-6">
  370. <div class="dataTables_paginate paging_simple_numbers">
  371. <select class="form-control" id="limit" name="limit">
  372. <option value="10" <?php if($limit == 10) echo "selected";?> data-url="<?php echo $this->createUrl("export/holiday_index",array('limit'=>10));?>">10</option>
  373. <option value="20" <?php if($limit == 20) echo "selected";?> data-url="<?php echo $this->createUrl("export/holiday_index",array('limit'=>20));?>">20</option>
  374. <option value="30" <?php if($limit == 30) echo "selected";?> data-url="<?php echo $this->createUrl("export/holiday_index",array('limit'=>30));?>">30</option>
  375. </select>
  376. <?php
  377. $this->widget('CLinkPager', array(
  378. 'header' => '',
  379. 'firstPageLabel'=> '首页',
  380. 'lastPageLabel' => '末页',
  381. 'prevPageLabel' => '上一页',
  382. 'nextPageLabel' => '下一页',
  383. 'pages' => $pages,
  384. 'maxButtonCount'=> 5,
  385. ));
  386. echo '共:'.$page_total.'条';
  387. ?>
  388. </div>
  389. </div>
  390. </div>
  391. <?php endif;?>
  392. </div>
  393. <!--上传模板弹窗-->
  394. <!--发送云印任务弹窗-->
  395. <div class="confirmbox-mask" id="classModal-1" style="display: none;">
  396. <div class="class-modal-1">
  397. <i class="icon icon-close-1" style="color: white">X</i><div class="class-modal-head-1">发送云印任务</div>
  398. <div class="class-modal-body-1">
  399. <div>
  400. <span>亲爱的学管:您正在发起云印任务,请核对以下云印任务数据!</span>
  401. <span style="float: right;">共<i id="task_count">0</i>条任务,<i id="total_print_num">0</i>份云印任务</span>
  402. </div>
  403. <table style="margin-top: 15px;" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable">
  404. <thead>
  405. <tr>
  406. <th>序号</th>
  407. <th>任务名称</th>
  408. <th>班级</th>
  409. <th>已生成/已开通/可下载</th>
  410. <th>已下载</th>
  411. <th>云印份数</th>
  412. <th>备注</th>
  413. </tr>
  414. </thead>
  415. <tbody id="taskList">
  416. </tbody>
  417. </table>
  418. <div style="margin-top: 40px;">
  419. <span><img width="20px" height="20px" src="/images/icon-tip.svg">发送后,请至学管端【IMS-云印任务】模块查看任务进程,请等待云印中心打印后,寄回给学校!</span>
  420. <span style="margin-left:15px;float: right;"><input id="filter-uploaded" checked="checked" type="checkbox">过滤【已下载】的学生</span>
  421. </div>
  422. <div class="btn_area" style="text-align: center;">
  423. <input type="hidden" id="sendJson" name="sendJson" value="">
  424. <button id="sendCloudPrint" class="download">发送</button>
  425. <button class="cancel">取消</button>
  426. </div>
  427. </div>
  428. </div>
  429. </div>
  430. <!-- PAGE CONTENT ENDS -->
  431. </div>
  432. </div>
  433. </div>
  434. </div>
  435. <?php include(Yii::app()->basePath.'/views/print/_print.php');?>
  436. <script src="/js/jquery.ajaxfileupload.js"></script>
  437. <script type="text/javascript">
  438. $(document).ready(function(){
  439. });
  440. $('#limit').change(function () {
  441. window.location.href = $("#limit option:selected").attr('data-url');
  442. });
  443. function objToJson(obj){
  444. var json = "{ ";
  445. for(var item in obj){
  446. json += "'"+item+"':'"+obj[item]+"',";
  447. }
  448. json += " }";
  449. return json;
  450. }
  451. function ccc(){
  452. layer.msg('敬请期待!', {
  453. time: 0,
  454. btn: ['确定', '取消'],
  455. yes: function(index){
  456. layer.close(index);
  457. return false;
  458. }
  459. });
  460. }
  461. // 搜索事件
  462. $("#search").click(function(){
  463. $("#form1").submit();
  464. });
  465. function printWeek(reportId){
  466. if (!reportId) {
  467. layer.msg("打印参数有误");return;
  468. }
  469. var message = "您确定要下载该班级假期报告吗?";
  470. var divTitle = '下载假期报告';
  471. var objUrl = '';
  472. html = ""+
  473. '<div style="padding:20px 30px 0px 30px">'+
  474. '<div style="padding:8px 0;">请复制下方链接下载假期报告。</div>'+
  475. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>'+
  476. '<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>'+
  477. '</div>'+
  478. '</div>'+
  479. "";
  480. layer.msg(message, {
  481. time: 0,
  482. btn: ['确定', '取消'],
  483. yes: function(index){
  484. layer.close(index);
  485. $.ajax({
  486. url: "<?php echo $this->createUrl('productdownload/getHolidayReportFile');?>",
  487. type: "GET",
  488. dataType: "json",
  489. title: divTitle,
  490. data: {"reportId": reportId},
  491. timeout: <?php echo Yii::app()->params["product_download_time_limit"];?>,
  492. beforeSend:function(){
  493. layer.msg("下载中请稍后...",{"time": <?php echo Yii::app()->params["product_download_time_limit"];?>});
  494. },
  495. error: function (jqXHR, textStatus, errorThrown) {
  496. layer.closeAll();
  497. if(textStatus=="timeout"){
  498. $.ajax({
  499. type:'GET',
  500. url: "<?php echo $this->createUrl("productdownload/addHolidayReportTask");?>",
  501. data: {"reportId": reportId},
  502. dataType: "json",
  503. success:function (data) {
  504. console.log(data)
  505. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!',{
  506. icon: 1,
  507. yes:function(){
  508. layer.closeAll();
  509. }
  510. });
  511. }
  512. })
  513. }else {
  514. layer.msg('返回失败!',{
  515. icon: 5
  516. }, function(){
  517. layer.closeAll();
  518. });
  519. }
  520. },
  521. success: function (data){
  522. layer.closeAll();
  523. if(data.success == 1||data.success == 2){
  524. layer.open({
  525. type: 1,
  526. area: ['550px', '220px'],
  527. title: divTitle,
  528. content: html,
  529. success: function(index, layerObj){
  530. 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>');
  531. jQuery("#confirm, #cancel").on("click", function(){
  532. layer.close(layerObj);
  533. });
  534. jQuery("#copy").on("click", function(){
  535. jQuery("#url").select();
  536. });
  537. },
  538. end: function(){
  539. }
  540. });
  541. }else if(data.success == 3){
  542. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!',{
  543. icon: 1,
  544. yes:function(){
  545. layer.closeAll();
  546. }
  547. });
  548. }
  549. else if(data.success == 0){
  550. layer.msg(data.message, {"time": 3000});
  551. }
  552. },
  553. });
  554. }
  555. });
  556. }
  557. //发送云印任务
  558. function sendCloudTask(reportId,isDisable){
  559. if(isDisable === 1){
  560. return false;
  561. }
  562. //$('.confirmbox-mask').show();return false;
  563. if (!reportId) {
  564. layer.msg("参数有误");return;
  565. }
  566. var saveDataAry=[];
  567. var data1={"reportId": reportId};
  568. saveDataAry.push(data1);
  569. $.ajax({
  570. type: "POST",
  571. url: "<?php echo $this->createUrl("printCloud/generateHolidayExport");?>",
  572. dataType: "json",
  573. contentType: "application/json",
  574. data: JSON.stringify(saveDataAry),
  575. beforeSend:function(){
  576. layer.load(1, {
  577. shade: [0.1,'#fff'] //0.1透明度的白色背景
  578. });
  579. },
  580. success:function(data) {
  581. var index = layer.load();
  582. layer.close(index);
  583. if (data.status == 1) {
  584. $('#sendJson').attr('value', JSON.stringify(data));
  585. var con = '';
  586. var task_count = 0;
  587. var totalCount = 0;
  588. $.each(data.data, function(index, item) {
  589. var one_count = item.enable_download_count - item.download_count;
  590. totalCount += (one_count>0?one_count:0);
  591. if((item.enable_download_count - item.download_count)>0) {
  592. task_count += 1;
  593. }
  594. con += '<tr><td>' + (index + 1) + '</td><td>' + item.taskName + '</td><td>' + item.clazzName + '</td><td>'
  595. + 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>'
  596. + item.download_count + '</td><td>' + (one_count>0?one_count:0) + '</td><td>' + (one_count>0?'可发送':'不可发送')
  597. + '</td></tr>'
  598. });
  599. $('#task_count').html(task_count);
  600. $('#total_print_num').html(totalCount);
  601. $('#taskList').html(con);
  602. $('#filter-uploaded').prop("checked", true)
  603. $('.confirmbox-mask').show();
  604. } else if (data.status == 0) {
  605. layer.msg(data.message);
  606. }
  607. }
  608. }
  609. );
  610. }
  611. //批量发送云印任务
  612. $("#selectPrint").click(function() {
  613. // 判断是否有选中
  614. if (!$("input[class='ace myselect']").is(':checked')) {
  615. layer.msg('至少选择一个目标!');
  616. return false;
  617. }
  618. var result = [];
  619. $(".myselect").each(function(m,n){
  620. if ($(this).prop('checked')) {
  621. if ($(this).val() /*&& $(this).attr("stnm")*/) {
  622. result.push($(this).val());
  623. }
  624. }
  625. });
  626. var saveDataAry=[];
  627. var data1 = [];
  628. for(i=0;i<result.length;i++)
  629. {
  630. var reportId = result[i];
  631. data1 = {"reportId": reportId};
  632. saveDataAry.push(data1);
  633. }
  634. $.ajax({
  635. type: "POST",
  636. url: "<?php echo $this->createUrl("printCloud/generateHolidayExport");?>",
  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>'
  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').prop("checked", true);
  668. $('.confirmbox-mask').show();
  669. } else if (data.status == 0) {
  670. layer.msg(data.message);
  671. }
  672. }
  673. }
  674. );
  675. });
  676. // 全选\反选
  677. $(".selectAll").click(function(){
  678. if ($(this).prop("checked")) {
  679. var s_obj = $(".myselect");
  680. var s_len = s_obj.length;
  681. for (var i=0;i<s_len;i++) {
  682. if (!s_obj[i].disabled) {
  683. s_obj[i].checked=true;
  684. }
  685. }
  686. } else {
  687. $(".myselect").prop("checked",false);
  688. }
  689. });
  690. //过滤已下载学生
  691. $('#filter-uploaded').click(function () {
  692. if($(this).is(':checked')){
  693. var totalCount = 0;
  694. var task_count = 0;
  695. $('#taskList tr').each(function () {
  696. var enable_count = parseInt($(this).children("td:eq(3)").children('i').html());
  697. var dowanload_count = parseInt($(this).children("td:eq(4)").html());
  698. $(this).children("td:eq(5)").html((enable_count-dowanload_count)>0?(enable_count-dowanload_count):0);
  699. totalCount += ((enable_count-dowanload_count)>0?(enable_count-dowanload_count):0);
  700. if((enable_count-dowanload_count)==0){
  701. $(this).children("td:eq(6)").html('不可发送');
  702. }else{
  703. $(this).children("td:eq(6)").html('可发送');
  704. task_count += 1;
  705. }
  706. });
  707. $('#task_count').html(task_count);
  708. $('#total_print_num').html(totalCount)
  709. }else {
  710. var totalCount = 0;
  711. var task_count = 0;
  712. $('#taskList tr').each(function () {
  713. var enable_count = $(this).children("td:eq(3)").children('i').html();
  714. $(this).children("td:eq(5)").html(enable_count);
  715. totalCount += parseInt(enable_count);
  716. if(enable_count==0){
  717. $(this).children("td:eq(6)").html('不可发送');
  718. }else{
  719. $(this).children("td:eq(6)").html('可发送');
  720. task_count += 1;
  721. }
  722. });
  723. $('#task_count').html(task_count);
  724. $('#total_print_num').html(totalCount);
  725. $('#filter-uploaded').attr('isFilter',0)
  726. }
  727. });
  728. //发送云印任务(真正发送)
  729. $('#sendCloudPrint').click(function (){
  730. var task_count = parseInt($('#task_count').html());
  731. if(task_count === 0){
  732. layer.msg('没有可发送的任务');
  733. return false;
  734. }
  735. var json_data = $('#sendJson').val();
  736. var is_filter = $('#filter-uploaded').is(':checked') ? 1 : 0;
  737. $.post({
  738. url: "<?php echo $this->createUrl("printCloud/sendHolidayReport");?>",
  739. data: {
  740. 'json_data' : json_data,
  741. 'is_filter' : is_filter,
  742. },
  743. dataType: "json",
  744. beforeSend:function(){
  745. layer.load(1, {
  746. shade: [0.1,'#fff'] //0.1透明度的白色背景
  747. });
  748. },
  749. success:function(data) {
  750. var index = layer.load();
  751. layer.close(index);
  752. if (data.status == 1) {
  753. layer.msg('操作成功,请耐心等待后台打包');
  754. $('.confirmbox-mask').hide();
  755. location.reload();
  756. } else if (data.status == 0) {
  757. layer.msg(data.message);
  758. }
  759. }
  760. });
  761. });
  762. $('.confirmbox-mask .icon-close-1').click(function () {
  763. $('.confirmbox-mask').hide();
  764. });
  765. $('.confirmbox-mask .cancel').click(function () {
  766. $('.confirmbox-mask').hide();
  767. });
  768. //批量下载
  769. $("#batchPrint").click(function(){
  770. var message = "您确定要批量下载该班级假期报告吗?";
  771. // 判断是否有选中
  772. if (!$("input[class='ace myselect']").is(':checked')) {
  773. layer.msg('至少选择一个目标!');
  774. return false;
  775. }
  776. var result = [];
  777. $(".myselect").each(function(m,n){
  778. if ($(this).prop('checked')) {
  779. if ($(this).val() /*&& $(this).attr("stnm")*/) {
  780. result.push($(this).val());
  781. }
  782. }
  783. });
  784. var saveDataAry=[];
  785. var data1 = [];
  786. for(i=0;i<result.length;i++)
  787. {
  788. var reportId = result[i];
  789. data1 = {"reportId": reportId};
  790. saveDataAry.push(data1);
  791. }
  792. layer.msg(message, {
  793. time: 0,
  794. btn: ['确定', '取消'],
  795. yes: function(index){
  796. layer.close(index);
  797. $.ajax({
  798. type: "POST",
  799. url: "<?php echo $this->createUrl('productdownload/batchHoliday');?>",
  800. dataType: "json",
  801. contentType: "application/json",
  802. data: JSON.stringify(saveDataAry),
  803. success: function (data){
  804. layer.closeAll();
  805. if(data.success == 1) {
  806. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!', {
  807. icon: 1,
  808. yes: function () {
  809. layer.closeAll();
  810. }
  811. });
  812. }else {
  813. layer.msg(data.message);
  814. }
  815. },
  816. });
  817. }
  818. });
  819. });
  820. //批量重置
  821. $("#batchUpdate").click(function(){
  822. var semester_id = $("select[name='semesterId']").val();
  823. if(semester_id){
  824. var reset_time = <?php echo $reset_time;?>;
  825. if(reset_time > 4){
  826. layer.msg('重置次数不能超过5次!');
  827. }else{
  828. layer.msg('一学期最多更新5次,还剩余'+(5-reset_time)+'次', {
  829. time: 0,
  830. btn: ['确定', '取消'],
  831. yes: function(index){
  832. $.ajax({
  833. type: "POST",
  834. url: "<?php echo $this->createUrl("export/ajaxBatchResetHoliday");?>",
  835. dataType: "json",
  836. //contentType: "application/json",
  837. data: {semster_id:semester_id},
  838. beforeSend:function(){
  839. // layer.load(1, {
  840. // shade: [0.1,'#fff'] //0.1透明度的白色背景
  841. // });
  842. },
  843. success:function(data) {
  844. if (data.status == 1) {
  845. window.location.reload();
  846. } else if (data.status == 0) {
  847. layer.msg(data.result);
  848. }
  849. }
  850. });
  851. }
  852. });
  853. }
  854. }else{
  855. layer.msg("请选择学期");
  856. }
  857. });
  858. //重置假期报告
  859. function resetReport(reportId,classId,semsterId,resetTimes){
  860. if(resetTimes > 2){
  861. layer.msg('重置次数不能超过3次!');
  862. }else{
  863. layer.msg('一学期最多更新3次,还剩余'+(3-resetTimes)+'次', {
  864. time: 0,
  865. btn: ['确定', '取消'],
  866. yes: function(index){
  867. $.ajax({
  868. type: "POST",
  869. url: "<?php echo $this->createUrl("export/ajaxResetHolidayReport");?>",
  870. dataType: "json",
  871. //contentType: "application/json",
  872. data: {class_id:classId,report_id:reportId,semster_id:semsterId},
  873. beforeSend:function(){
  874. // layer.load(1, {
  875. // shade: [0.1,'#fff'] //0.1透明度的白色背景
  876. // });
  877. },
  878. success:function(data) {
  879. if (data.status == 1) {
  880. window.location.reload();
  881. } else if (data.status == 0) {
  882. layer.msg(data.result);
  883. }
  884. }
  885. });
  886. }
  887. });
  888. }
  889. }
  890. //重置假期报告确认
  891. </script>