handle_card_img.php 18 KB

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