view.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. <link rel="stylesheet" href="/fonts/zhuanzhang/iconfont.css" />
  2. <link rel="stylesheet" href="/css/toTransferPop.css" />
  3. <style>
  4. /*弹出层*/
  5. .confirmbox-mask {
  6. background: rgba(0, 0, 0, .7);
  7. left: 0;
  8. right: 0;
  9. top: 0;
  10. bottom: 0;
  11. z-index: 99;
  12. position: fixed;
  13. }
  14. .confirmbox-mask button {
  15. border: none;
  16. background: #2977ff;
  17. width: 80px;
  18. height: 26px;
  19. border-radius: 3px;
  20. font-size: 14px;
  21. color: #fff;
  22. outline: none;
  23. cursor: pointer;
  24. }
  25. .confirmbox-mask button.save {
  26. display: block;
  27. margin: 40px auto;
  28. }
  29. .confirmbox .confirmbox-btns {
  30. margin-top: 40px;
  31. }
  32. .class-modal {
  33. width: 700px;
  34. background: #fff;
  35. // border-radius: 5px;
  36. position: absolute;
  37. top: 50%;
  38. left: 50%;
  39. transform: translate(-50%, -50%);
  40. height:420px;
  41. }
  42. .class-modal-head {
  43. font-size: 14px;
  44. background:#2977ff;
  45. color:#fff;
  46. height:25px;
  47. line-height: 25px;
  48. padding: 0 0 0 15px;
  49. }
  50. .class-modal-body {
  51. margin-top: 5px;
  52. overflow: auto;
  53. padding:15px;
  54. min-height: 340px;
  55. }
  56. .class-modal-body .classes {
  57. margin-bottom: 20px;
  58. }
  59. .class-modal-body .classes > div {
  60. display: inline-block;
  61. max-width: 640px;
  62. vertical-align: top;
  63. }
  64. .class-modal-body .classes a {
  65. text-decoration: none;
  66. display: inline-block;
  67. margin: 0 5px 5px;
  68. color: #136bfb;
  69. font-size: 14px;
  70. }
  71. .class-modal-body .classes a.active {
  72. color: #fc091b;
  73. }
  74. .class-modal .icon-close{
  75. position: absolute;
  76. right: 20px;
  77. top: 2px;
  78. color:#fff;
  79. }
  80. .c-red {
  81. color: #CC3300
  82. }
  83. .avg{
  84. margin:0 10px;
  85. }
  86. .class_btn{
  87. text-align: center;
  88. }
  89. .confirmbox-mask p{
  90. word-wrap : break-word ;
  91. }
  92. .icon-close{
  93. cursor: pointer;
  94. }
  95. .model-input{
  96. border:1px solid #ccc;
  97. padding:5px;
  98. margin-top:10px;
  99. }
  100. .model-input label{
  101. margin:0 15px;
  102. }
  103. table{margin-top:5px;}
  104. .table_list{
  105. height:250px;
  106. overflow: auto;
  107. }
  108. .upload-box{
  109. position:relative;
  110. padding-left:106px;
  111. line-height: 28px;
  112. }
  113. .upload-div,.upload-ipt{
  114. position: absolute;
  115. left:0;
  116. top:0;
  117. width:100px!important;
  118. }
  119. .upload-div{
  120. height:28px;
  121. text-align: center;
  122. background: #eee;
  123. color: #333;
  124. border-radius: 3px;
  125. border:1px solid #ccc;
  126. }
  127. .upload-div:hover{
  128. background: #69d9a7;
  129. }
  130. .upload-ipt{
  131. z-index: 2;
  132. opacity: 0;
  133. }
  134. .bind_code_log{float: right;color:#69d9a7;cursor: pointer}
  135. </style>
  136. <div class="main-content-inner">
  137. <!-- 导航栏开始-->
  138. <?php include(Yii::app()->basePath.'/views/layouts/class_navigation.php');?>
  139. <!-- 导航栏结束-->
  140. <div class="page-content">
  141. <div class="row" style="margin:0px;">
  142. <div class="col-xs-12">
  143. <!-- PAGE CONTENT BEGINS -->
  144. <div class="class-detail-con">
  145. <img src="/images/u116.png" alt="" class="edit-class">
  146. <div class="edit-opts">
  147. <span class="dib pointer edit-opts-btns edit-cancel-btn">取消</span>
  148. <span class="dib pointer edit-opts-btns edit-save-btn">保存</span>
  149. <input type="hidden" name="class_id" value="<?php echo $cid?>">
  150. </div>
  151. <div class="class-name black-font"><?php if(isset($class_name)) echo $class_name?></div>
  152. <form id="teacher_form">
  153. <div class="class-adviser">
  154. <span class="gray-font dib cn-left-menu">班主任:</span>
  155. <input type="text" name="main-teacher" teacher_id="<?php if(isset($class_bzr_id)) echo $class_bzr_id?>" title="<?php if(isset($class_bzr) && $class_bzr) echo $class_bzr ?>" class="black-font dib read-only main-teacher" value="<?php if(isset($class_bzr) && $class_bzr){ echo $class_bzr ;}else{ echo "";} ?>" disabled="true">
  156. <ul class="name-con">
  157. </ul>
  158. </div>
  159. <div class="class-teachers flex">
  160. <span class="gray-font dib cn-left-menu">执教老师:</span>
  161. <div class="flex-one flex flex-wrap">
  162. <?php
  163. if($allSubject){
  164. foreach ($allSubject as $key => $val){
  165. ?>
  166. <div class="teacher-list">
  167. <input type="text" title="<?php if(isset($subject_teacher[$key]) && $subject_teacher[$key]) echo $subject_teacher[$key] ?>" data="<?php echo $key?>" teacher_id="<?php if(isset($subject_tid[$key])) echo $subject_tid[$key] ?>" class="black-font dib teacher-name-msg ellipsis read-only" disabled="true" value="<?php if(isset($subject_teacher[$key])){echo $subject_teacher[$key];}else{echo "";} ?>">
  168. <p class="gray-font"><?php echo $val?></p>
  169. <ul class="name-con">
  170. </ul>
  171. </div>
  172. <?php
  173. }
  174. }
  175. ?>
  176. </div>
  177. </div>
  178. </form>
  179. </div>
  180. <div class="parent-list">
  181. <span class="left-blue-border black-font parent-list-title">家长列表</span>
  182. <span class=" bind_code_log">绑定码日志</span>
  183. <table class="table table1 table-bordered table-hover dataTable no-footer" border="1">
  184. <thead>
  185. <tr>
  186. <td>序号</td>
  187. <td>学生姓名</td>
  188. <td>家长与学生关系</td>
  189. <td>家长手机号码</td>
  190. <td>家长绑定时间</td>
  191. <td>操作</td>
  192. </tr>
  193. </thead>
  194. <?php
  195. if(isset($students['rs'])){
  196. $i=1;
  197. $sid=1;
  198. $bgcolor=array('#F2F2F2','#FFF');
  199. foreach ($students['rs'] as $val){
  200. $rows=1;
  201. $color=$bgcolor[($i%2)];
  202. if($val['is_bind']==1 && isset($val['parents'])){
  203. $rows=count($val['parents']);
  204. $k=1;
  205. foreach ($val['parents'] as $v){
  206. $bindType='无验证监护人';
  207. if($v['bind_type']==1){
  208. $bindType='主监护人';
  209. }elseif($v['bind_type']==2){
  210. $bindType='副监护人';
  211. }
  212. echo '<tr bgcolor="'.$color.'">';
  213. if($k==1){
  214. echo '<td rowspan="'.$rows.'">'.$i.'</td>';
  215. echo '<td rowspan="'.$rows.'" class="realname">'.$val['realname'].'</td>';
  216. }
  217. echo '<td class="stype">'.$v['type'].'('.$bindType.')</td>';
  218. echo '<td class="mobile">'.$v['mobile'].'</td>';
  219. echo '<td class="time">'.$v['create_time'].'</td>';
  220. echo '<td><a class="blue-font pointer remove-bind" realname="'.$val['realname'].'" student_id="'.$val['student_id'].'" id="'.$sid.'" data="'.$v['parent_id'].'">解绑</a></td>';
  221. echo '</tr>';
  222. $k++;
  223. $sid++;
  224. }
  225. }else {
  226. ?>
  227. <tr bgcolor="<?php echo $color ?>">
  228. <td><?php echo $i ?></td>
  229. <td class="realname"><?php echo $val['realname'] ?></td>
  230. <td class="stype"></td>
  231. <td class="mobile"></td>
  232. <td class="time"></td>
  233. <td class="action">
  234. </td>
  235. </tr>
  236. <?php
  237. }
  238. $i++;
  239. }
  240. }
  241. ?>
  242. </table>
  243. <br>
  244. <?php if(!empty($page_total)):?>
  245. <div class="row">
  246. <div class="col-xs-7">
  247. &nbsp;
  248. </div>
  249. <div class="col-xs-5">
  250. <div class="dataTables_paginate paging_simple_numbers">
  251. <?php
  252. $this->widget('CLinkPager', array(
  253. 'header' => '',
  254. 'firstPageLabel'=> '首页',
  255. 'lastPageLabel' => '末页',
  256. 'prevPageLabel' => '上一页',
  257. 'nextPageLabel' => '下一页',
  258. 'pages' => $pages,
  259. 'maxButtonCount'=> 5,
  260. ));
  261. echo '共:'.$page_total.'条';
  262. ?>
  263. </div>
  264. </div>
  265. </div>
  266. <?php endif;?>
  267. </div>
  268. <div class="remove-bind-pop">
  269. <div class="bind-pop-con">
  270. <div class="bind-msg tac">确定要解绑“李晓玉”的家长?</div>
  271. <div class="bind-opt tac">
  272. <span class="dib bind-opt-btns cancel-btn pointer">取消</span>
  273. <span class="dib bind-opt-btns sure-btn pointer">确定</span>
  274. <input type="hidden" name="student_name" value="">
  275. <input type="hidden" name="parent_id" value="">
  276. <input type="hidden" name="student_id" value="">
  277. <input type="hidden" name="row_id" value="">
  278. </div>
  279. </div>
  280. </div>
  281. <!-- PAGE CONTENT ENDS -->
  282. </div>
  283. </div>
  284. </div>
  285. </div>
  286. <!--绑定码日志-->
  287. <div class="confirmbox-mask" style="display: none" id="fieldModal">
  288. <div class="class-modal">
  289. <i class="icon close_1 icon-close">×</i>
  290. <div class="class-modal-head"><?php echo date('Y-m-d').' 绑定日志'?></div>
  291. <div class="class-modal-body">
  292. <div class="table_list">
  293. <table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable">
  294. </table>
  295. </div>
  296. </div>
  297. </div>
  298. </div>
  299. <script src="/js/layer/layer.js"></script>
  300. <script>
  301. // 解绑
  302. $('.remove-bind').click(function(){
  303. var realname=$(this).attr('realname');
  304. $('.remove-bind-pop').find('.bind-msg').html('确定要解绑“'+realname+'”的家长?');
  305. $('.remove-bind-pop').show();
  306. $('input[name=student_name]').val(realname);
  307. $('input[name=parent_id]').val($(this).attr('data'));
  308. $('input[name=student_id]').val($(this).attr('student_id'));
  309. $('input[name=row_id]').val($(this).attr('id'));
  310. })
  311. $('.cancel-btn').click(function(){
  312. $('.remove-bind-pop').hide()
  313. })
  314. //解绑功能
  315. $('.sure-btn').click(function(){
  316. $('.remove-bind-pop').hide()
  317. var parent_id=$('input[name=parent_id]').val();
  318. var student_id=$('input[name=student_id]').val();
  319. var row_id=$('input[name=row_id]').val();
  320. if(parent_id=='' || student_id==''){
  321. return false;
  322. }
  323. var ii=layer.msg('正在解绑,请稍候。。。',{time:0});
  324. $.ajax({
  325. url:'<?php echo $this->createUrl('parent/unbind')?>',
  326. type:'POST',
  327. dataType:'json',
  328. data:{'parent_id':parent_id,'student_id':student_id},
  329. success:function(res){
  330. layer.close(ii);
  331. if(res.status==1){
  332. layer.msg('操作成功');
  333. $('#'+row_id).closest('tr').find('.mobile').html('');
  334. $('#'+row_id).closest('tr').find('.time').html('');
  335. $('#'+row_id).closest('tr').find('.action').html('');
  336. $('#'+row_id).closest('tr').find('.stype').html('');
  337. }else{
  338. layer.msg('操作失败');
  339. }
  340. }
  341. });
  342. })
  343. // $('.teacher-name-msg').blur(function(){
  344. // $(this).attr('title',$(this).val())
  345. // })
  346. $('.edit-class').click(function(){
  347. $(this).hide();
  348. $('.edit-opts').show();
  349. $('.main-teacher').removeClass('read-only')
  350. $('.teacher-name-msg').removeClass('read-only')
  351. $('.main-teacher').attr('disabled',false)
  352. $('.teacher-name-msg').attr('disabled',false)
  353. })
  354. $('.edit-cancel-btn').click(function(){
  355. $('.edit-opts').hide();
  356. $('.edit-class').show()
  357. $('.main-teacher').addClass('read-only')
  358. $('.teacher-name-msg').addClass('read-only')
  359. $('.main-teacher').attr('disabled',true)
  360. $('.teacher-name-msg').attr('disabled',true)
  361. $('#teacher_form')[0].reset();
  362. })
  363. //保存修改
  364. $('.edit-save-btn').click(function(){
  365. var class_id=$('input[name=class_id]').val();
  366. var main_teacher=0;
  367. if($('input[name=main-teacher]').val()!='' && $('input[name=main-teacher]').val()!='-'){
  368. main_teacher=$('input[name=main-teacher]').attr('teacher_id');
  369. if(main_teacher=='' || main_teacher==undefined){
  370. layer.msg('班主任不存在或设置不正确');
  371. $('input[name=main-teacher]').val('-')
  372. return false;
  373. }
  374. }
  375. var teacher_subject=[];
  376. //console.log(main_teacher);return false;
  377. for(var i=0;i<$('.teacher-name-msg').length;i++){
  378. if($('.teacher-name-msg').eq(i).val()!='' && $('.teacher-name-msg').eq(i).val()!='-'){
  379. var subject=$('.teacher-name-msg').eq(i).attr('data');
  380. var teacher_id=$('.teacher-name-msg').eq(i).attr('teacher_id');
  381. if(teacher_id=='' || teacher_id==undefined){
  382. layer.msg('教师不存在或设置不正确');
  383. $('.teacher-name-msg').eq(i).val('-');
  384. return false;
  385. }
  386. teacher_subject[subject]=teacher_id;
  387. }
  388. }
  389. $.ajax({
  390. url:'<?php echo $this->createUrl('parent/saveClassTeacher')?>',
  391. type:'POST',
  392. dataType:'json',
  393. data:{'cid':class_id,'main_teacher':main_teacher,'teacher_subject':teacher_subject},
  394. success:function(res){
  395. if(res.status==0){
  396. if(res.msg!=undefined){
  397. layer.msg(res.msg);
  398. }else{
  399. layer.msg('保存失败');
  400. }
  401. }else{
  402. layer.msg('保存成功');
  403. $('.edit-opts').hide();
  404. $('.edit-class').show();
  405. $('.main-teacher').removeClass('read-only');
  406. $('.teacher-name-msg').removeClass('read-only');
  407. $('.main-teacher').attr('disabled',true);
  408. $('.teacher-name-msg').attr('disabled',true);
  409. }
  410. }
  411. });
  412. })
  413. $('.teacher-name-msg').bind('input propertychange', function() {
  414. // $(this).parent().find('.name-con').show();
  415. var obj_list=$(this).parent().find('.name-con');
  416. var keyword=$(this).val();
  417. var subject=$(this).attr('data');
  418. var class_id=$('input[name=class_id]').val();
  419. if(keyword==''){
  420. return false;
  421. }
  422. $(this).attr('teacher_id','');
  423. $.ajax({
  424. url:'<?php echo $this->createUrl('parent/loadTeacher')?>',
  425. type:'POST',
  426. dataType:'json',
  427. data:{'keyword':keyword,'subject':subject,'class_id':class_id},
  428. success:function(res){
  429. if(res.status==1){
  430. var html='';
  431. if(res.data.length>0){
  432. for(var i=0;i<res.data.length;i++){
  433. html+='<li class="name-list" id="'+res.data[i]['teacher_id']+'">'+res.data[i]['teacher_name']+'('+res.data[i]['subject_name']+')</li>';
  434. }
  435. obj_list.html(html);
  436. obj_list.show();
  437. }
  438. }
  439. }
  440. });
  441. });
  442. //加载班主任教师
  443. $('.main-teacher').bind('input propertychange', function() {
  444. var obj_list=$(this).parent().find('.name-con');
  445. var keyword=$(this).val();
  446. var class_id=$('input[name=class_id]').val();
  447. if(keyword==''){
  448. return false;
  449. }
  450. $(this).attr('teacher_id','');
  451. $.ajax({
  452. url:'<?php echo $this->createUrl('parent/loadTeacher')?>',
  453. type:'POST',
  454. dataType:'json',
  455. data:{'keyword':keyword,'class_id':class_id},
  456. success:function(res){
  457. if(res.status==1){
  458. var html='';
  459. if(res.data.length>0){
  460. for(var i=0;i<res.data.length;i++){
  461. html+='<li class="name-list" id="'+res.data[i]['teacher_id']+'">'+res.data[i]['teacher_name']+'('+res.data[i]['subject_name']+')</li>';
  462. }
  463. obj_list.html(html);
  464. obj_list.show();
  465. }
  466. }
  467. }
  468. });
  469. });
  470. $('.teacher-list').on('click','.name-list',function(){
  471. $(this).closest('.teacher-list').find('.teacher-name-msg').val($(this).html());
  472. $(this).closest('.teacher-list').find('.teacher-name-msg').attr('teacher_id',$(this).attr('id'));
  473. $(this).closest('.teacher-list').find('.teacher-name-msg').attr('title',$(this).html());
  474. $(this).closest('.teacher-list').find('.name-con').hide();
  475. })
  476. /*
  477. $('.main-teacher').on('blur', function() {
  478. $(this).parent().find('.name-con').hide();
  479. });
  480. $('.teacher-name-msg').on('blur', function() {
  481. $(this).parent().find('.name-con').hide();
  482. });
  483. */
  484. // 点击空白处下拉列表消失
  485. $(document).click(function(e){
  486. var targetNode = $(e.target).closest(".teacher-list");
  487. if (targetNode.length>0){
  488. return;
  489. }else{
  490. $(".name-con").hide();
  491. }
  492. });
  493. $('.class-adviser').on('click','.name-list',function(){
  494. $(this).closest('.class-adviser').find('.main-teacher').val($(this).html());
  495. $(this).closest('.class-adviser').find('.main-teacher').attr('teacher_id',$(this).attr('id'));
  496. $(this).closest('.class-adviser').find('.main-teacher').attr('title',$(this).html());
  497. $(this).closest('.class-adviser').find('.name-con').hide();
  498. })
  499. $('.bind_code_log').click(function(){
  500. $.ajax({
  501. url:'<?php echo $this->createUrl('parent/bindCodeLog')?>',
  502. type:'POST',
  503. dataType:'json',
  504. data:{cid:'<?php echo $cid?>'},
  505. success:function(res){
  506. if(res.status==1){
  507. html='<tr><td>时间</td><td>学生</td><td>手机号</td><td>绑定码</td></tr>';
  508. if(res.data.length>0){
  509. for(var i=0;i<res.data.length;i++){
  510. html+='<tr>';
  511. html+='<td>'+res.data[i]['time']+'</td>';
  512. html+='<td>'+res.data[i]['student_name']+'</td>';
  513. html+='<td>'+res.data[i]['mobile']+'</td>';
  514. html+='<td>'+res.data[i]['code']+'</td>';
  515. html+='</tr>';
  516. }
  517. }
  518. console.log(html);
  519. $('#dynamic-table').html(html);
  520. $('#fieldModal').show();
  521. }
  522. }
  523. });
  524. });
  525. $('.icon-close').click(function(){
  526. $('#fieldModal').hide();
  527. });
  528. </script>