123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- <link type="text/css" rel="stylesheet" href="/css/needDetail.css" />
- <style>
- dl.subject_list{clear: both;display: block;margin-top:5px;border:1px solid #ccc;padding:10px;height:120px;}
- dl.subject_list dd{float:left;margin:5px;}
- </style>
- <div class="main-content-inner">
- <!-- 导航栏开始-->
- <?php include(Yii::app()->basePath.'/views/layouts/class_navigation.php');?>
- <!-- 导航栏结束-->
- <div class="layout-gap">
- <section class="anc-top flex status_1" >
- <div class="flex-one flex">
- <p class="anc-title">走班学科设置</p>
- </div>
- <div class="anc-opt-btn green-font pointer reback" ><a href="<?php echo $this->createUrl('classes/index');?>?class_type=2">返回</a></div>
- </section>
- <section class="anc-main-con">
- <div class="begain-check-btn pointer add_btn">添加走班学科</div>
- <span class=" red-font">提示:走班的学科,无法再使用行政班考试了,请谨慎操作。</span>
- </section>
- <div class="handle-detail-main-excel">
- <table class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable">
- <tr>
- <td>学科</td>
- <td>年级</td>
- <td>状态</td>
- <td>操作</td>
- <tr>
- <?php
- $gradeArr=array(
- 1=>'高一',
- 2=>'高二',
- 3=>'高三'
- );
- if($setting){
- foreach ($setting as $val){
- ?>
- <tr>
- <td><?php echo Yii::app()->params['subjectId'][$val['subject_id']]?></td>
- <td><?php echo $gradeArr[$val['grade']]?></td>
- <td>
- <?php
- if($val['status']==1){
- echo '已启用';
- }else{
- echo ' 已禁用';
- }
- ?>
- </td>
- <td>
- <?php
- if($val['status']==1){
- echo '<button subject="'.$val['subject_id'].'" grade="'.$val['grade'].'" class="red-font set-disable">禁用</button>';
- }else{
- echo '<button subject="'.$val['subject_id'].'" grade="'.$val['grade'].'" class="set-enable">启用</button>';
- }
- ?>
- </td>
- </tr>
- <?php
- }
- }
- ?>
- </table>
- </div>
- </div>
- </div>
- <div class="history-pop">
- <div class="history-pop-con">
- <div class="need-pop-top clearfix">
- <div class="npt-title put-need fl">添加走班学科</div>
- <div class="npt-close fr">×</div>
- </div>
- <div>
- <p>实行走班的年级
- <select name="grade" class="grade">
- <option value="0">选择年级</option>
- <option value="1">高一</option>
- <option value="2">高二</option>
- <option value="3">高三</option>
- </select>
- </p>
- </div>
- <div class="">
- <p>实行走班的学科</p>
- <dl class="subject_list">
- <?php
- if($subject){
- foreach ($subject as $key => $val){
- echo '<dd ><input name="subject[]" class="subject" id="subject_'.$key.'" type="checkbox" value="'.$key.'">'.$val.'</dd>';
- }
- }
- ?>
- </dl>
- </div>
- <div class="pop-btns">
- <div class="confirm-pop-btn-sure">确认</div>
- </div>
- </div>
- </div>
- <script>
- $(function(){
- $('.add_btn').click(function(){
- $('.history-pop').show();
- });
- $('.npt-close').click(function(){
- $('.subject').prop('disabled',false);
- $('.subject').prop('checked',false);
- $('.grade').val(0);
- $('.history-pop').hide();
- })
- $('.confirm-pop-btn-sure').click(function(){
- var grade=$('.grade').val();
- var subject=[];
- var subjectObj=$('.subject');
- for(var i=0;i<subjectObj.length;i++){
- if(subjectObj.eq(i).is(':checked')){
- subject.push(subjectObj.eq(i).val());
- }
- }
- if(grade==0){
- layer.msg('请选择年级 ');
- return false;
- }
- if(subjectObj.length<1){
- layer.msg('请选择开通的科目');
- return false;
- }
- $.ajax({
- url:'<?php echo $this->createUrl('classes/addClassified')?>',
- type:'POST',
- data:{grade:grade,subject:subject},
- dataType:'json',
- success:function(res){
- if(res.status==1){
- layer.msg('操作成功')
- window.location.reload();
- }else{
- if(res.msg!=undefined){
- layer.msg(res.msg);
- }else{
- layer.msg('添加失败');
- }
- }
- }
- });
- });
- //启用
- $('.set-enable').click(function(){
- var grade=$(this).attr('grade'),
- subject=$(this).attr('subject');
- layer.confirm('您确认开启走班吗?', {
- btn: ['确定', '取消'] //按钮
- }, function () {
- $.ajax({
- url:'<?php echo $this->createUrl('classes/updateClassified')?>',
- type:'POST',
- dataType:'json',
- data:{grade:grade,subject:subject,type:'enable'},
- success:function(res){
- if(res.status==1){
- layer.msg('操作成功', {
- icon: 1,
- time: 2000 //2秒关闭(如果不配置,默认是3秒)
- }, function(){
- window.location.reload();
- });
- }else{
- layer.msg('操作失败');
- }
- }
- })
- })
- })
- //启用
- $('.set-disable').click(function(){
- var grade=$(this).attr('grade'),
- subject=$(this).attr('subject');
- layer.confirm('您确认禁用走班吗?禁用后将使用行政班考试', {
- btn: ['确定', '取消'] //按钮
- }, function () {
- $.ajax({
- url:'<?php echo $this->createUrl('classes/updateClassified')?>',
- type:'POST',
- dataType:'json',
- data:{grade:grade,subject:subject,type:'disable'},
- success:function(res){
- if(res.status==1){
- layer.msg('操作成功', {
- icon: 1,
- time: 2000 //2秒关闭(如果不配置,默认是3秒)
- }, function(){
- window.location.reload();
- });
- }else{
- layer.msg('操作失败');
- }
- }
- })
- })
- })
- $('.grade').change(function(){
- var grade=$(this).val();
- if(grade!=0 && grade!=undefined){
- $('.subject').prop('disabled',false);
- $('.subject').prop('checked',false);
- $.ajax({
- url:'<?php echo $this->createUrl('classes/getClassSubjectByGrade')?>',
- type:'POST',
- dataType:'json',
- data:{grade:grade,rtype:'arr'},
- success:function(res){
- if(res.status==1){
- console.log(res.data.length);
- for(var i=0;i<res.data.length;i++){
- $('#subject_'+res.data[i]).prop('disabled',true);
- }
- }
- }
- })
- }
- })
- })
- </script>
|