add_classified.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  1. <link type="text/css" rel="stylesheet" href="/css/needDetail.css" />
  2. <link type="text/css" rel="stylesheet" href="/js/select/select2.min.css" />
  3. <style>
  4. .addborder{border:1px solid #ccc}
  5. .addheight{height:30px;border-radius:2px;}
  6. .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;}
  7. .ace{position:relative;top:0px !important;left:0px !important;}
  8. label{font-weight:100 !important;}
  9. /* #coach_id-error{position: absolute;right:-80px;top:5px;}
  10. #level_name-error{position: absolute;right:-80px;top:5px;}
  11. #material_id-error{position: absolute;right:-110px;top:5px;}
  12. #class_name-error{margin: 6px 0px 0px 18px;font-size:13px;} */
  13. .clearfix:after {
  14. content: "";
  15. display: block;
  16. visibility: hidden;
  17. height: 0;
  18. clear: both;
  19. }
  20. .clearfix {
  21. zoom: 1;
  22. }
  23. .fl {
  24. float: left;
  25. }
  26. .fr {
  27. float: right;
  28. }
  29. em{
  30. color: #FF000C;
  31. margin-right: 4px;
  32. }
  33. .bm-name{
  34. width: 100px;
  35. text-align: right;
  36. // border: 1px solid #000;
  37. }
  38. .bm-inp-con{
  39. width: 170px;
  40. }
  41. .basic-message select{
  42. width: 160px;
  43. height: 26px;
  44. }
  45. .basic-message input{
  46. width: 156px;
  47. height: 22px;
  48. }
  49. .basic-message{
  50. padding: 10px 0;
  51. }
  52. .th-describe{
  53. margin-top: 10px;
  54. }
  55. .th-describe span{
  56. color: #FF000C;
  57. }
  58. table{
  59. width: 800px;
  60. border-color: #fff;
  61. text-align: center;
  62. font-size: 14px;
  63. margin-top: 10px;
  64. }
  65. thead{
  66. background: #F2F2F2;
  67. }
  68. .serial{
  69. width: 80px;
  70. }
  71. .operation{
  72. width: 100px;
  73. }
  74. .subject,.teacher,.remarks{
  75. width: 180px;
  76. }
  77. .teacher{
  78. }
  79. .remarks{
  80. }
  81. td{
  82. height: 40px;
  83. }
  84. table input,table select{
  85. width: 80%;
  86. height: 86%;
  87. text-indent: 10px;
  88. }
  89. .opration-con{
  90. font-size: 23px;
  91. font-weight: bold;
  92. }
  93. .opration-con > span{
  94. color: #2977ff;
  95. cursor: pointer;
  96. }
  97. .types-con{
  98. margin-top: 25px;
  99. }
  100. .getscore-type{
  101. margin-left: 60px;
  102. }
  103. .types-con input {
  104. margin-left: 10px;
  105. cursor: pointer;
  106. }
  107. .submit{
  108. width: 100px;
  109. height: 30px;
  110. background: #01B677;
  111. color: #fff;
  112. border: none;
  113. margin-top: 50px;
  114. }
  115. .title_msg{
  116. padding-top:30px;
  117. padding-left:20px
  118. }
  119. </style>
  120. <div class="main-content-inner">
  121. <!-- 导航栏开始-->
  122. <?php include(Yii::app()->basePath.'/views/layouts/class_navigation.php');?>
  123. <!-- 导航栏结束-->
  124. <!--新版增加班级-->
  125. <div class="page-content" style="margin-top:15px;">
  126. <div class="row" style="margin:0px">
  127. <div class="col-xs-12 fontSize1">
  128. <!-- PAGE CONTENT BEGINS -->
  129. <section class="anc-top flex status_1" >
  130. <div class="flex-one flex">
  131. <p class="anc-title">教学班</p>
  132. <p class="title_msg">当前学年:<?php echo $thisSemester["school_year"];?>学年 当前学期:<?php echo $thisSemester["semester_name"];?></p>
  133. </div>
  134. </section>
  135. <form class="form-horizontal" action="<?php echo $this->createUrl('classes/addClass');?>" method="post" id="classAdd">
  136. <div class="col-xs-12 col-sm-12">
  137. <div class="form-group col-xs-12 col-sm-4">
  138. <label class="control-label col-xs-12 col-sm-3 no-padding-right">班级名称<span class="errorMessage">*</span>:</label>
  139. <div class="col-sm-9 mtCentent">
  140. <input type="text" id="class_name" name="class_name" class="col-xs-10 col-sm-4 addborder addheight marginLeftNo" />
  141. </div>
  142. </div>
  143. <div class="form-group col-xs-12 col-sm-4">
  144. <label class="control-label col-xs-12 col-sm-3 no-padding-right">年级<span class="errorMessage">*</span>:</label>
  145. <div class="col-sm-9">
  146. <select id="grade" name="grade">
  147. <option value="1">高一</option>
  148. <option value="2">高二</option>
  149. <option value="3">高三</option>
  150. </select>
  151. </div>
  152. </div>
  153. <div class="form-group col-xs-12 col-sm-4">
  154. <label class="control-label col-xs-12 col-sm-3 no-padding-right">层级:</label>
  155. <div class="col-xs-12 col-sm-9">
  156. <div class="clearfix">
  157. <select class="input-medium" id="level_name" name="level_name">
  158. <option value="">请选择</option>
  159. <?php if($classLevels):foreach($classLevels as $classLevel):?>
  160. <option value="<?php echo $classLevel[0];?>"><?php echo $classLevel[0];?>层</option>
  161. <?php endforeach;endif;?>
  162. </select>
  163. </div>
  164. </div>
  165. <input type="hidden" name="class_array" id="class_array">
  166. </div>
  167. </div>
  168. <p class="th-describe"><em>*</em>执教老师:(<span>点击"+"添加列,点击"-"删除列</span>)&nbsp;&nbsp;&nbsp;&nbsp;<span class=" add" style="color:#2977ff;font-size: 23px;font-weight: bold">+</span></p>
  169. <table id="teacher_list" class="" cellpadding="0" cellspacing="0" border="1">
  170. <thead>
  171. <td class="serial">序号</td>
  172. <td class="operation">操作</td>
  173. <td class="subject">学科组</td>
  174. <td class="teacher">老师(岗位)</td>
  175. </thead>
  176. </table>
  177. <div class="clearfix form-actions mt15">
  178. <div class="col-md-offset-3 col-md-9">
  179. <button class="btn btn-success btn-sm" type="submit" id="schoolSubmit">
  180. <i class="ace-icon fa fa-check bigger-110"></i> 提交
  181. </button>
  182. <!--&nbsp; &nbsp; &nbsp;
  183. <button class="btn" type="reset">
  184. <i class="ace-icon fa fa-undo bigger-110"></i>
  185. 重填
  186. </button>-->
  187. </div>
  188. </div>
  189. </form>
  190. <!-- PAGE CONTENT ENDS -->
  191. </div>
  192. </div>
  193. </div>
  194. <!--新版添加班级结束-->
  195. </div>
  196. <style>
  197. .model-score input{padding-left: 5px; height: 30px;width: 230px;border:1px solid #ccc;outline: none;}
  198. .model-score input:focus{border-color: #50d2c2;box-shadow: 0 0 5px #50d2c2;}
  199. .modal-btn{text-align: center;margin:10px 0;}
  200. .modal-btn a{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #50d2c2;color: #fff;}
  201. .modal-content{position: absolute;left: 50%;top: 50%;padding-top: 40px; width: 500px;background: #fff; transform: translate(-50%,-50%);}
  202. .modal-title{position: absolute;top: 0;left: 0;padding-left: 20px; width: 100%;height: 40px;line-height: 40px;background: #009965;color:#fff;}
  203. .modal-title em{width: 40px;height: 40px;text-align: center;font-size: 20px;cursor: pointer;}
  204. .model-score1 input{padding-left: 5px; height: 30px;width: 230px;border:1px solid #ccc;outline: none;}
  205. .model-score1 input:focus{border-color: #50d2c2;box-shadow: 0 0 5px #50d2c2;}
  206. .modal-btn{text-align: center;margin:10px 0;}
  207. .modal-btn a{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #50d2c2;color: #fff;}
  208. .model-score2 input{padding-left: 5px; height: 30px;width: 230px;border:1px solid #ccc;outline: none;}
  209. .model-score2 input:focus{border-color: #50d2c2;box-shadow: 0 0 5px #50d2c2;}
  210. .modal-btn{text-align: center;margin:10px 0;}
  211. .modal-btn a{display: inline-block;margin:0 5px; width: 100px; line-height: 40px;background: #009965;color: #fff;}
  212. .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;}
  213. .modal1_multi{position: fixed;top: 0;left: 0;width: 100%;height: 100%;font-size:14px;display:none ;background: rgba(0,0,0,.4)}
  214. .model-rule{width:80%;margin:15px auto;text-align: center;font-size:18px;}
  215. .modal1_multi .model-score1{width:80%;margin:10px auto;text-align: left}
  216. .modal1_multi .model-score-m{width:80%;margin:5px auto;}
  217. .modal1_multi .model-score-m label{margin:5px 0;font-size: 12px;color:red;font-weight: initial}
  218. .modal1_multi em{color:#fff;}
  219. </style>
  220. <!-- 重置提示框 -->
  221. <div class="modal1_multi">
  222. <div class="modal-shadow"></div>
  223. <div class="modal-content">
  224. <div class="modal-title clearfix">
  225. 提示<em class="fr close3">×</em>
  226. </div>
  227. <div class="model-rule">
  228. </div>
  229. <div class="model-score-m">
  230. </div>
  231. <div class="modal-btn">
  232. <a href="javascript:;" class="sumbit3">取消隐藏</a>
  233. <a href="javascript:;" class="close3 chameleon">关闭</a>
  234. <input type="hidden" name="hideClassId" value="0">
  235. </div>
  236. </div>
  237. </div>
  238. <script src="/js/jquery.validate.min.js"></script>
  239. <script src="/js/birthday.js" type="text/javascript" charset="utf-8"></script>
  240. <script src="/js/xsgl.js"></script>
  241. <script src="/js/select/select2.min.js"></script>
  242. <script>
  243. $(document).ready(function(){
  244. var subjectIds = [];
  245. $('#grade').change(function(){
  246. var grade=$(this).val();
  247. getClass(grade);
  248. });
  249. $('#grade').val(1);
  250. getClass(1);
  251. function getClass(grade){
  252. $('.subject_teacher').remove();
  253. $.ajax({
  254. url:'<?php echo $this->createUrl('classes/getClassSubjectByGrade')?>',
  255. type:'POST',
  256. dataType:'json',
  257. data:{grade:grade},
  258. success:function(res){
  259. if(res.status==1){
  260. subjectIds=res.data;
  261. }
  262. }
  263. })
  264. }
  265. selectCount=1;
  266. $(document).on("click",".add",function () {
  267. if(subjectIds.length==0){
  268. layer.msg('请设置走班学科');
  269. return false;
  270. }
  271. var index=$('.subject_teacher').length;
  272. var data = {'grade':$('#grade').val()};
  273. var obj = $(this);
  274. selectCount++;
  275. var selectClass='projSelect'+selectCount;
  276. var str = '';
  277. str += '<tr class="subject_teacher"><td>'+(index+1)+'</td>';
  278. str+='<td class="opration-con"><span class="add">+</span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="redus">-</span></td>'
  279. str+='<td><select name="subject_ids[]" id="subject_ids" class="subject_ids"><option value="0">选择学科</option>'
  280. $.each(subjectIds,function(index,val){
  281. str += '<option value="'+index+'">'+val+'</option>';
  282. });
  283. str += '</select></td>';
  284. str += '<td><select name="teacher_ids[]" id="teacher_ids" class="teacher_ids '+selectClass+'">';
  285. str += '<select></td></tr>';
  286. //$.post("<?php //echo Yii::app()->createUrl('classes/getAllTeachers')?>//",data,function(flags){
  287. // var m = JSON.parse(flags);
  288. // if(m.status==0)
  289. // {
  290. // alert('没有教师');
  291. // }else
  292. // {
  293. // str += '<td><select name="teacher_ids[]" id="teacher_ids" class="teacher_ids">';
  294. // $.each(m.result,function(index,val){
  295. // str += '<option value="'+index+'">'+val+'</option>';
  296. // });
  297. // str += '<select></td></tr>';
  298. // $('#teacher_list').append(str);
  299. //
  300. // }
  301. //});
  302. $('#teacher_list').append(str);
  303. });
  304. $(document).on("click",".redus",function () {
  305. var index = $(this).parent().parent().index();
  306. for (var i=index+1;i<$('tbody tr').length;i++) {
  307. var tNum = parseInt($('tbody tr').eq(i).find('td').eq(0).text())-1;
  308. $('tbody tr').eq(i).find('td').eq(0).text(tNum);
  309. }
  310. if ($('tbody tr').length>1) {
  311. $(this).parent().parent().remove();
  312. } else{
  313. alert("最后一行不能删除了哦");
  314. }
  315. });
  316. $('body').on("change",".subject_ids",function(){
  317. var data= {
  318. 'subject_id': $(this).val(),
  319. 'grade': $('#grade').val()
  320. };
  321. var str ='';
  322. var _this = $(this);
  323. $.post("<?php echo Yii::app()->createUrl('classes/get_subject_teachers')?>",data,function(flags){
  324. var m = JSON.parse(flags);
  325. if(m.status==0)
  326. {
  327. alert('没有教师');
  328. }else
  329. {
  330. $.each(m.result,function(index,val){
  331. str += '<option value="'+index+'">'+val+'</option>'
  332. });
  333. }
  334. _this.parent().next().children('select').html(str);
  335. _this.parent().next().children('select').select2();
  336. });
  337. });
  338. });
  339. </script>
  340. <script language="javascript">
  341. $(function(){
  342. //加载班主任教师
  343. $('#main-teacher').bind('input propertychange', function() {
  344. var obj_list=$(this).parent().find('.name-con');
  345. var keyword=$(this).val();
  346. if(keyword==''){
  347. return false;
  348. }
  349. $(this).attr('teacher_id','');
  350. $('#bzr_id').val(0);
  351. $.ajax({
  352. url:'<?php echo $this->createUrl('classes/loadTeacher')?>',
  353. type:'POST',
  354. dataType:'json',
  355. data:{'keyword':keyword},
  356. success:function(res){
  357. if(res.status==1){
  358. var html='';
  359. if(res.data.length>0){
  360. for(var i=0;i<res.data.length;i++){
  361. html+='<li class="name-list" id="'+res.data[i]['teacher_id']+'">'+res.data[i]['teacher_name']+'</li>';
  362. }
  363. obj_list.html(html);
  364. obj_list.show();
  365. }
  366. }
  367. }
  368. });
  369. });
  370. $('.mtCentent').on('click','.name-list',function(){
  371. $(this).closest('.mtCentent').find('#main-teacher').val($(this).html());
  372. $(this).closest('.mtCentent').find('#main-teacher').attr('teacher_id',$(this).attr('id'));
  373. $(this).closest('.mtCentent').find('#main-teacher').attr('title',$(this).html());
  374. $('#bzr_id').val($(this).attr('id'));
  375. $(this).closest('.mtCentent').find('.name-con').hide();
  376. })
  377. //提交保存
  378. $('#schoolSubmit').click(function(){
  379. var className=$('input[name=class_name]').val();
  380. if(className==''){
  381. layer.msg('请输入班级名称');
  382. return false;
  383. }
  384. if(className.length>10){
  385. layer.msg('班级名称不能超过10个字符');
  386. return false;
  387. }
  388. //校验是否有隐藏同名班级
  389. $.ajax({
  390. url:'<?php echo $this->createUrl('classes/checkClassNameOnSameSemester')?>',
  391. type:'POST',
  392. dataType:'json',
  393. data:{class_name:className},
  394. success:function(res){
  395. if(res.status==1){
  396. $('.model-rule').html('班级名称与学校已隐藏班级“'+className+'”重复,若要恢复班级,请点击“取消隐藏”');
  397. $('.modal1_multi').show();
  398. $('input[name=hideClassId]').val(res.data);
  399. return false;
  400. }else{
  401. var teacher_ids=$('#teacher_ids');
  402. if(teacher_ids.length==0){
  403. layer.msg('请选择执教教师');
  404. return false;
  405. }
  406. $('.form-horizontal').submit();
  407. return true;
  408. }
  409. }
  410. });
  411. return false;
  412. });
  413. $('.close3').click(function(){
  414. $('.modal1_multi').hide();
  415. });
  416. $('.sumbit3').click(function(){
  417. var classId=$('input[name=hideClassId]').val();
  418. if(classId==0 || classId==undefined || classId==''){
  419. alert('参数错误');
  420. }
  421. $.ajax({
  422. url:'<?php echo $this->createUrl('classes/recoverClass')?>',
  423. type:'POST',
  424. dataType:'json',
  425. data:{classId:classId},
  426. success:function(res){
  427. if(res.status==1){
  428. layer.msg('班级已成功恢复',{
  429. icon: 1
  430. }, function(){
  431. window.location.href='<?php echo $this->createUrl('classes/index')?>';
  432. });
  433. }else{
  434. layer.msg('操作失败')
  435. }
  436. }
  437. });
  438. });
  439. })
  440. </script>