handle.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  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. <?php include(Yii::app()->basePath.'/views/layouts/view_navigation.php');?>
  8. <!-- 导航栏结束-->
  9. <div class="layout-gap">
  10. <section class="hrn-top flex">
  11. <div class="flex-one hrn-top-title fw">导入成绩</div>
  12. <div class="green-font pointer" onclick="javascript:history.go(-1);">返回</div>
  13. </section>
  14. <section class="flex hrn-main-con">
  15. <article class="menu-list-con">
  16. <div class="menu-list-top">
  17. <span class="green-font pointer fw prev-menu-page vtm" rel="<?php echo $page;?>">&lt;</span>
  18. <span class="vtm showpage">第<?php echo $page;?>页</span>
  19. <span class="green-font pointer fw next-menu-page vtm" rel="<?php echo $page;?>">&gt;</span>
  20. <span class="vtm totalpage">共<?php echo $total_page;?>页</span>
  21. <input type="hidden" name="total_page" value="<?php if(isset($total_page)) echo $total_page?>">
  22. </div>
  23. <div class="search-opt">
  24. <div class="search-inp vtm">
  25. <input type="text" name="name_like" placeholder="姓名关键字" class="search-key-value">
  26. <div class="clear-search-value pointer">×</div>
  27. </div>
  28. <img src="/images/search.png" alt="" class="search-btn-img pointer vtm">
  29. </div>
  30. <ul class="name-key-datas">
  31. <?php
  32. if(isset($name_group)){
  33. foreach ($name_group as $key=> $val){
  34. ?>
  35. <li class="name-key-list flex">
  36. <div class="flex-one"><?php echo $val['check_field_value'];?></div>
  37. <div class="gray-font"><?php echo $val['count'];?></div>
  38. </li>
  39. <?php
  40. }
  41. }
  42. ?>
  43. </ul>
  44. </article>
  45. <article class="flex-one handle-detail-con">
  46. <div class="handle-detail-top flex">
  47. <div class="flex-one">
  48. <p>excel中重名学生:</p>
  49. </div>
  50. </div>
  51. <div class="handle-detail-main-excel">
  52. </div>
  53. <div class="handle-detail-top flex">
  54. <div class="flex-one">
  55. <p>学校已存在重名学生:</p>
  56. </div>
  57. <span>处理办法:请为下方学生选择上方excel中对应的序号,确认即可</span>
  58. <div class="check-btn pointer save_student_id">确认</div>
  59. </div>
  60. <div class="handle-detail-main">
  61. </div>
  62. </article>
  63. </section>
  64. </div>
  65. </div>
  66. <div class="history-pop">
  67. <div class="history-pop-con">
  68. <div class="need-pop-top clearfix">
  69. <div class="npt-title put-need fl">查看历史成绩</div>
  70. <div class="npt-close fr">×</div>
  71. </div>
  72. <table class="history-mark-table">
  73. <thead class="fw">
  74. <td>考试日期</td>
  75. <td>试卷名称</td>
  76. <td>我的得分</td>
  77. <td>班级平均分</td>
  78. <td>年级平均分</td>
  79. <td>班级排名</td>
  80. <td>年级排名</td>
  81. </thead>
  82. <tbody id="exam_list">
  83. </tbody>
  84. </table>
  85. </div>
  86. </div>
  87. <div class="countermark-pop">
  88. <div class="countermark-pop-con">
  89. <div class="need-pop-top clearfix">
  90. <div class="npt-title put-need fl">查看副号</div>
  91. <div class="npt-close fr">×</div>
  92. </div>
  93. <div class="flex relative">
  94. <img src="/images/prev-arrow.png" alt="" class="prev-arrow-pop arrow-img pointer">
  95. <div class="countermark-datas flex-one">
  96. <ul class="clearfix countermark-list-detail">
  97. </ul>
  98. </div>
  99. <img src="/images/next-arrow.png" alt="" class="next-arrow-pop arrow-img pointer">
  100. </div>
  101. </div>
  102. </div>
  103. <div class="relate-sure-pop">
  104. <div class="relate-sure-pop-con">
  105. <div class="need-pop-top clearfix">
  106. <div class="npt-title put-need fl">提示</div>
  107. <div class="npt-close fr">×</div>
  108. </div>
  109. <div class="confirm-msg red-font tac">
  110. 确认要关联学生的账号吗?
  111. </div>
  112. <div class="pop-btns">
  113. <div class="confirm-pop-btn-sure">确认关联</div>
  114. </div>
  115. </div>
  116. </div>
  117. <div class="pop-sec-time">处理成功!即将进入下一组</div>
  118. <script>
  119. $(function(){
  120. var data,idxStar,idxEnd,startCardId,endCardId;
  121. var now_name; //当前正在处理的哪一组
  122. var now_menu_index=0;
  123. //默认加载第一组
  124. next_name=$('.name-key-datas').find('li').eq(0).find('.flex-one').html();
  125. loadStudent(next_name,now_menu_index);
  126. //分页
  127. $('.prev-menu-page').click(function () {
  128. var page=$(this).attr('rel');
  129. var name_like=$.trim($('input[name=name_like]').val());
  130. if(page==1){
  131. return false;
  132. }
  133. loadmenu(page-1,name_like,'');
  134. });
  135. $('.next-menu-page').click(function(){
  136. var total_page=parseInt($('input[name=total_page]').val());
  137. var page=parseInt($(this).attr('rel'));
  138. var name_like=$.trim($('input[name=name_like]').val());
  139. if((page+1)>total_page){
  140. return false;
  141. }
  142. loadmenu(page+1,name_like,'');
  143. });
  144. $('.search-btn-img').click(function(){
  145. var name_like=$.trim($('.search-key-value').val());
  146. if(name_like==''){
  147. return false;
  148. }
  149. loadmenu(1,name_like,'');
  150. });
  151. $('.name-key-datas')
  152. .on('click','.flex-one',function(){
  153. var name=$(this).html();
  154. loadStudent(name,$(this).closest('.name-key-list').index());
  155. });
  156. function loadmenu(page,name_like,next_name){
  157. page=parseInt(page);
  158. $.ajax({
  159. url:'<?php echo $this->createUrl('zhiliao/handle_repeat')?>',
  160. type:'POST',
  161. data:{'page':page,'name':name_like},
  162. dataType:'json',
  163. success:function(res){
  164. if(res.status==1){
  165. var html='';
  166. for(var i=0;i<res.data.length;i++){
  167. html+='<li class="name-key-list flex">';
  168. html+='<div class="flex-one">'+res.data[i]['check_field_value']+'</div>';
  169. html+='<div class="gray-font">'+res.data[i]['count']+'</div>';
  170. html+='</li>';
  171. }
  172. $('.name-key-datas').html(html);
  173. $('.prev-menu-page').attr('rel',page);
  174. $('.next-menu-page').attr('rel',page);
  175. $('.showpage').html('第'+(page)+'页');
  176. $('.totalpage').html('共'+res.total_page+'页');
  177. $('input[name=total_page]').val(res.total_page);
  178. if(next_name!=''){
  179. loadStudent(next_name,now_menu_index);
  180. }
  181. }
  182. }
  183. });
  184. }
  185. function loadStudent(name,index){
  186. if(name==''){
  187. return false;
  188. }
  189. $('.pop-sec-time').html('正在加载中。。。。。。');
  190. $('.pop-sec-time').show();
  191. $.ajax({
  192. url:'<?php echo $this->createUrl('zhiliao/showrepeatstudent')?>',
  193. type:'POST',
  194. data:{'name':name},
  195. dataType:'json',
  196. success:function(res){
  197. if(res.status==1){
  198. $('.handle-detail-main').html(res.html);
  199. $('.handle-detail-main-excel').html(res.excel_html);
  200. now_name=name;
  201. now_menu_index=index;
  202. }
  203. $('.pop-sec-time').hide();
  204. }
  205. });
  206. }
  207. function arrowImgShow() {
  208. $('.handel-term-list').each(function(){
  209. if ($(this).find('.term-card-list').length<4) {
  210. $(this).find('.arrow-img').hide();
  211. } else {
  212. $(this).find('.arrow-img').show();
  213. }
  214. })
  215. }
  216. arrowImgShow();
  217. $(document)
  218. .on('click','.toggle-opt-btn',function(){
  219. if ($(this).text()=='展开') {
  220. $(this).text('收起')
  221. } else {
  222. $(this).text('展开')
  223. }
  224. $(this).closest('.term-card-list').find('.hide-list').toggle();
  225. })
  226. .on('click','.prev-arrow',function(){
  227. var leftNum = $(this).next('.term-card-layout').find('.term-card-detail').position().left-40;
  228. var lisWidth = $(this).next('.term-card-layout').find('.term-card-detail li').width();
  229. if (leftNum==0) {
  230. alert('已经是第一条了')
  231. } else {
  232. $(this).next('.term-card-layout').find('.term-card-detail').css('left',leftNum+lisWidth);
  233. $('.hide-list').hide();
  234. $('.toggle-opt-btn').text('展开');
  235. }
  236. })
  237. .on('click','.next-arrow',function(){
  238. var listLen = $(this).prev('.term-card-layout').find('.term-card-detail li').length;
  239. var leftNum = $(this).prev('.term-card-layout').find('.term-card-detail').position().left-40;
  240. var lisWidth = $(this).prev('.term-card-layout').find('.term-card-detail li').width();
  241. if (listLen<3||listLen==3||leftNum/(listLen-3)==-lisWidth||leftNum/(listLen-3)<-lisWidth) {
  242. alert('已经是最后第一条了')
  243. } else {
  244. $(this).prev('.term-card-layout').find('.term-card-detail').css('left',leftNum-lisWidth);
  245. $('.hide-list').hide();
  246. $('.toggle-opt-btn').text('展开');
  247. }
  248. })
  249. .on('click','.edit-icon',function(){
  250. $(this).hide().next('.edit-self-no').show();
  251. })
  252. .on('click','.browse-history',function(){
  253. var student_id=$(this).attr('rel');
  254. console.log(student_id);
  255. $.ajax({
  256. url:'<?php echo $this->createUrl('checkstudent/gethistoryscore')?>',
  257. type:'POST',
  258. dataType:'json',
  259. data:{'student_id':student_id},
  260. success:function(res){
  261. if(res.status==1){
  262. var list=res.data,html='';
  263. for(var i=0;i<list.length;i++){
  264. html+='<tr>';
  265. html+='<td>'+list[i]['exam_date']+'</td>';
  266. html+='<td>'+list[i]['exam_name']+'</td>';
  267. html+='<td>'+list[i]['score']+'</td>';
  268. html+='<td>'+list[i]['class_avg']+'</td>';
  269. html+='<td>'+list[i]['grade_avg']+'</td>';
  270. html+='<td>'+list[i]['class_rank']+'</td>';
  271. html+='<td>'+list[i]['grade_rank']+'</td>';
  272. html+='</tr>';
  273. }
  274. $('#exam_list').html(html);
  275. $('.history-pop').show();
  276. }
  277. }
  278. });
  279. })
  280. .on('click','.fuhao-lock',function(){
  281. var student_id=$(this).attr('rel');
  282. var fuhao_number=parseInt($(this).html());
  283. if(fuhao_number>0){
  284. $.ajax({
  285. url:'<?php echo $this->createUrl('checkstudent/getslaves')?>',
  286. type:'POST',
  287. dataType:'json',
  288. data:{'student_id':student_id},
  289. success:function(res){
  290. if(res.status==1){
  291. $('.countermark-list-detail').html(res.data);
  292. if ($('.countermark-list-detail li').length<3) {
  293. $('.countermark-pop-con').find('.arrow-img').hide()
  294. }
  295. $('.countermark-pop').show();
  296. }
  297. }
  298. });
  299. }
  300. })
  301. .on('click','.relieve-relate',function(){
  302. var student_id=$(this).attr('rel');
  303. var name=$(this).attr('data');
  304. if(student_id=='' || student_id==undefined){
  305. return false;
  306. }
  307. $.ajax({
  308. url:'<?php echo $this->createUrl('checkstudent/cancelrelation')?>',
  309. dataType:'json',
  310. type:'POST',
  311. data:{'student_id':student_id},
  312. success:function(res){
  313. if(res.status==1){
  314. $('.countermark-pop').hide();
  315. loadStudent(name);
  316. }
  317. }
  318. });
  319. })
  320. $('.npt-close').click(function(){
  321. $('.history-pop,.countermark-pop,.relate-sure-pop').hide();
  322. })
  323. $(document).on('click','.next-arrow-pop',function () {
  324. var listLen = $(this).prev('.countermark-datas').find('.countermark-list-detail li').length;
  325. var leftNum = $(this).prev('.countermark-datas').find('.countermark-list-detail').position().left-60;
  326. if (leftNum/(listLen-2)==-288) {
  327. alert('已经是最后第一条了')
  328. } else {
  329. $(this).prev('.countermark-datas').find('.countermark-list-detail').css('left',leftNum-288);
  330. }
  331. })
  332. $(document).on('click','.prev-arrow-pop',function () {
  333. var leftNum = $(this).next('.countermark-datas').find('.countermark-list-detail').position().left-60;
  334. if (leftNum<0) {
  335. $(this).next('.countermark-datas').find('.countermark-list-detail').css('left',leftNum+288);
  336. } else {
  337. alert('已经是第一条了')
  338. }
  339. })
  340. $('.confirm-pop-btn-sure').click(function(){
  341. //合并操作
  342. $.ajax({
  343. url:'<?php echo $this->createUrl('checkstudent/relationhand')?>',
  344. type:'POST',
  345. dataType:'json',
  346. data:{'startCardId':startCardId,'endCardId':endCardId},
  347. success:function(res){
  348. if(res.status==1){
  349. $('#'+endCardId).find('.fuhao-lock').html(res.number);
  350. // 合并成功,删掉拖拽的元素
  351. $('.handel-term-list').eq(idxStar).find('#'+data).remove();
  352. if ($('.handel-term-list').eq(idxStar).find('li').length<4) {
  353. // 如果元素个数小于4,去掉左右箭头
  354. $('.handel-term-list').eq(idxStar).find('.arrow-img').hide();
  355. $('.handel-term-list').eq(idxStar).find('.term-card-detail').css('left',0)
  356. }
  357. }else{
  358. layer.msg(res.msg);
  359. }
  360. $('.relate-sure-pop').hide();
  361. }
  362. });
  363. })
  364. $('.search-key-value').keyup(function(){
  365. if ($('.search-key-value').val()!=="") {
  366. $('.clear-search-value').show()
  367. } else {
  368. $('.clear-search-value').hide()
  369. }
  370. })
  371. $('.clear-search-value').click(function(){
  372. $('.search-key-value').val('');
  373. $(this).hide()
  374. })
  375. var target_id;
  376. $(document).on('dragstart','.term-card-list',function(ev){
  377. // ev.dataTransfer.effectAllowed = "move";
  378. // ev.dataTransfer.setData("elId",ev.target.id);
  379. target_id = ev.target.id;
  380. $("#"+ev.target.id).addClass('moves');
  381. })
  382. $(document).on('drop','.term-card-layout',function(ev){
  383. var ev = ev? ev: window.ev
  384. var srcObj = ev.srcElement ? ev.srcElement : ev.target;
  385. ev.preventDefault();
  386. data=target_id;
  387. idxStar = $('.handel-term-list').index($('#'+data).closest('.handel-term-list'));
  388. idxEnd = $('.handel-term-list').index($(srcObj).closest('.handel-term-list'));
  389. $("#"+data).removeClass('moves');
  390. if (Math.abs(idxStar)>Math.abs(idxEnd)) {
  391. // 如果是拖拽元素上面的学期的
  392. // 获取被拖拽到的地点卡片元素的id
  393. endCardId = $(srcObj).closest('.term-card-list').attr('id');
  394. startCardId=data;
  395. $('.relate-sure-pop').show();
  396. }
  397. });
  398. $(document)
  399. .on('dragover','.term-card-layout',function(ev){
  400. ev.preventDefault();
  401. })
  402. .on('click','.save_student_id',function(){//关联学生Id
  403. select_obj=$('.nToId');
  404. console.log(select_obj.length);
  405. sidToTid=new Array();
  406. for(var i=0;i<select_obj.length;i++){
  407. student_id=select_obj.eq(i).closest('.term-card-list').attr('id');
  408. temp_id=select_obj.eq(i).val();
  409. if(temp_id>0){
  410. sidToTid.push(student_id+'///'+temp_id);
  411. }
  412. }
  413. if(sidToTid!=''){
  414. $.ajax({
  415. url:'<?php echo $this->createUrl('zhiliao/binding')?>',
  416. type:'POST',
  417. dataType:'json',
  418. data:{'str':sidToTid},
  419. success:function(res){
  420. if(res.status==1){
  421. layer.msg('操作成功');
  422. window.location.reload();
  423. }else{
  424. if(res.msg!=undefined){
  425. layer.msg(res.msg);
  426. }else{
  427. layer.msg('关联失败');
  428. }
  429. }
  430. }
  431. });
  432. }
  433. })
  434. })
  435. </script>