123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620 |
- <link type="text/css" rel="stylesheet" href="/css/needDetail.css" />
- <link type="text/css" rel="stylesheet" href="/js/select/select2.min.css" />
- <style>
- .addborder{border:1px solid #ccc}
- .addheight{height:30px;border-radius:2px;}
- .addheight:focus{border-color: #66afe9;box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(102, 175, 233, 0.6);outline: 0 none;}
- .ace{position:relative;top:0px !important;left:0px !important;}
- label{font-weight:100 !important;}
- /* #coach_id-error{position: absolute;right:-80px;top:5px;}
- #level_name-error{position: absolute;right:-80px;top:5px;}
- #material_id-error{position: absolute;right:-110px;top:5px;}
- #class_name-error{margin: 6px 0px 0px 18px;font-size:13px;} */
- .clearfix:after {
- content: "";
- display: block;
- visibility: hidden;
- height: 0;
- clear: both;
- }
- .clearfix {
- zoom: 1;
- }
- .fl {
- float: left;
- }
- .fr {
- float: right;
- }
- em{
- color: #FF000C;
- margin-right: 4px;
- }
- .bm-name{
- width: 100px;
- text-align: right;
- // border: 1px solid #000;
- }
- .bm-inp-con{
- width: 170px;
- }
- .basic-message select{
- width: 160px;
- height: 26px;
- }
- .basic-message input{
- width: 156px;
- height: 22px;
- }
- .basic-message{
- padding: 10px 0;
- }
- .th-describe{
- margin-top: 10px;
- }
- .th-describe span{
- color: #FF000C;
- }
- table{
- width: 800px;
- border-color: #fff;
- text-align: center;
- font-size: 14px;
- margin-top: 10px;
- }
- thead{
- background: #F2F2F2;
- }
- .serial{
- width: 80px;
- }
- .operation{
- width: 100px;
- }
- .subject,.teacher,.remarks{
- width: 180px;
- }
- .teacher{
- }
- .remarks{
- }
- td{
- height: 40px;
- }
- table input,table select{
- width: 80%;
- height: 86%;
- text-indent: 10px;
- }
- .opration-con{
- font-size: 23px;
- font-weight: bold;
- }
- .opration-con > span{
- color: #2977ff;
- cursor: pointer;
- }
- .types-con{
- margin-top: 25px;
- }
- .getscore-type{
- margin-left: 60px;
- }
- .types-con input {
- margin-left: 10px;
- cursor: pointer;
- }
- .submit{
- width: 100px;
- height: 30px;
- background: #01B677;
- color: #fff;
- border: none;
- margin-top: 50px;
- }
- .name-con{left:13px;top:28px;}
- .title_msg{
- padding-top:30px;
- padding-left:20px
- }
- </style>
- <div class="main-content-inner">
- <!-- 导航栏开始-->
- <?php include(Yii::app()->basePath.'/views/layouts/class_navigation.php');?>
- <!-- 导航栏结束-->
- <!--新版增加班级-->
- <div class="page-content" style="margin-top:15px;">
- <div class="row" style="margin:0px">
- <div class="col-xs-12 fontSize1">
- <!-- PAGE CONTENT BEGINS -->
- <section class="anc-top flex status_1" >
- <div class="flex-one flex">
- <p class="anc-title">行政班</p>
- <p class="title_msg">当前学年:<?php echo $thisSemester["school_year"];?>学年 当前学期:<?php echo $thisSemester["semester_name"];?></p>
- </div>
- </section>
- <form class="form-horizontal" action="<?php echo $this->createUrl('classes/add');?>" method="post" id="classAdd">
- <div class="col-xs-12 col-sm-12">
- <div class="form-group col-xs-12 col-sm-4">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">班级名称<span class="errorMessage">*</span>:</label>
- <div class="col-sm-9 mtCentent">
- <input type="text" id="class_name" name="class_name" class="col-xs-10 col-sm-4 addborder addheight marginLeftNo" />
- </div>
- </div>
- <div class="form-group col-xs-12 col-sm-4">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">年级<span class="errorMessage">*</span>:</label>
- <div class="col-sm-9">
- <select id="grade" name="grade">
- <?php
- if(isset(Yii::app()->params['grade_config'])){
- foreach (Yii::app()->params['grade_config'] as $id => $item){
- echo '<option value="'.$id.'">'.$item['grade_name'].'</option>';
- }
- }
- ?>
- </select>
- </div>
- </div>
- <div class="form-group col-xs-12 col-sm-4 ">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">班主任<span class="errorMessage">*</span>:</label>
- <div class="col-sm-9 mtCentent ">
- <input type="text" id="main-teacher" name="main-teacher" class="col-xs-10 col-sm-4 addborder addheight marginLeftNo" autocomplete="off" />
- <ul class="name-con">
- </ul>
- </div>
- </div>
- <div class="form-group col-xs-12 col-sm-4">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">助教<span class="errorMessage">*</span>:</label>
- <div class="col-xs-12 col-sm-9">
- <select id="coach_id" name="coach_id">
- <?php foreach($coachList as $cl):?>
- <option value="<?php echo $cl->coach_id;?>"><?php echo $cl->coach_name;?></option>
- <?php endforeach;?>
- </select>
- </div>
- </div>
- <div class="form-group col-xs-12 col-sm-4">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">层级:</label>
- <div class="col-xs-12 col-sm-9">
- <div class="clearfix">
- <select class="input-medium" id="level_name" name="level_name">
- <option value="">请选择</option>
- <?php if($classLevels):foreach($classLevels as $classLevel):?>
- <option value="<?php echo $classLevel[0];?>"><?php echo $classLevel[0];?>层</option>
- <?php endforeach;endif;?>
- </select>
- </div>
- </div>
- <input type="hidden" name="class_array" id="class_array">
- </div>
- <?php if( Yii::app()->params['section']==1):?>
- <div class="form-group col-xs-12 col-sm-4">
- <label class="control-label col-xs-12 col-sm-3 no-padding-right">文理科:</label>
- <div class="col-sm-9">
- <select id="arts_science" name="arts_science">
- <option value="0">不分科</option>
- <option value="1">文科</option>
- <option value="2">理科</option>
- </select>
- </div>
- </div>
- <?php endif;?>
- </div>
- <p class="th-describe"><em>*</em>执教老师:(<span>点击"+"添加列,点击"-"删除列</span>)</p>
- <table class="" id="teacher_list" cellpadding="0" cellspacing="0" border="1">
- <thead>
- <td class="serial">序号</td>
- <td class="operation">操作</td>
- <td class="subject">学科组</td>
- <td class="teacher">老师(岗位)</td>
- </thead>
- <tbody>
- <tr>
- <td>1</td>
- <td class="opration-con"><span class="add">+</span> <span class="redus">-</span></td>
- <td>
- <select name="subject_ids[]" id="subject_ids" class="subject_ids">
- <?php
- $noShow=array(18,19);
- $noShow=array_merge($noShow,Yii::app()->params['mathSubjectId']);
- unset($noShow[array_search(3,$noShow)]);
- unset($noShow[array_search(41,$noShow)]);
- foreach(Yii::app()->params["subjectId"] as $k=>$v){
- if(!in_array($k,$noShow)){
- ?>
- <option value="<?php echo $k?>"><?php echo $v?></option>
- <?php
- }}?>
- </select>
- </td>
- <td>
- <select name="teacher_ids[]" id="teacher_ids" class="teacher_ids projSelect">
- <?php if($teacher_data){foreach($teacher_data as $k=>$v){?>
- <option value="<?php echo $v->teacher_id?>"><?php echo $v->teacher_name?><?php
- $grade_arr = array(0=>'',1=>'高一',2=>'高二',3=>'高三');
- switch ($v->posts){
- case 0: echo '(任课教师)';break;
- case 1: echo '(班主任)';break;
- case 2: echo '(教研组长)';break;
- case 3: if($v->grade && isset(Yii::app()->params['grade_list'][$v->grade])){echo '('.Yii::app()->params['grade_list'][$v->grade]['grade_name'].'年级主任)';}else{echo '(年级主任)';};break;
- case 4: echo '(任课教师)';break;
- case 5: echo '(校长)';break;
- }?>
- </option>
- <?php }}?>
- </select>
- </td>
- </tr>
- </tbody>
- </table>
- <input type="hidden" class="ace" name="wrong_book_type" value="0" >
- <input type="hidden" class="ace" name="improve_book_type" value="0" >
- <div class="clearfix form-actions mt15">
- <input type='hidden' id="school_year" name="period" class='diy_select_input' value="<?php echo $thisSemester["school_year"];?>"/>
- <input type='hidden' id="bzr_id" name="bzrId" class='diy_select_input' value="0"/>
- <div class="col-md-offset-3 col-md-9">
- <button class="btn btn-success btn-sm" type="submit" id="schoolSubmit">
- <i class="ace-icon fa fa-check bigger-110"></i> 提交
- </button>
- <!--
- <button class="btn" type="reset">
- <i class="ace-icon fa fa-undo bigger-110"></i>
- 重填
- </button>-->
- </div>
- </div>
- </form>
- <!-- PAGE CONTENT ENDS -->
- </div>
- </div>
- </div>
- <!--新版添加班级结束-->
- </div>
- <style>
- .model-score input{padding-left: 5px; height: 30px;width: 230px;border:1px solid #ccc;outline: none;}
- .model-score input:focus{border-color: #50d2c2;box-shadow: 0 0 5px #50d2c2;}
- .modal-btn{text-align: center;margin:10px 0;}
- .modal-btn a{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #50d2c2;color: #fff;}
- .modal-content{position: absolute;left: 50%;top: 50%;padding-top: 40px; width: 500px;background: #fff; transform: translate(-50%,-50%);}
- .modal-title{position: absolute;top: 0;left: 0;padding-left: 20px; width: 100%;height: 40px;line-height: 40px;background: #009965;color:#fff;}
- .modal-title em{width: 40px;height: 40px;text-align: center;font-size: 20px;cursor: pointer;}
- .model-score1 input{padding-left: 5px; height: 30px;width: 230px;border:1px solid #ccc;outline: none;}
- .model-score1 input:focus{border-color: #50d2c2;box-shadow: 0 0 5px #50d2c2;}
- .modal-btn{text-align: center;margin:10px 0;}
- .modal-btn a{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #50d2c2;color: #fff;}
- .model-score2 input{padding-left: 5px; height: 30px;width: 230px;border:1px solid #ccc;outline: none;}
- .model-score2 input:focus{border-color: #50d2c2;box-shadow: 0 0 5px #50d2c2;}
- .modal-btn{text-align: center;margin:10px 0;}
- .modal-btn a{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #009965;color: #fff;}
- .modal-btn .close3{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #fff;color: #000;border:1px solid #555;border-radius: 3px;}
- .modal1_multi{position: fixed;top: 0;left: 0;width: 100%;height: 100%;font-size:14px;display:none ;background: rgba(0,0,0,.4)}
- .model-rule{width:80%;margin:15px auto;text-align: center;font-size:18px;}
- .modal1_multi .model-score1{width:80%;margin:10px auto;text-align: left}
- .modal1_multi .model-score-m{width:80%;margin:5px auto;}
- .modal1_multi .model-score-m label{margin:5px 0;font-size: 12px;color:red;font-weight: initial}
- .modal1_multi em{color:#fff;}
- </style>
- <!-- 重置提示框 -->
- <div class="modal1_multi">
- <div class="modal-shadow"></div>
- <div class="modal-content">
- <div class="modal-title clearfix">
- 提示<em class="fr close3">×</em>
- </div>
- <div class="model-rule">
- </div>
- <div class="model-score-m">
- </div>
- <div class="modal-btn">
- <a href="javascript:;" class="sumbit3">取消隐藏</a>
- <a href="javascript:;" class="close3 chameleon">关闭</a>
- <input type="hidden" name="hideClassId" value="0">
- </div>
- </div>
- </div>
- <script src="/js/jquery.validate.min.js"></script>
- <script src="/js/birthday.js" type="text/javascript" charset="utf-8"></script>
- <script src="/js/xsgl.js"></script>
- <script src="/js/select/select2.min.js"></script>
- <script>
- $(document).ready(function(){
- var subjectIds = <?php echo json_encode(Yii::app()->params["subjectId"]);?>;
- $('.projSelect').select2();
- selectCount=1;
- $(document).on("click",".add",function () {
- var noShow=[];
- <?php
- $noShow=array(18,19);
- $noShow=array_merge($noShow,Yii::app()->params['mathSubjectId']);
- unset($noShow[array_search(3,$noShow)]);
- unset($noShow[array_search(41,$noShow)]);
- foreach ($noShow as $item){
- echo 'noShow.push('.$item.');';
- }
- ?>
- console.log(noShow);
- var index = $(this).parent().parent().index();
- var data = {'grade':$('#grade').val()};
- var obj = $(this);
- selectCount++;
- var selectClass='projSelect'+selectCount;
- var str = '';
- str += '<tr><td>1</td>';
- str+='<td class="opration-con"><span class="add">+</span> <span class="redus">-</span></td>'
- str+='<td><select name="subject_ids[]" id="subject_ids" class="subject_ids ">'
- $.each(subjectIds,function(index,val){
- if($.inArray(parseInt(index),noShow)==-1){
- str += '<option value="'+index+'">'+val+'</option>';
- }
- });
- str += '</select></td>';
- $.post("<?php echo Yii::app()->createUrl('classes/getAllTeachers')?>",data,function(flags){
- var m = JSON.parse(flags);
- if(m.status==0)
- {
- alert('没有教师');
- }else
- {
- str += '<td><select name="teacher_ids[]" id="teacher_ids" class="teacher_ids '+selectClass+'">';
- $.each(m.result,function(index,val){
- str += '<option value="'+index+'">'+val+'</option>';
- });
- str += '<select></td></tr>';
- obj.parent().parent().after(str);
- $('.'+selectClass).select2();
- for (var i=index+1;i<$('tbody tr').length;i++) {
- var tNum = parseInt($('tbody tr').eq(i-1).find('td').eq(0).text())+1;
- $('tbody tr').eq(i).find('td').eq(0).text(tNum);
- }
- }
- });
- });
- $(document).on("click",".redus",function () {
- var index = $(this).parent().parent().index();
- for (var i=index+1;i<$('tbody tr').length;i++) {
- var tNum = parseInt($('tbody tr').eq(i).find('td').eq(0).text())-1;
- $('tbody tr').eq(i).find('td').eq(0).text(tNum);
- }
-
- if ($('#teacher_list tbody tr').length>1) {
- $(this).parent().parent().remove();
- } else{
- alert("最后一行不能删除了哦");
- }
- });
- //切换班级的时候执教老师清空
- var oldGrade = $('#grade').val();
- $('body').on("click",".select-grade ul li",function(){
- var currentGrade = $('this').attr('val');
- if (oldGrade!=currentGrade){
- $('.subject_ids').each(function () {
- var data= {
- 'subject_id': $(this).val(),
- 'grade': $('#grade').val()
- };
- var str ='';
- var _this = $(this);
- $.post("<?php echo Yii::app()->createUrl('classes/get_subject_teachers')?>",data,function(flags){
- var m = JSON.parse(flags);
- if(m.status==0)
- {
- alert('没有教师');
- }else
- {
- $.each(m.result,function(index,val){
- str += '<option value="'+index+'">'+val+'</option>'
- });
- }
- _this.parent().next().children('select').html(str);
- _this.parent().next().children('select').select2();
- });
- })
- }
- });
- $('body').on("change",".subject_ids",function(){
- var data= {
- 'subject_id': $(this).val(),
- 'grade': $('#grade').val()
- };
- var str ='';
- var _this = $(this);
- $.post("<?php echo Yii::app()->createUrl('classes/get_subject_teachers')?>",data,function(flags){
- var m = JSON.parse(flags);
- if(m.status==0)
- {
- alert('没有教师');
- }else
- {
- $.each(m.result,function(index,val){
- str += '<option value="'+index+'">'+val+'</option>'
- });
- }
- _this.parent().next().children('select').html(str);
- _this.parent().next().children('select').select2();
- });
- });
- });
- </script>
- <script language="javascript">
- $(function(){
- //加载班主任教师
- $('#main-teacher').bind('input propertychange,input focus', function() {
- var obj_list=$(this).parent().find('.name-con');
- var keyword=$(this).val();
- console.log($(this).width());
- if(keyword==''){
- // return false;
- }
- width=parseInt($(this).width())+24;
- obj_list.css('width',width+'px');
- obj_list.html('');
- $(this).attr('teacher_id','');
- $('#bzr_id').val(0);
- $.ajax({
- url:'<?php echo $this->createUrl('classes/loadTeacher')?>',
- type:'POST',
- dataType:'json',
- data:{'keyword':keyword},
- success:function(res){
- if(res.status==1){
- var html='';
- if(res.data.length>0){
- for(var i=0;i<res.data.length;i++){
- html+='<li class="name-list" id="'+res.data[i]['teacher_id']+'">'+res.data[i]['teacher_name']+'</li>';
- }
- obj_list.html(html);
- obj_list.show();
- }
- }
- }
- });
- });
-
- $('.mtCentent').on('click','.name-list',function(){
- $(this).closest('.mtCentent').find('#main-teacher').val($(this).html());
- $(this).closest('.mtCentent').find('#main-teacher').attr('teacher_id',$(this).attr('id'));
- $(this).closest('.mtCentent').find('#main-teacher').attr('title',$(this).html());
- $('#bzr_id').val($(this).attr('id'));
- $(this).closest('.mtCentent').find('.name-con').hide();
- })
- $('.close3').click(function(){
- $('.modal1_multi').hide();
- });
- //提交保存
- $('#schoolSubmit').click(function(){
- var className=$('input[name=class_name]').val();
- if(className==''){
- layer.msg('请输入班级名称');
- return false;
- }
- if(className.length>10){
- layer.msg('班级名称不能超过10个字符');
- return false;
- }
- //校验是否有隐藏同名班级
- $.ajax({
- url:'<?php echo $this->createUrl('classes/checkClassNameOnSameSemester')?>',
- type:'POST',
- dataType:'json',
- data:{class_name:className},
- success:function(res){
- if(res.status==1){
- $('.model-rule').html('班级名称与学校已隐藏班级“'+className+'”重复,若要恢复班级,请点击“取消隐藏”');
- $('.modal1_multi').show();
- $('input[name=hideClassId]').val(res.data);
- return false;
- }else{
- var teacher_ids=$('#teacher_ids');
- if(teacher_ids.length==0){
- layer.msg('请选择执教教师');
- return false;
- }
- if($('#coach_id').val()==''){
- layer.msg('请选择助教');
- return false;
- }
- if($('input[name=bzrId]').val()=='0'){
- layer.msg('请选择班主任');
- return false;
- }
- $('.form-horizontal').submit();
- return true;
- }
- }
- });
- return false;
- });
- $('.sumbit3').click(function(){
- var classId=$('input[name=hideClassId]').val();
- if(classId==0 || classId==undefined || classId==''){
- alert('参数错误');
- }
- $.ajax({
- url:'<?php echo $this->createUrl('classes/recoverClass')?>',
- type:'POST',
- dataType:'json',
- data:{classId:classId},
- success:function(res){
- if(res.status==1){
- layer.msg('班级已成功恢复',{
- icon: 1
- }, function(){
- window.location.href='<?php echo $this->createUrl('classes/index')?>';
- });
- }else{
- layer.msg('操作失败')
- }
- }
- });
- });
- })
- </script>
|