holiday_report_stu.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <div class="main-content-inner">
  2. <!-- 导航栏开始-->
  3. <?php include(Yii::app()->basePath.'/views/layouts/view_production_navigation.php');?>
  4. <!-- 导航栏结束-->
  5. <div class="page-content">
  6. <div class="row" style="margin:0px">
  7. <div class="col-xs-12">
  8. <!-- PAGE CONTENT BEGINS -->
  9. <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
  10. <div class="row">
  11. <div class="col-xs-10">
  12. <form method="get" id="form1" action="<?php echo $this->createUrl("export/selectStuByHolidayReport",array("reportId" => $reportId));?>">
  13. <div class="dataTables_length" style="margin: 6px 0px;">
  14. <div class="dataTables_length">
  15. <label><input type="text" class="form-control input-sm" placeholder="请输入学生姓名" name="sname" value="<?php echo $sname;?>"></label>
  16. <button style="padding:4px 12px;"class="label-primary-s bth-s">搜索</button>
  17. </div>
  18. </div>
  19. </form>
  20. </div>
  21. <div class="col-xs-2">
  22. <div class="dataTables_filter" id="dynamic-table_filter" style="padding-top:15px">
  23. <a href="javascript:void(0);" class="btn label-primary-green btn-sm" id="selectPrint">
  24. <i style="font-style: normal;" class="fa fa-print"></i> 下载
  25. </a>
  26. <a href="javascript:void(0);" class="btn label-primary-green btn-sm" id="selectPrintToolsJqbg">
  27. <i style="font-style: normal;" class="fa fa-print"></i> 打印
  28. </a>
  29. </div>
  30. </div>
  31. </div>
  32. <div class="row">
  33. <div class="col-xs-12" style="font-weight:bold;padding:0px 15px">
  34. <?php echo isset($name)?$name:'';?>
  35. </div>
  36. </div>
  37. <table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable" style="font-size:12px">
  38. <thead>
  39. <tr>
  40. <th class="center">
  41. <input type="checkbox" class="ace selectAll">
  42. </th>
  43. <th>序号</th>
  44. <th>假期报告名称</th>
  45. <th>学生名称</th>
  46. <th>学生编号</th>
  47. <th>是否生成</th>
  48. <th>下载功能</th>
  49. </tr>
  50. </thead>
  51. <tbody>
  52. <?php if(isset($list) && $list):foreach($list as $k=>$rt):?>
  53. <tr>
  54. <td class="center">
  55. <?php if (($rt['is_pdf'] == 1 || 1==1)) { ?>
  56. <input type="checkbox" class="ace myselect" value="<?php echo $rt['stu_id'];?>" stnm="<?php echo $rt['stu_name'];?>">
  57. <?php } else { ?>
  58. <input type="checkbox" disabled='disabled' class="ace myselect" value="<?php echo $rt['stu_id'];?>" stnm="<?php echo $rt['stu_name'];?>">
  59. <?php } ?>
  60. </td>
  61. <td><?php echo $k;?></td>
  62. <td><?php echo $rt['name'];?></td>
  63. <td><?php echo $rt['stu_name'];?></td>
  64. <td><?php echo $rt['stu_id'];?></td>
  65. <td>
  66. <?php if ($rt['is_pdf'] == 0): ?>
  67. <span class="label label-sm label-danger" style="font-size:12px">未生成</span> <!--红-->
  68. <?php elseif ($rt['is_pdf'] == 1): ?>
  69. <span class="label label-sm label-success" style="font-size:12px">已生成</span><!--绿-->
  70. <?php else: ?>
  71. <span class="label label-sm" style="font-size:12px;background-color:gray;">未知状态</span><!--灰-->
  72. <?php endif; ?>
  73. </td>
  74. <td>
  75. <?php
  76. if(isset($limitstu)){
  77. if($limitstu==0){
  78. echo '<span class="label label-sm label-success" style="font-size:12px">已开通</span>';
  79. }elseif($limitstu==-1){
  80. echo '<span class="label label-sm label-danger" style="font-size:12px">未开通</span>';
  81. }else{
  82. // if(isset($limitstu[$rt['stu_id']])){
  83. if(is_array($limitstu) && in_array($rt['stu_id'],$limitstu)){
  84. echo '<span class="label label-sm label-success" style="font-size:12px">已开通</span>';
  85. }else{
  86. echo '<span class="label label-sm label-danger" style="font-size:12px">未开通</span>';
  87. }
  88. }
  89. }else{
  90. echo '<span class="label label-sm label-danger" style="font-size:12px">未开通</span>';
  91. }
  92. ?>
  93. </td>
  94. </tr>
  95. <?php endforeach;else:?>
  96. <tr><td colspan="7">暂无数据!</td></tr>
  97. <?php endif;?>
  98. </tbody>
  99. </table>
  100. </div>
  101. <input type="hidden" name="reportId" id="reportId" value="<?php echo $reportId;?>" />
  102. <!-- PAGE CONTENT ENDS -->
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. <?php include(Yii::app()->basePath.'/views/print/_print.php');?>
  108. <script type="text/javascript">
  109. //type = "<?php // echo $type;?>";
  110. //if(type == "isp"){
  111. // type = 2;
  112. // improveName = "个性化学习方案";
  113. //}
  114. //else if(type == "studytrend"){
  115. // type = 3;
  116. // improveName = "个性化学习宝";
  117. //}
  118. //else if(type == "third_isp"){
  119. // type = 3;
  120. // improveName = "个性化学习宝";
  121. //}
  122. //else{
  123. // type = 0;
  124. //}
  125. html = ""+
  126. '<div style="padding:20px 30px 0px 30px">'+
  127. '<div style="padding:8px 0;">请复制下方链接下载假期报告。</div>'+
  128. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>'+
  129. '<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>'+
  130. '</div>'+
  131. '</div>'+
  132. "";
  133. $(function(){
  134. // 全选\反选
  135. $(".selectAll").on('click',function(event){
  136. if ($(this).prop("checked")) {
  137. var s_obj = $(".myselect");
  138. var s_len = s_obj.length;
  139. for (var i=0;i<s_len;i++) {
  140. if (!s_obj[i].disabled) {
  141. s_obj[i].checked=true;
  142. }
  143. }
  144. } else {
  145. $(".myselect").prop("checked",false);
  146. }
  147. });
  148. //
  149. //
  150. $("#selectPrint").click(function(){
  151. var reportId = $("#reportId").val();
  152. // 判断是否有选中
  153. if (!$("input[class='ace myselect']").is(':checked')) {
  154. layer.msg('请至少选择一个学生!');return false;
  155. }
  156. layer.msg("您确定下载假期报告吗?", {
  157. time: 0,
  158. btn: ['确定', '取消'],
  159. yes: function(index){
  160. layer.close(index);
  161. var result = [];
  162. $(".myselect").each(function(m,n){
  163. if ($(this).prop('checked')) {
  164. if ($(this).val() && $(this).attr("stnm")) {
  165. result.push($(this).val());
  166. }
  167. }
  168. })
  169. if (result.length < 1) {
  170. layer.msg('未找到要下载的学生!');return false;
  171. }
  172. $.ajax({
  173. url: "<?php echo $this->createUrl('productdownload/getHolidayReportFile');?>",
  174. type: "GET",
  175. dataType: "json",
  176. data: {"reportId": reportId, "studentsIds":result},
  177. timeout: <?php echo Yii::app()->params["product_download_time_limit"];?>,
  178. beforeSend:function(){
  179. layer.msg("下载中请稍后...",{"time": <?php echo Yii::app()->params["product_download_time_limit"];?>});
  180. },
  181. error: function (jqXHR, textStatus, errorThrown) {
  182. if(textStatus=="timeout"){
  183. $.ajax({
  184. type:'GET',
  185. url: "<?php echo $this->createUrl("productdownload/addHolidayReportTask");?>",
  186. data: {"reportId": reportId, "studentsIds":result},
  187. dataType: "json",
  188. success:function (data) {
  189. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!',{
  190. icon: 1,
  191. yes:function(){
  192. layer.closeAll();
  193. }
  194. });
  195. }
  196. })
  197. }else {
  198. layer.msg('返回失败!',{
  199. icon: 5
  200. }, function(){
  201. layer.closeAll();
  202. });
  203. }
  204. },
  205. success: function (data){
  206. layer.closeAll();
  207. if(data.success == 1||data.success == 2){
  208. layer.open({
  209. type: 1,
  210. area: ['550px', '220px'],
  211. title: "下载假期报告",
  212. content: html,
  213. success: function(index, layerObj){
  214. 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>');
  215. jQuery("#confirm, #cancel").on("click", function(){
  216. layer.close(layerObj);
  217. });
  218. jQuery("#copy").on("click", function(){
  219. jQuery("#url").select();
  220. });
  221. },
  222. end: function(){
  223. }
  224. });
  225. }else if(data.success == 3){
  226. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!',{
  227. icon: 1,
  228. yes:function(){
  229. layer.closeAll();
  230. }
  231. });
  232. }
  233. else if(data.success == 0){
  234. layer.msg(data.message, {"time": 3000});
  235. }
  236. },
  237. });
  238. }
  239. });
  240. });
  241. })
  242. </script>