holiday_teacher_index.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  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: #40c180;
  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 #01B677;
  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_teacher_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" onclick="location.href='<?php echo $this->createUrl('export/holiday_index');?>'">学生产品</span>
  262. <span class="tab_btn has-sel">教师产品</span>
  263. </div>
  264. <select class="form-control" id="semesterId" name="semesterId">
  265. <?php foreach($semsters as $semster){?>
  266. <option <?php if((string)$semsterId === (string)$semster["semester_id"]) echo "selected=selected";?> value="<?php echo $semster["semester_id"];?>"><?php echo $semster["semester_name"];?></option>
  267. <?php }?>
  268. </select>
  269. <input type="text" placeholder="请输入教师姓名" name="teacher_name" value="<?php echo isset($teacher_name)?$teacher_name:'';?>">
  270. <button class="label-primary-s bth-s" id="search" style="padding:4px 12px;">搜索</button>
  271. <span style="font-size:13px;padding-left:2px;color:red;">
  272. 提示:数据更新要第2天下载,请提前一天更新。报告生成保存7天,7天后请重新下载
  273. </span>
  274. <span class="fr ">
  275. <?php // if(isset($is_all_pdf) && $is_all_pdf):?>
  276. <span style="color:red">
  277. <?php // if(isset($create_time) && $create_time):?>
  278. <?php // echo date("m月d日",$create_time+86400).'已更新';?>
  279. <?php // endif;?>
  280. </span>
  281. <?php // else:?>
  282. <span style="color:red">
  283. <?php // if(isset($create_time) && $create_time):?>
  284. <?php // echo date("m月d日",$create_time).'已重置,更新报告需1-2天,正在更新';?>
  285. <?php // endif;?>
  286. </span>
  287. <?php // endif;?>
  288. <a id="batchUpdate" href="javascript:void(0);" class="btn-garder">批量更新</a>
  289. <a id="batchPrint" href="javascript:void(0);" class="btn-garder">批量下载</a>
  290. </span>
  291. </div>
  292. </div>
  293. </form>
  294. </div>
  295. <table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable" style="font-size:12px">
  296. <thead>
  297. <tr>
  298. <th class="center">
  299. <input type="checkbox" class="ace selectAll" />
  300. </th>
  301. <th>生成日期</th>
  302. <th>教师姓名</th>
  303. <th>登陆账号</th>
  304. <th>执教班级</th>
  305. <th>报告生成数</th>
  306. <th>操作</th>
  307. </tr>
  308. </thead>
  309. <tbody>
  310. <?php if(!empty($printList)):foreach($printList as $cl):?>
  311. <?php if(!$cl['teacher_id']){continue;}?>
  312. <tr>
  313. <td>
  314. <?php if(Yii::app()->cache->getValue("cloud_print_holiday_report_".$cl['report_id']) != 1){?>
  315. <input type="checkbox" class="ace myselect" value="<?php echo $cl['report_id'];?>">
  316. <?php }?>
  317. </td>
  318. <td><?php echo isset($cl['build_time'])?$cl['build_time']:"";?></td>
  319. <td><?php echo isset($cl['teacher_name'])?$cl['teacher_name']:'';?></td>
  320. <td><?php echo isset($cl['phone_number'])?$cl['phone_number']:'';?></td>
  321. <td style="width:1000px"><?php echo isset($cl['class_name'])?$cl['class_name']:'';?></td>
  322. <td><?php echo isset($cl['pdf_count'])?$cl['pdf_count']:'';?></td>
  323. <td style="width:265px;">
  324. <!-- 发送云印任务 -->
  325. <span style=" display: inline-block;
  326. width: 28px;
  327. height: 28px;
  328. vertical-align: -1px;
  329. padding: 2px;" class="iconfont click-sc addbx" aria-hidden="true" title="更新pdf" onclick="resetReport('<?php echo (string)$cl['report_id'];?>','<?php echo (string)$cl['teacher_id'];?>','<?php echo (string)$cl['semester_id'];?>')"><img src="/images/report-reset.png" style="width: 65%;
  330. height: auto;"/></span>
  331. <span class="iconfont click-sc addbx" aria-hidden="true" title="下载假期报告" onclick="printWeek('<?php echo (string)$cl['report_id'];?>')">&#xe6bb;</span>
  332. </td>
  333. </tr>
  334. <?php endforeach;else:?>
  335. <tr><td colspan="8">暂无数据!</td></tr>
  336. <?php endif;?>
  337. </tbody>
  338. </table>
  339. <?php if(!empty($page_total)):?>
  340. <div class="row">
  341. <div class="col-xs-6">
  342. &nbsp;
  343. </div>
  344. <div class="col-xs-6">
  345. <div class="dataTables_paginate paging_simple_numbers">
  346. <select class="form-control" id="limit" name="limit">
  347. <option value="10" <?php if($limit == 10) echo "selected";?> data-url="<?php echo $this->createUrl("export/holiday_teacher_index",array('limit'=>10));?>">10</option>
  348. </select>
  349. <?php
  350. $this->widget('CLinkPager', array(
  351. 'header' => '',
  352. 'firstPageLabel'=> '首页',
  353. 'lastPageLabel' => '末页',
  354. 'prevPageLabel' => '上一页',
  355. 'nextPageLabel' => '下一页',
  356. 'pages' => $pages,
  357. 'maxButtonCount'=> 5,
  358. ));
  359. echo '共:'.$page_total.'条';
  360. ?>
  361. </div>
  362. </div>
  363. </div>
  364. <?php endif;?>
  365. </div>
  366. <!--上传模板弹窗-->
  367. <!--发送云印任务弹窗-->
  368. <!-- PAGE CONTENT ENDS -->
  369. </div>
  370. </div>
  371. </div>
  372. </div>
  373. <script src="/js/jquery.ajaxfileupload.js"></script>
  374. <script type="text/javascript">
  375. $(document).ready(function(){
  376. });
  377. $('#limit').change(function () {
  378. window.location.href = $("#limit option:selected").attr('data-url');
  379. });
  380. // 搜索事件
  381. $("#search").click(function(){
  382. $("#form1").submit();
  383. });
  384. function printWeek(reportId){
  385. if (!reportId) {
  386. layer.msg("打印参数有误");return;
  387. }
  388. var message = "您确定要下载该教师版假期报告吗?";
  389. var objUrl = '';
  390. html = ""+
  391. '<div style="padding:20px 30px 0px 30px">'+
  392. '<div style="padding:8px 0;">请复制下方链接下载好题本。</div>'+
  393. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>'+
  394. '<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>'+
  395. '</div>'+
  396. '</div>'+
  397. "";
  398. layer.msg(message, {
  399. time: 0,
  400. btn: ['确定', '取消'],
  401. yes: function(index){
  402. layer.close(index);
  403. msgIndex = layer.msg("下载中请稍后...", {"time": 3600000});
  404. startTime = (new Date()).getTime();
  405. showTip = true;
  406. tipShowed = false;
  407. toPromptTime = 3000;
  408. window.interval = setInterval(function(){
  409. execTime = (new Date()).getTime() - startTime;
  410. if(execTime > toPromptTime && showTip && !tipShowed){
  411. msgIndex = layer.msg("该文件较大,请耐心等待...", {"time": 3600000});
  412. tipShowed = true;
  413. }
  414. }, 1000);
  415. jQuery.get(
  416. "<?php echo $this->createUrl("productdownteacher/getTeacherHolidayFile");?>",
  417. {"reportId": reportId},
  418. function(data){
  419. data = JSON.parse(data);
  420. if(data.success == 1||data.success == 2){
  421. layer.open({
  422. type: 1,
  423. area: ['550px', '220px'],
  424. title: "下载教师版假期报告",
  425. content: html,
  426. success: function(index, layerObj){
  427. clearInterval(window.interval);
  428. msgIndex = layer.msg(data.limitinfo, {"time": 3000});
  429. clearInterval(window.interval);
  430. layer.close(msgIndex);
  431. 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>');
  432. jQuery("#confirm, #cancel").on("click", function(){
  433. layer.close(layerObj);
  434. });
  435. jQuery("#copy").on("click", function(){
  436. jQuery("#url").select();
  437. });
  438. },
  439. end: function(){
  440. }
  441. });
  442. }
  443. else if(data.success == 0){
  444. clearInterval(window.interval);
  445. msgIndex = layer.msg(data.message, {"time": 3000});
  446. }
  447. }
  448. );
  449. }
  450. });
  451. }
  452. // 全选\反选
  453. $(".selectAll").click(function(){
  454. if ($(this).prop("checked")) {
  455. var s_obj = $(".myselect");
  456. var s_len = s_obj.length;
  457. for (var i=0;i<s_len;i++) {
  458. if (!s_obj[i].disabled) {
  459. s_obj[i].checked=true;
  460. }
  461. }
  462. } else {
  463. $(".myselect").prop("checked",false);
  464. }
  465. });
  466. //批量下载
  467. $("#batchPrint").click(function(){
  468. var message = "您确定要批量下载教师版假期报告吗?";
  469. // 判断是否有选中
  470. if (!$("input[class='ace myselect']").is(':checked')) {
  471. layer.msg('至少选择一个目标!');
  472. return false;
  473. }
  474. var result = [];
  475. $(".myselect").each(function(m,n){
  476. if ($(this).prop('checked')) {
  477. if ($(this).val() /*&& $(this).attr("stnm")*/) {
  478. result.push($(this).val());
  479. }
  480. }
  481. });
  482. var reportId = "";
  483. for(i=0;i<result.length;i++)
  484. {
  485. reportId += result[i] + ",";
  486. }
  487. html = ""+
  488. '<div style="padding:20px 30px 0px 30px">'+
  489. '<div style="padding:8px 0;">请复制下方链接下载教师版假期报告。</div>'+
  490. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>'+
  491. '<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>'+
  492. '</div>'+
  493. '</div>'+
  494. "";
  495. layer.msg(message, {
  496. time: 0,
  497. btn: ['确定', '取消'],
  498. yes: function(index){
  499. layer.close(index);
  500. msgIndex = layer.msg("下载中请稍后...", {"time": 3600000});
  501. startTime = (new Date()).getTime();
  502. showTip = true;
  503. tipShowed = false;
  504. toPromptTime = 3000;
  505. window.interval = setInterval(function(){
  506. execTime = (new Date()).getTime() - startTime;
  507. if(execTime > toPromptTime && showTip && !tipShowed){
  508. msgIndex = layer.msg("该文件较大,请耐心等待...", {"time": 3600000});
  509. tipShowed = true;
  510. }
  511. }, 1000);
  512. jQuery.get(
  513. "<?php echo $this->createUrl("productdownteacher/getTeacherHolidayFile");?>",
  514. {"reportId": reportId},
  515. function(data){
  516. data = JSON.parse(data);
  517. if(data.success == 1||data.success == 2){
  518. layer.open({
  519. type: 1,
  520. area: ['550px', '220px'],
  521. title: "下载教师版假期报告",
  522. content: html,
  523. success: function(index, layerObj){
  524. clearInterval(window.interval);
  525. msgIndex = layer.msg(data.limitinfo, {"time": 3000});
  526. clearInterval(window.interval);
  527. layer.close(msgIndex);
  528. 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>');
  529. jQuery("#confirm, #cancel").on("click", function(){
  530. layer.close(layerObj);
  531. });
  532. jQuery("#copy").on("click", function(){
  533. jQuery("#url").select();
  534. });
  535. },
  536. end: function(){
  537. }
  538. });
  539. }
  540. else if(data.success == 0){
  541. clearInterval(window.interval);
  542. msgIndex = layer.msg(data.message, {"time": 3000});
  543. }
  544. }
  545. );
  546. }
  547. });
  548. });
  549. //批量重置
  550. $("#batchUpdate").click(function(){
  551. var semester_id = $("select[name='semesterId']").val();
  552. if(semester_id){
  553. layer.msg('确定要重置该学期的所有数据吗?', {
  554. time: 0,
  555. btn: ['确定', '取消'],
  556. yes: function(index){
  557. $.ajax({
  558. type: "POST",
  559. url: "<?php echo $this->createUrl("export/ajaxBatchResetHolidayTeacher");?>",
  560. dataType: "json",
  561. //contentType: "application/json",
  562. data: {semster_id:semester_id},
  563. beforeSend:function(){
  564. // layer.load(1, {
  565. // shade: [0.1,'#fff'] //0.1透明度的白色背景
  566. // });
  567. },
  568. success:function(data) {
  569. if (data.status == 1) {
  570. window.location.reload();
  571. } else if (data.status == 0) {
  572. layer.msg(data.result);
  573. }
  574. }
  575. });
  576. }
  577. });
  578. }else{
  579. layer.msg("请选择学期");
  580. }
  581. });
  582. //重置假期报告
  583. function resetReport(reportId,teacherId,semsterId){
  584. layer.msg('确定要重置该老师的数据吗?', {
  585. time: 0,
  586. btn: ['确定', '取消'],
  587. yes: function(index){
  588. $.ajax({
  589. type: "POST",
  590. url: "<?php echo $this->createUrl("export/ajaxResetHolidayTeacherReport");?>",
  591. dataType: "json",
  592. //contentType: "application/json",
  593. data: {teacher_id:teacherId,report_id:reportId,semster_id:semsterId},
  594. beforeSend:function(){
  595. // layer.load(1, {
  596. // shade: [0.1,'#fff'] //0.1透明度的白色背景
  597. // });
  598. },
  599. success:function(data) {
  600. if (data.status == 1) {
  601. window.location.reload();
  602. } else if (data.status == 0) {
  603. layer.msg(data.result);
  604. }
  605. }
  606. });
  607. }
  608. });
  609. }
  610. //重置假期报告确认
  611. </script>