handle_card.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  1. <link type="text/css" rel="stylesheet" href="/css/needDetail.css" />
  2. <style>
  3. html {overflow-y: scroll;}
  4. </style>
  5. <div class="main-content-inner">
  6. <!-- 导航栏开始-->
  7. <ul class="clearfix main-content-inner-ul">
  8. <?php if(Yii::app()->session['coachInfo']['leader']==1){?>
  9. <li class="pull-left">
  10. <button onclick='location.href="<?php echo $this->createUrl("semester/index");?>"' class="button button_normal button_group button_arrow" data-button="red">学期管理</button>
  11. <img src="/images/line.jpg" style="height:45px;" />
  12. </li>
  13. <?php }?>
  14. <li class="pull-left">
  15. <button onclick='location.href="<?php echo $this->createUrl("teacher/index");?>"' class="button button_normal button_group button_arrow" data-button="red">教师管理</button>
  16. <img src="/images/line.jpg" style="height:45px;" />
  17. </li>
  18. <li class="pull-left">
  19. <button onclick='location.href="<?php echo $this->createUrl("classes/index");?>"' class="button button_normal button_group button_arrow" data-button="red">班级管理</button>
  20. <img src="/images/line.jpg" style="height:45px;" />
  21. </li>
  22. <li class="pull-left">
  23. <button onclick='location.href="<?php echo $this->createUrl("studentinfo/index");?>"' class="button button_normal button_group button_arrow button_active" data-button="red">学生管理</button>
  24. <img src="/images/line.jpg" style="height:45px;" />
  25. </li>
  26. <li class="pull-left">
  27. <button onclick='location.href="<?php echo $this->createUrl("classes/export");?>"' class="button button_normal button_group button_arrow " data-button="red">导出学生</button>
  28. <img src="/images/line.jpg" style="height:45px;" />
  29. </li>
  30. </ul>
  31. <!-- 导航栏结束-->
  32. <div class="layout-gap">
  33. <section class="hrn-top flex">
  34. <div class="flex-one hrn-top-title fw">重名学生</div>
  35. <div class="green-font pointer" onclick="javascript:history.go(-1);">返回</div>
  36. <div class="check-btn pointer save_student_id" data="">检查</div>
  37. </section>
  38. <section class="flex hrn-main-con">
  39. <article class="menu-list-con">
  40. <div class="menu-list-top">
  41. <span class="green-font pointer fw prev-menu-page vtm" rel="<?php echo $page;?>">&lt;</span>
  42. <span class="vtm showpage">第<?php echo $page;?>页</span>
  43. <span class="green-font pointer fw next-menu-page vtm" rel="<?php echo $page;?>">&gt;</span>
  44. <span class="vtm totalpage">共<?php echo $total_page;?>页</span>
  45. <input type="hidden" name="total_page" value="<?php if(isset($total_page)) echo $total_page?>">
  46. </div>
  47. <div class="search-opt">
  48. </div>
  49. <ul class="name-key-datas">
  50. <?php
  51. if(isset($name_group)){
  52. foreach ($name_group as $key=> $val){
  53. ?>
  54. <li class="name-key-list flex">
  55. <div class="flex-one"><?php echo $val['modify_name'];?></div>
  56. <div class="gray-font"><?php echo $val['count'];?></div>
  57. </li>
  58. <?php
  59. }
  60. }
  61. ?>
  62. </ul>
  63. </article>
  64. <article class="flex-one handle-detail-con">
  65. <span>处理办法:<br>(1)若导入新生,excel中有学生重名,请输入身份证号后点击“检查”<br>(2)若导入的学生已有系统账号,可选择序号来对应,选好序号后点击“检查”</span>
  66. <div class="handle-detail-top flex">
  67. <div class="flex-one">
  68. <p>excel中重名学生:</p>
  69. </div>
  70. </div>
  71. <div class="handle-detail-main-excel">
  72. </div>
  73. <div class="handle-detail-top flex">
  74. <div class="flex-one">
  75. <p>学校已存在重名学生:</p>
  76. </div>
  77. </div>
  78. <div class="handle-detail-main">
  79. </div>
  80. </article>
  81. </section>
  82. </div>
  83. </div>
  84. <div class="history-pop">
  85. <div class="history-pop-con">
  86. <div class="need-pop-top clearfix">
  87. <div class="npt-title put-need fl">查看历史成绩</div>
  88. <div class="npt-close fr">×</div>
  89. </div>
  90. <table class="history-mark-table">
  91. <thead class="fw">
  92. <td>考试日期</td>
  93. <td>试卷名称</td>
  94. <td>我的得分</td>
  95. <td>班级平均分</td>
  96. <td>年级平均分</td>
  97. <td>班级排名</td>
  98. <td>年级排名</td>
  99. </thead>
  100. <tbody id="exam_list">
  101. </tbody>
  102. </table>
  103. </div>
  104. </div>
  105. <div class="countermark-pop">
  106. <div class="countermark-pop-con">
  107. <div class="need-pop-top clearfix">
  108. <div class="npt-title put-need fl">查看副号</div>
  109. <div class="npt-close fr">×</div>
  110. </div>
  111. <div class="flex relative">
  112. <img src="/images/prev-arrow.png" alt="" class="prev-arrow-pop arrow-img pointer">
  113. <div class="countermark-datas flex-one">
  114. <ul class="clearfix countermark-list-detail">
  115. </ul>
  116. </div>
  117. <img src="/images/next-arrow.png" alt="" class="next-arrow-pop arrow-img pointer">
  118. </div>
  119. </div>
  120. </div>
  121. <div class="pop-sec-time">处理成功!即将进入下一组</div>
  122. <script>
  123. $(function(){
  124. var data,idxStar,idxEnd,startCardId,endCardId;
  125. var now_name; //当前正在处理的哪一组
  126. var now_menu_index=0;
  127. //默认加载第一组
  128. next_name=$('.name-key-datas').find('li').eq(0).find('.flex-one').html();
  129. loadStudent(next_name,now_menu_index);
  130. //分页
  131. $('.prev-menu-page').click(function () {
  132. var page=$(this).attr('rel');
  133. var name_like=$.trim($('input[name=name_like]').val());
  134. if(page==1){
  135. return false;
  136. }
  137. loadmenu(page-1,name_like,'');
  138. });
  139. $('.next-menu-page').click(function(){
  140. var total_page=parseInt($('input[name=total_page]').val());
  141. var page=parseInt($(this).attr('rel'));
  142. var name_like=$.trim($('input[name=name_like]').val());
  143. if((page+1)>total_page){
  144. return false;
  145. }
  146. loadmenu(page+1,name_like,'');
  147. });
  148. $('.search-btn-img').click(function(){
  149. var name_like=$.trim($('.search-key-value').val());
  150. if(name_like==''){
  151. return false;
  152. }
  153. loadmenu(1,name_like,'');
  154. });
  155. $('.name-key-datas')
  156. .on('click','.flex-one',function(){
  157. var name=$(this).html();
  158. loadStudent(name,$(this).closest('.name-key-list').index());
  159. });
  160. function loadmenu(page,name_like,next_name){
  161. page=parseInt(page);
  162. $.ajax({
  163. url:'<?php echo $this->createUrl('importstudent/handle_repeat')?>',
  164. type:'POST',
  165. data:{'page':page,'name':name_like},
  166. dataType:'json',
  167. success:function(res){
  168. if(res.status==1){
  169. var html='';
  170. for(var i=0;i<res.data.length;i++){
  171. html+='<li class="name-key-list flex">';
  172. html+='<div class="flex-one">'+res.data[i]['student_name']+'</div>';
  173. html+='<div class="gray-font">'+res.data[i]['count']+'</div>';
  174. html+='</li>';
  175. }
  176. $('.name-key-datas').html(html);
  177. $('.prev-menu-page').attr('rel',page);
  178. $('.next-menu-page').attr('rel',page);
  179. $('.showpage').html('第'+(page)+'页');
  180. $('.totalpage').html('共'+res.total_page+'页');
  181. $('input[name=total_page]').val(res.total_page);
  182. if(next_name!=''){
  183. loadStudent(next_name,now_menu_index);
  184. }
  185. }
  186. }
  187. });
  188. }
  189. function loadStudent(name,index){
  190. if(name==''){
  191. return false;
  192. }
  193. $('.pop-sec-time').html('正在加载中。。。。。。');
  194. $('.pop-sec-time').show();
  195. $.ajax({
  196. url:'<?php echo $this->createUrl('importstudent/showrepeatstudent')?>',
  197. type:'POST',
  198. data:{'name':name},
  199. dataType:'json',
  200. success:function(res){
  201. if(res.status==1){
  202. $('.handle-detail-main').html(res.html);
  203. $('.handle-detail-main-excel').html(res.excel_html);
  204. now_name=name;
  205. now_menu_index=index;
  206. $('.save_student_id').attr('data',name);
  207. }
  208. $('.pop-sec-time').hide();
  209. }
  210. });
  211. }
  212. function arrowImgShow() {
  213. $('.handel-term-list').each(function(){
  214. if ($(this).find('.term-card-list').length<4) {
  215. $(this).find('.arrow-img').hide();
  216. } else {
  217. $(this).find('.arrow-img').show();
  218. }
  219. })
  220. }
  221. arrowImgShow();
  222. $('.npt-close').click(function(){
  223. $('.history-pop,.countermark-pop,.relate-sure-pop').hide();
  224. })
  225. $(document)
  226. .on('click','.next-arrow-pop',function () {
  227. var listLen = $(this).prev('.countermark-datas').find('.countermark-list-detail li').length;
  228. var leftNum = $(this).prev('.countermark-datas').find('.countermark-list-detail').position().left-60;
  229. console.log('22');
  230. if (leftNum/(listLen-2)==-288) {
  231. alert('已经是最后第一条了')
  232. } else {
  233. $(this).prev('.countermark-datas').find('.countermark-list-detail').css('left',leftNum-288);
  234. }
  235. })
  236. .on('click','.prev-arrow',function(){
  237. var leftNum = $(this).next('.term-card-layout').find('.term-card-detail').position().left-40;
  238. var lisWidth = $(this).next('.term-card-layout').find('.term-card-detail li').width();
  239. if (leftNum==0) {
  240. alert('已经是第一条了')
  241. } else {
  242. $(this).next('.term-card-layout').find('.term-card-detail').css('left',leftNum+lisWidth);
  243. $('.hide-list').hide();
  244. $('.toggle-opt-btn').text('展开');
  245. }
  246. })
  247. .on('click','.next-arrow',function(){
  248. var listLen = $(this).prev('.term-card-layout').find('.term-card-detail li').length;
  249. var leftNum = $(this).prev('.term-card-layout').find('.term-card-detail').position().left-40;
  250. var lisWidth = $(this).prev('.term-card-layout').find('.term-card-detail li').width();
  251. if (listLen<3||listLen==3||leftNum/(listLen-3)==-lisWidth||leftNum/(listLen-3)<-lisWidth) {
  252. alert('已经是最后第一条了')
  253. } else {
  254. $(this).prev('.term-card-layout').find('.term-card-detail').css('left',leftNum-lisWidth);
  255. $('.hide-list').hide();
  256. $('.toggle-opt-btn').text('展开');
  257. }
  258. })
  259. .on('click','.prev-arrow-pop',function () {
  260. var leftNum = $(this).next('.countermark-datas').find('.countermark-list-detail').position().left-60;
  261. if (leftNum<0) {
  262. $(this).next('.countermark-datas').find('.countermark-list-detail').css('left',leftNum+288);
  263. } else {
  264. alert('已经是第一条了')
  265. }
  266. })
  267. $('.search-key-value').keyup(function(){
  268. if ($('.search-key-value').val()!=="") {
  269. $('.clear-search-value').show()
  270. } else {
  271. $('.clear-search-value').hide()
  272. }
  273. })
  274. $('.clear-search-value').click(function(){
  275. $('.search-key-value').val('');
  276. $(this).hide()
  277. })
  278. var target_id;
  279. $(document)
  280. .on('click','.toggle-opt-btn',function(){
  281. if ($(this).text()=='展开') {
  282. $(this).text('收起')
  283. } else {
  284. $(this).text('展开')
  285. }
  286. $(this).closest('.term-card-list').find('.hide-list').toggle();
  287. })
  288. .on('click','.browse-history',function(){
  289. var student_id=$(this).attr('rel');
  290. console.log(student_id);
  291. $.ajax({
  292. url:'<?php echo $this->createUrl('checkstudent/gethistoryscore')?>',
  293. type:'POST',
  294. dataType:'json',
  295. data:{'student_id':student_id},
  296. success:function(res){
  297. if(res.status==1){
  298. var list=res.data,html='';
  299. for(var i=0;i<list.length;i++){
  300. html+='<tr>';
  301. html+='<td>'+list[i]['exam_date']+'</td>';
  302. html+='<td>'+list[i]['exam_name']+'</td>';
  303. html+='<td>'+list[i]['score']+'</td>';
  304. html+='<td>'+list[i]['class_avg']+'</td>';
  305. html+='<td>'+list[i]['grade_avg']+'</td>';
  306. html+='<td>'+list[i]['class_rank']+'</td>';
  307. html+='<td>'+list[i]['grade_rank']+'</td>';
  308. html+='</tr>';
  309. }
  310. $('#exam_list').html(html);
  311. $('.history-pop').show();
  312. }
  313. }
  314. });
  315. })
  316. .on('click','.fuhao-lock',function(){
  317. var student_id=$(this).attr('rel');
  318. var fuhao_number=parseInt($(this).html());
  319. if(fuhao_number>0){
  320. $.ajax({
  321. url:'<?php echo $this->createUrl('checkstudent/getslaves')?>',
  322. type:'POST',
  323. dataType:'json',
  324. data:{'student_id':student_id},
  325. success:function(res){
  326. if(res.status==1){
  327. $('.countermark-list-detail').html(res.data);
  328. if ($('.countermark-list-detail li').length<3) {
  329. $('.countermark-pop-con').find('.arrow-img').hide()
  330. }
  331. $('.countermark-pop').show();
  332. }
  333. }
  334. });
  335. }
  336. })
  337. .on('click','.save_student_id',function(){//关联学生Id
  338. select_obj=$('.nToId');
  339. console.log(select_obj.length);
  340. sidToTid=new Array();
  341. for(var i=0;i<select_obj.length;i++){
  342. student_id=select_obj.eq(i).closest('.term-card-list').attr('id');
  343. temp_id=select_obj.eq(i).val();
  344. if(temp_id>0){
  345. sidToTid.push(student_id+'///'+temp_id);
  346. }
  347. }
  348. $.ajax({
  349. url:'<?php echo $this->createUrl('importstudent/repeat_check')?>',
  350. type:'POST',
  351. dataType:'json',
  352. data:{'str':sidToTid,'name':now_name},
  353. success:function(res){
  354. if(res.status==1){
  355. layer.msg('操作成功');
  356. window.location.reload();
  357. }else{
  358. if(res.msg!=undefined){
  359. layer.msg(res.msg);
  360. }else{
  361. layer.msg('关联失败');
  362. }
  363. }
  364. }
  365. });
  366. })
  367. $('.handle-detail-main-excel')
  368. .on('change','.change_card',function(){
  369. var new_card=$(this).val();
  370. var id=$(this).attr('id');
  371. var old_data=$(this).attr('data');
  372. var pattern = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
  373. if(pattern.test(new_card)){
  374. changeValue(new_card,id,$(this));
  375. }else{
  376. layer.msg('身份证号码格式不正确');
  377. $(this).val(old_data);
  378. return false;
  379. }
  380. })
  381. function changeValue(value,id,obj){
  382. if(value=='' || value==undefined){
  383. return false;
  384. }
  385. if(id=='' || id==undefined){
  386. return false;
  387. }
  388. indexSend=layer.msg('正在修改,请稍候......',{time:0});
  389. $.ajax({
  390. url:'<?php echo $this->createUrl('importstudent/change_idnumber')?>',
  391. type:'POST',
  392. dataType:'json',
  393. data:{'id':id,'value':value},
  394. success:function(res){
  395. layer.close(indexSend);
  396. if(res.status==1){
  397. layer.msg('修改成功');
  398. obj.attr('data',value);
  399. }else{
  400. if(res.msg!=undefined){
  401. layer.msg(res.msg);
  402. obj.val(obj.attr('data'));
  403. }else{
  404. layer.msg('修改失败');
  405. obj.val(obj.attr('data'));
  406. }
  407. }
  408. }
  409. });
  410. }
  411. })
  412. </script>