index.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. <script src="/js/xsgl.js" xmlns="http://www.w3.org/1999/html"></script>
  2. <style>
  3. .diy_select_list li{padding-left:0px;}
  4. .layer-zd{
  5. padding: 15px 40px;
  6. }
  7. #report-class-bulid{
  8. width: 75px;
  9. line-height: 25px;
  10. border-radius: 3px;
  11. float: right;
  12. color: #fff;
  13. background-color: #12985b !important;
  14. border: none;
  15. outline: none;
  16. }
  17. .table-zd{
  18. margin-top:15px;
  19. width: 100%;
  20. line-height: 30px;
  21. text-align: center;
  22. }
  23. .page-zd{
  24. margin: 15px;
  25. text-align: center;
  26. }
  27. .layui-layer-title{
  28. font-size: 18px;
  29. color: #fff;
  30. background-color: #12985b !important;
  31. }
  32. </style>
  33. <script type="text/javascript">
  34. jQuery(document).ready(function(){
  35. jQuery(".delClass").click(function(){
  36. document.classId = jQuery(this).attr("classId");
  37. document.semesterId = "<?php echo $semesterId;?>";
  38. var msg = <?php echo Yii::app()->session["role"] ? Yii::app()->session["role"] : 1;?> == 2 ? "删除班级会将班级下学生一并删除,确定删除?" : "确定删除?";
  39. layer.msg(msg, {
  40. time: 0,
  41. btn: ['确定', '取消'],
  42. yes: function(index){
  43. layer.close(index);
  44. jQuery.post(
  45. "<?php echo $this->createUrl("classes/delclassact");?>",
  46. {"classId": document.classId, "semesterId":document.semesterId},
  47. function(data){
  48. data = eval("("+data+")");
  49. if(data.code == "0"){
  50. msg = data.msg;
  51. icon = 6;
  52. }
  53. else{
  54. msg = "因为以下原因操作失败:<br/>"+data.msg;
  55. icon = 5;
  56. }
  57. layer.alert(msg, {icon: icon}, function(){
  58. location.href = "<?php echo $this->createUrl("classes/index?semesterId={$semesterId}");?>";
  59. });
  60. }
  61. );
  62. }
  63. });
  64. });
  65. jQuery("#search").click(function(){
  66. //var semesterId = jQuery(this).val();
  67. var grade_id = jQuery(".diy_select1 input[name=grade_id]").val();
  68. var realname = jQuery("input[name=realname]").val();
  69. var smid = jQuery("input[name=semesters]").val();
  70. var arts_science=$("input[name=arts_science]").val();
  71. location.href = "<?php echo $this->createUrl("parent/index?grade_id=");?>"+grade_id+"&realname="+realname+"&semesterId="+smid+'&arts_science='+arts_science;
  72. });
  73. });
  74. </script>
  75. <link rel="stylesheet" href="/fonts/zhuanzhang/iconfont.css" />
  76. <link rel="stylesheet" href="/css/toTransferPop.css" />
  77. <div class="main-content-inner">
  78. <!-- 导航栏开始-->
  79. <?php include(Yii::app()->basePath.'/views/layouts/class_navigation.php');?>
  80. <!-- 导航栏结束-->
  81. <div class="page-content">
  82. <div class="row" style="margin:0px;">
  83. <div class="col-xs-12">
  84. <!-- PAGE CONTENT BEGINS -->
  85. <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
  86. <div class="row">
  87. <div class="dataTables_length margin-zy">
  88. <div class="col-xs-9" style="margin-bottom: 10px;">
  89. <div style="float: left;margin-top: 4px;">
  90. 按学期筛选:
  91. </div>
  92. <div class='diy_select' style="width:215px;">
  93. <input type='hidden' class='diy_select_input' name="semesters" id="semesters" value="<?php echo $semesterId;?>"/>
  94. <div class='diy_select_txt' style="width:182px;">
  95. <?php
  96. echo empty($thisSemester['semester_name']) ? '--请选择--':$thisSemester['semester_name'];
  97. if($this->schoolManager->isCurrentSemester($semesterId)){echo "(当前学期)";}
  98. else if($this->schoolManager->isFutureSemester($semesterId)){echo "(未开始学期)";}
  99. else{echo "(已完成学期)";}
  100. ?>
  101. </div>
  102. <div class='diy_select_btn'></div>
  103. <ul class='diy_select_list'>
  104. <?php foreach($semesters as $semester){?>
  105. <li val="<?php echo $semester->semester_id;?>">
  106. <?php echo $semester->semester_name;
  107. if($this->schoolManager->isCurrentSemester($semester->semester_id)){echo "(当前学期)";}
  108. else if($this->schoolManager->isFutureSemester($semester->semester_id)){echo "(未开始学期)";}
  109. else{echo "(已完成学期)";}
  110. ?>
  111. </li>
  112. <?php }?>
  113. </ul>
  114. </div>&nbsp;
  115. <div style="float: left;margin-top: 4px; padding-left: 5px;">
  116. 年级:
  117. </div>
  118. <div class='diy_select1' style="display: inline;margin-right: 5px;border: 1px solid #c9ccd2; width: 131px">
  119. <input type='hidden' id="grade_id" name="grade_id" class='diy_select_input1' value="<?php if(empty($grade_id)){echo 0;}else{echo $grade_id;}?>"/>
  120. <div class='diy_select_txt1'> <?php if(empty($grade_id)){echo '请选择年级';}else{echo Yii::app()->params['grade_list'][$grade_id]['grade_name'];}?></div>
  121. <div class='diy_select_btn1'></div>
  122. <ul class='diy_select_list1'>
  123. <li val="0" >请选择年级</li>
  124. <?php
  125. if(Yii::app()->params['grade_config']){
  126. foreach (Yii::app()->params['grade_config'] as $val){
  127. echo '<li val="'.$val['id'].'" >'.$val['grade_name'].'</li>';
  128. }
  129. }
  130. ?>
  131. </ul>
  132. </div>
  133. <?php if(Yii::app()->params['section']!=0):?>
  134. <div style="float: left;margin-top: 4px; padding-left: 5px;">
  135. 文理科:
  136. </div>
  137. <div class='diy_select2' style="display: inline;margin-right: 5px;border: 1px solid #c9ccd2; width: 131px">
  138. <input type='hidden' id="arts_science" name="arts_science" class='diy_select_input2' value="<?php if(empty($arts_science)){echo 0;}else{echo $arts_science;}?>"/>
  139. <div class='diy_select_txt2'><?php if(empty($arts_science)){echo '不限';}else{ switch($arts_science){
  140. case 1:echo '文科';break;
  141. case 2:echo '理科';break;
  142. }}?></div>
  143. <div class='diy_select_btn2'></div>
  144. <ul class='diy_select_list2'>
  145. <li val="0" >不限</li>
  146. <li val="1">文科</li>
  147. <li val="2">理科</li>
  148. </ul>
  149. </div>
  150. <?php else:?>
  151. <input type='hidden' id="arts_science" name="arts_science" class='diy_select_input2' value="0"/>
  152. <?php endif;?>
  153. <input type="text" class="form-control input-sm" placeholder="请输入教师姓名!" name="realname" value="<?php if(!empty($realname)){echo $realname;}?>">
  154. <button class="label-primary-s bth-s" id="search" style="padding:4px 12px;">搜索</button>
  155. </div>
  156. </div>
  157. <div id="download-excel" class="dataTables_filter" style="margin-right: 10px;">
  158. <a class="btn label-primary-green btn-sm" style="float:right;" href="<?php echo $this->createUrl('parent/excelinfo');?>">
  159. <i class="fa fa-plus" style="font-style: normal;"></i>批量上传教师
  160. </a>
  161. </div>
  162. </div>
  163. <table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable">
  164. <thead>
  165. <tr>
  166. <th>班级</th>
  167. <th>学期</th>
  168. <th>年级</th>
  169. <th>班主任</th>
  170. <th>学科教师人数</th>
  171. <th>学生人数</th>
  172. <th>学生绑定数量</th>
  173. <th>操作</th>
  174. </tr>
  175. </thead>
  176. <tbody>
  177. <?php if(!empty($yearsList)){foreach($yearsList as $cl){?>
  178. <tr>
  179. <td><?php echo $cl['class_name'];?></td>
  180. <td><?php echo $cl['name'];?></td>
  181. <td><?php echo Yii::app()->params['grade_list'][$cl['grade']]['grade_name'];?></td>
  182. <td><?php echo $cl['teachers_bzr']?></td>
  183. <td><?php echo $cl['teachers_count'];?></td>
  184. <td><?php echo $cl['student_count'];?></td>
  185. <td><?php echo $cl['student_bind_count'];?></td>
  186. <td><a href="<?php echo $this->createUrl("parent/view?cid=".$cl['class_id']);?>">详情</a></td>
  187. </tr>
  188. <?php }}else{?>
  189. <tr><td colspan="10">暂无数据!</td></tr>
  190. <?php }?>
  191. </tbody>
  192. </table>
  193. <?php if(!empty($page_total)):?>
  194. <div class="row">
  195. <div class="col-xs-7">
  196. &nbsp;
  197. </div>
  198. <div class="col-xs-5">
  199. <div class="dataTables_paginate paging_simple_numbers">
  200. <?php
  201. $this->widget('CLinkPager', array(
  202. 'header' => '',
  203. 'firstPageLabel'=> '首页',
  204. 'lastPageLabel' => '末页',
  205. 'prevPageLabel' => '上一页',
  206. 'nextPageLabel' => '下一页',
  207. 'pages' => $pages,
  208. 'maxButtonCount'=> 5,
  209. ));
  210. echo '共:'.$page_total.'条';
  211. ?>
  212. </div>
  213. </div>
  214. </div>
  215. <?php endif;?>
  216. </div>
  217. <!-- PAGE CONTENT ENDS -->
  218. </div>
  219. </div>
  220. </div>
  221. </div>
  222. <script src="/js/layer/layer.js"></script>
  223. <script type="text/javascript">
  224. $(document).ready(function(){
  225. var _one_select_class = [];
  226. var _two_select_class = [];
  227. var _three_select_class = [];
  228. $("#zhuanban").click(function(){
  229. $("#pop-zhuan").removeClass("dn");
  230. });
  231. //班级排序
  232. $("#change-class-sort").click(function(){
  233. $.ajax({
  234. type:'post',
  235. url: "<?php echo $this->createUrl('classes/getClassWithSort');?>",
  236. dataType: 'json',
  237. success: function (res) {
  238. var html = ''
  239. if (res.status){
  240. for (var i=0; i<res.data.length; i++) {
  241. var item = res.data[i];
  242. html += '<li class="tsd-lis clearfix" classId="'+item.class_id+'">';
  243. html += '<span class="rev-class prev-class-title ellipsis">'+item.class_name+'</span>';
  244. html += '<span class="fr current-class">';
  245. html += '<input type="number" style="width: 50px;height: 30px;text-align: center" name="sort" value="'+item.sort+'">';
  246. html += '</span></li>';
  247. }
  248. $('.class-list').html(html);
  249. $("#pop-sortClass").removeClass("dn");
  250. }else {
  251. layer.msg("暂无班级");
  252. }
  253. }
  254. })
  255. })
  256. $(".one_class").each(function(){
  257. var _this = $(this);
  258. _this.data("last",_this.val()).change(function(){
  259. var oldVal = _this.data("last");
  260. var newVal = _this.val();
  261. var temp = 0;
  262. for(var i=0;i<$(".one_class").length;i++){
  263. if($(".one_class").eq(i).val() == newVal){
  264. if(newVal!=0){
  265. temp++;
  266. if(temp>1){
  267. _this.val(oldVal);
  268. _this.data("last",oldVal);
  269. alert("不能重复选择班级")
  270. break;
  271. }
  272. }
  273. }else{
  274. _this.data("last",_this.val());
  275. }
  276. }
  277. })
  278. })
  279. $(".aline_one_class").each(function(){
  280. var _this = $(this);
  281. _this.data("alast",_this.val()).change(function(){
  282. var oldVal = _this.data("alast");
  283. var newVal = _this.val();
  284. var temp = 0;
  285. for(var i=0;i<$(".aline_one_class").length;i++){
  286. if($(".aline_one_class").eq(i).val() == newVal){
  287. if(newVal!=0){
  288. temp++;
  289. if(temp>1){
  290. _this.val(oldVal);
  291. _this.data("alast",oldVal);
  292. alert("不能重复选择班级")
  293. break;
  294. }
  295. }
  296. }else{
  297. _this.data("alast",_this.val());
  298. }
  299. }
  300. })
  301. })
  302. // 点击单选
  303. $("#pop-zhuan .ttf-radio-con li").click(function(){
  304. $(this).find(".sel-btn").addClass("select");
  305. $(this).siblings().find(".sel-btn").removeClass("select");
  306. $(this).closest(".ttf-tab-right").find(".ttf-sel-datas").hide().removeClass('hide');
  307. $(this).closest(".ttf-tab-right").find(".ttf-sel-datas").eq($(this).index()).show();
  308. });
  309. $("#pop-zhuan .ttf-radio-con.alone li").click(function(){
  310. $(this).find(".sel-btn.alone").addClass("select");
  311. $(this).siblings().find(".sel-btn.alone").removeClass("select");
  312. $(this).closest(".ttf-tab-right").find(".ttf-sel-datas").hide().removeClass('hide');
  313. $(this).closest(".ttf-tab-right").find(".ttf-sel-datas").eq($(this).index()).show();
  314. });
  315. // 内容切换
  316. $("#pop-zhuan .ttf-tog-menu").click(function(){
  317. // console.log($(this).index());
  318. $(this).addClass("active").siblings().removeClass("active");
  319. $(".ttf-tab-con").hide();
  320. $(".ttf-tab-con").eq($(this).index()).show().removeClass("hide");
  321. });
  322. // 点击关闭
  323. $(".ttf-close-btn").click(function(){
  324. $("select").val(0);
  325. $(".ttf-pop").addClass('dn');
  326. });
  327. });
  328. function cancelPay(cid){//alert(uid);return;
  329. if (!cid) return;
  330. layer.open({
  331. type: 2,
  332. skin: 'layui-layer-lan',
  333. title: '设置用户缴费',
  334. fix: false,
  335. shadeClose: true,
  336. maxmin: true,
  337. area: ['1000px', '500px'],
  338. content: "<?php echo $this->createUrl('classes/import');?>/cid/"+cid,
  339. });
  340. }
  341. function saveClassSort() {
  342. var classSort = [];
  343. $('input[name="sort"]').each(function () {
  344. var str = $(this).parent().parent().attr('classId')+'_'+$(this).val();
  345. classSort.push(str);
  346. });
  347. if(classSort.length==0){
  348. layer.msg("排序参数错误");
  349. return false;
  350. }
  351. $.ajax({
  352. type:'post',
  353. url: "<?php echo $this->createUrl('classes/saveClassSort');?>",
  354. data: {'classSort': classSort},
  355. dataType: 'json',
  356. success: function (res) {
  357. var html = ''
  358. if (res.status){
  359. $(".ttf-pop").addClass('dn');
  360. layer.alert('修改成功',{icon:1,closeBtn:0},function () {
  361. location.reload();
  362. })
  363. }else {
  364. layer.msg("修改失败");
  365. }
  366. }
  367. })
  368. }
  369. function classesMesByGradeAndPage(grade,page){
  370. if(!grade){
  371. grade = 1;
  372. }
  373. if(!page){
  374. page = 1;
  375. }
  376. $.ajax({
  377. type:'get',
  378. url: "<?php echo $this->createUrl('classes/ajaxGetClassesByGrade');?>",
  379. data:{grade:grade,page:page},
  380. dataType: 'json',
  381. success: function (res) {
  382. var html = ''
  383. if (res.status == 1){
  384. console.log(res.data);
  385. html += "<table border=1 class='table-zd'>";
  386. html += " <tr>";
  387. html += " <td><input type='checkbox' class='select-class-all'></td>";
  388. html += " <td>班级</td>";
  389. html += " <td>人数</td>";
  390. html += " <td>状态</td>";
  391. html += " <td>生成进度</td>";
  392. html += " </tr>";
  393. for(var i = 0;i<res.data.rs.length;i++){
  394. html += " <tr>";
  395. if(res.data.rs[i]['report_status'] == 0){
  396. if(res.data.rs[i]['stu_count'] > 0 ){
  397. html += " <td><input type='checkbox' class='select-class' classId='"+res.data.rs[i]['class_id']+"'></td>";
  398. }else{
  399. html += " <td><input type='checkbox' class='select-class' classId='"+res.data.rs[i]['class_id']+"' disabled='disabled'></td>";
  400. }
  401. }else{
  402. html += " <td><input type='checkbox' class='select-class' classId='"+res.data.rs[i]['class_id']+"' disabled='disabled'></td>";
  403. }
  404. html += " <td>"+res.data.rs[i]['class_name']+"</td>";
  405. html += " <td>"+res.data.rs[i]['stu_count']+"</td>";
  406. if(res.data.rs[i]['report_status'] == 0){
  407. html += " <td>未生成</td>";
  408. html += " <td>0/"+res.data.rs[i]['stu_count']+"</td>";
  409. }else if(res.data.rs[i]['report_status'] == 1){
  410. html += " <td>正在生成</td>";
  411. html += " <td>0/"+res.data.rs[i]['stu_count']+"</td>";
  412. }else if(res.data.rs[i]['report_status'] == 2){
  413. html += " <td>已生成</td>";
  414. html += " <td>"+res.data.rs[i]['stu_count']+"/"+res.data.rs[i]['stu_count']+"</td>";
  415. }
  416. html += " </tr>";
  417. }
  418. html += "</table>";
  419. html += '<div class="page-zd">';
  420. html += ' <div class="dataTables_paginate paging_simple_numbers">';
  421. html += res.data.pages_index;
  422. html +='共:'+res.data.page.rowsCount+'条';
  423. html += "</div>";
  424. html += "</div>";
  425. $(".class-data").html(html);
  426. }else {
  427. console.log(11);
  428. }
  429. }
  430. })
  431. }
  432. $("#year-report").click(function () {
  433. //通过年级页码获取班级信息
  434. var html = "";
  435. html += "<div class='layer-zd'>";
  436. html += "<select class='report-grade'>";
  437. html += "<option value='1'>高一</option>";
  438. html += "<option value='2'>高二</option>";
  439. html += "<option value='3'>高三</option>";
  440. html += "</select>";
  441. html += "<button id='report-class-bulid'>生成</button>";
  442. html += "<div class='class-data'></div>";
  443. html += "<div>";
  444. html += "<div class='notice-report-1'>注:</div>";
  445. html += "<div class='notice-report-2'>1、确认哪些班级需要使用学生年度账单,然后再勾选进行生成!</div>";
  446. html += "<div class='notice-report-3'>2、点击生成后,稍后再确认是否为“已生成”状态,只有已生成的班级才可以在班级列表中下载学生年度账单</div>";
  447. html += "</div>";
  448. html += "</div>";
  449. layer.open({
  450. type: 1,
  451. title: '生成年度账单',
  452. btn: [],
  453. area: ['640px', '500px'], //宽高
  454. btnAlign: 'c',
  455. content: html,
  456. btn2: function (index, layero) {
  457. }
  458. });
  459. classesMesByGradeAndPage(1,1);
  460. // alert(1);
  461. });
  462. $("body").delegate(".report-grade","change",function(){
  463. var grade = $(this).val();
  464. if(grade){
  465. classesMesByGradeAndPage(grade,1);
  466. }
  467. })
  468. $("body").delegate(".select-class-all","click",function(){
  469. if($(this).prop("checked")){
  470. $('.select-class').each(function(i){
  471. if(!$(this).prop("disabled")){
  472. $(this).prop("checked",true);
  473. }
  474. });
  475. }else{
  476. $('.select-class').prop("checked",false);
  477. }
  478. })
  479. $("body").delegate("#report-class-bulid","click",function(){
  480. var classIds = [];
  481. $(".select-class:checked").each(function(){
  482. classIds.push($(this).attr('classId'));
  483. });
  484. if(classIds.length>0){
  485. var url = "<?php echo $this->createUrl("classes/yearReport") ?>";
  486. $.post(url, {classId: classIds}, function(data) {
  487. var m = JSON.parse(data);
  488. console.log(m);
  489. if (m.status == 0)
  490. {
  491. } else
  492. {
  493. setTimeout(function() {
  494. $(".loading-pop").hide();
  495. }, 500);
  496. layer.msg(m.error)
  497. }
  498. });
  499. $(".select-class:checked").each(function(){
  500. $(this).prop("disabled",true);
  501. $(this).parent().parent().find("td:eq(3)").html("正在生成");
  502. });
  503. }
  504. })
  505. $("body").delegate(".page-zd ul li a","click",function(){
  506. var page = $(this).html();
  507. var grade = $(".report-grade").val();
  508. if(isNaN(page)){
  509. var current_page = parseInt($(".page-zd ul .selected").text());
  510. if(page == '下一页'){
  511. classesMesByGradeAndPage(grade,(current_page + 1));
  512. }else if(page == '上一页'){
  513. classesMesByGradeAndPage(grade,(current_page-1));
  514. }
  515. }else{
  516. classesMesByGradeAndPage(grade,page);
  517. }
  518. })
  519. function downfile(classId,status) {
  520. $(".loading-pop").show();
  521. if(status == 2){
  522. var msg = '是否确定下载该班级学生的年度使用报告吗?';
  523. layer.msg(msg, {
  524. time: 0,
  525. btn: ['确定', '取消'],
  526. yes: function(index){
  527. layer.close(index);
  528. location.href="<?php echo $this->createUrl("classes/down_load_yearreport")?>"+"?classId="+classId;
  529. }
  530. });
  531. }else{
  532. layer.msg('账单未生成');
  533. }
  534. var url = "<?php echo $this->createUrl("classes/yearReport") ?>";
  535. }
  536. $(function(){
  537. $('#uploadFile').val('');
  538. $('.select_file').click(function(){
  539. $('#uploadFile').click();
  540. });
  541. $('#uploadFile').change(function(){
  542. if($('#uploadFile').val()!=''){
  543. $('#form1').submit();
  544. }
  545. });
  546. })
  547. </script>