excelinfo.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <link type="text/css" rel="stylesheet" href="/css/needDetail.css" />
  2. <style>
  3. .handle{float: right}
  4. </style>
  5. <div class="main-content-inner">
  6. <!-- 导航栏开始-->
  7. <?php include(Yii::app()->basePath.'/views/layouts/class_navigation.php');?>
  8. <!-- 导航栏结束-->
  9. <div class="layout-gap">
  10. <section class="anc-top flex status_1 ">
  11. <div class="flex-one flex">
  12. <p class="anc-title">导入教师</p>
  13. </div>
  14. </section>
  15. <section class="anc-main-con">
  16. <div class="form-group">
  17. <label class="control-label col-xs-12 col-sm-1 no-padding-right">模板示例<span class="errorMessage">*</span>:</label>
  18. <div class="col-sm-11">
  19. <table id="template" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable">
  20. <tr>
  21. <th width="1"></th>
  22. <th>A</th>
  23. <th>B</th>
  24. <th>C</th>
  25. <th>D</th>
  26. <th>E</th>
  27. <th>F</th>
  28. <th>G</th>
  29. <th>H</th>
  30. <th>I</th>
  31. <th>J</th>
  32. <th>K</th>
  33. <th>L</th>
  34. <th>M</th>
  35. <th>N</th>
  36. <th class="hide custom_field_no">I</th>
  37. </tr>
  38. <tr>
  39. <th></th>
  40. <th>班级</th>
  41. <th>学期</th>
  42. <th>年级</th>
  43. <th>班主任</th>
  44. <th>语文</th>
  45. <th>数学</th>
  46. <th>英语</th>
  47. <th>物理</th>
  48. <th>化学</th>
  49. <th>生物</th>
  50. <th>政治</th>
  51. <th>历史</th>
  52. <th>地理</th>
  53. <th>其它</th>
  54. <th class="hide custom_field"></th>
  55. </tr>
  56. <tr>
  57. <th>1</th>
  58. <th><?php if(Yii::app()->params['section']==0){echo '初一1班';}else{ echo '高一1班'; }?></th>
  59. <th>2018-2019学年下学期</th>
  60. <th><?php if(Yii::app()->params['section']==0){echo '初一';}else{ echo '高一'; }?></th>
  61. <th></th>
  62. <th></th>
  63. <th></th>
  64. <th></th>
  65. <th></th>
  66. <th></th>
  67. <th></th>
  68. <th></th>
  69. <th></th>
  70. <th></th>
  71. <th></th>
  72. <th class="hide custom_field_value"></th>
  73. </tr>
  74. </table>
  75. </div>
  76. </div>
  77. <div class="form-group">
  78. <label class="control-label col-xs-12 col-sm-1 no-padding-right">填写须知<span class="errorMessage">*</span>:</label>
  79. <div class="col-sm-11">
  80. <div> 1、班级填写班主任后才成立</div>
  81. <div>2、教师姓名:只能填写汉字</div>
  82. <div> 3、班级、学期、年级、三项不可更改,学科老师对应填写</div>
  83. </div>
  84. </div>
  85. <div class="clearfix form-actions">
  86. <div class="col-md-offset-1">
  87. <a class="btn label-primary-green btn-sm" href="<?php echo $this->createUrl('parent/downloadexcel');?>">
  88. 下载excel模板
  89. </a>
  90. <div>
  91. <span class="red-font">*请下载excel模版,内有班级信息请下载后填写再上传</span>
  92. </div>
  93. </div>
  94. </div>
  95. <div class="clearfix form-actions">
  96. <div class="col-md-offset-1">
  97. <div class="btn label-primary-green btn-sm select_file" >上传excel</div>
  98. <form id="form1" action="<?php echo $this->createUrl('parent/import')?>" method="post" enctype="multipart/form-data">
  99. <input type="file" name="file" id="uploadFile" style="display: none">
  100. </form>
  101. </div>
  102. </div>
  103. </section>
  104. </div>
  105. </div>
  106. <div class="anc-pop">
  107. <div class="confirm-pop-con">
  108. <div class="need-pop-top clearfix">
  109. <div class="npt-title put-need fl">提示</div>
  110. <div class="npt-close fr">×</div>
  111. </div>
  112. <div class="confirm-msg red-font tac">
  113. 确认要放弃本次上传的数据吗?
  114. </div>
  115. <div class="pop-btns">
  116. <div class="confirm-pop-btn-sure">确认</div>
  117. <div class="confirm-pop-btn-cancel cancel-btn">取消</div>
  118. </div>
  119. </div>
  120. </div>
  121. <script>
  122. $(function(){
  123. /*
  124. $('.begain-check-btn').click(function(){
  125. $('.anc-status-con').removeClass('hide');
  126. $(this).hide();
  127. $('.anc-index-msg').hide();
  128. loadStudent();
  129. });
  130. */
  131. //checkFirst();
  132. //保存结果
  133. $('.save_result').click(function(){
  134. var l_index=layer.msg('导入中,请稍候......',{time:0});
  135. $.ajax({
  136. url:'<?php echo $this->createUrl('record/update_score')?>',
  137. dataType:'json',
  138. type:'POST',
  139. success:function(res){
  140. layer.close(l_index);
  141. if(res.status==1){
  142. layer.msg('导入成功',function(){
  143. window.location.href="<?php echo $this->createUrl('record/importscore')?>";
  144. });
  145. }else{
  146. layer.msg('导入失败');
  147. }
  148. }
  149. });
  150. });
  151. // //第一步,检测数据
  152. // function checkFirst(){
  153. // var count=0;
  154. // $.ajax({
  155. // url:'<?php //echo $this->createUrl('record/Check_field_first')?>//',
  156. // dataType:'json',
  157. // type:'POST',
  158. // success:function(res){
  159. // if(res.status==1){
  160. // $('.first').addClass('finish-status');
  161. // $('.first').removeClass('now-status');
  162. // $('.first .status-charact').html('检查完成,导入的excel格式正确');
  163. // <?php //if($need_check_name==1):?>
  164. // checkAbnormal();
  165. // <?php //else:?>
  166. // checkRepeat();
  167. // <?php //endif;?>
  168. // }else{
  169. // $('.first').addClass('error-status');
  170. // $('.first').removeClass('now-status');
  171. // $('.first .status-charact').html('导入的excel格式与模版不一致,请重新上传:'+res.msg);
  172. // }
  173. // }
  174. // });
  175. // }
  176. //第二步,姓名异常
  177. function checkAbnormal(){
  178. $('.second .status-charact').html('正在检测...');
  179. $('.second').addClass('now-status');
  180. $.ajax({
  181. url:'<?php echo $this->createUrl('record/check_student_name')?>',
  182. dataType:'json',
  183. type:'POST',
  184. success:function(res){
  185. if(res.status==1){
  186. count=res.count;
  187. $('.second .status-charact').html('检测完成,已为'+count+'名学生去除姓名中的非汉字字符');
  188. $('.second').addClass('finish-status');
  189. $('.second').removeClass('now-status');
  190. checkRepeat();
  191. }else{
  192. $('.second .status-charact').html('检测失败');
  193. $('.second').addClass('error-status');
  194. $('.second').removeClass('now-status');
  195. }
  196. }
  197. });
  198. }
  199. //第三步
  200. function checkRepeat(){
  201. $('.fourth .status-charact').html('正在检测...');
  202. $('.fourth').addClass('now-status');
  203. $.ajax({
  204. url:'<?php echo $this->createUrl('record/matching')?>',
  205. dataType:'json',
  206. type:'POST',
  207. success:function(res){
  208. if(res.status==1){
  209. var html='';
  210. if(res.repeat>0){
  211. html+='<p>重名学生<span class="handle"><a href="<?php echo $this->createUrl('record/handle_repeat')?>">'+res.repeat+'组</a></span></p>';
  212. }else{
  213. html+='<p>重名学生<span class="handle">'+res.repeat+'组</span></p>';
  214. }
  215. if(res.noExistent>0){
  216. html+='<p>学生在系统中不存在<span class="handle"><a href="<?php echo $this->createUrl('record/handle_existent')?>">'+res.noExistent+'人</a></span></p>';
  217. }else{
  218. html+='<p>学生在系统中不存在<span class="handle">'+res.noExistent+'人</span></p>';
  219. }
  220. html+='<p>匹配成功<span class="handle">'+res.success+'人</span></p>';
  221. $('.third .status-charact').html(html);
  222. if(res.repeat==0 && res.success>0){
  223. $('.save_result').removeClass('hide');
  224. }
  225. $('.third').addClass('now-status');
  226. }else{
  227. $('.third .status-charact').html('检测失败,请稍后再试');
  228. $('.third').addClass('error-status');
  229. $('.third').removeClass('now-status');
  230. }
  231. }
  232. });
  233. }
  234. $('.give-up-check').click(function(){
  235. $('.anc-pop').show()
  236. })
  237. $('.npt-close,.confirm-pop-btn-cancel').click(function(){
  238. $('.anc-pop').hide()
  239. })
  240. $('.confirm-pop-btn-sure').click(function () {
  241. $.ajax({
  242. url:'<?php echo $this->createUrl('record/giveup')?>',
  243. dataType:'json',
  244. type:'POST',
  245. success:function(res){
  246. if(res.status==1){
  247. $('.anc-pop').hide();
  248. window.location.href='<?php echo $this->createUrl('record/importscore')?>';
  249. }else{
  250. $('.anc-pop').hide();
  251. }
  252. }
  253. });
  254. });
  255. $('#uploadFile').val('');
  256. $('.select_file').click(function(){
  257. $('#uploadFile').click();
  258. });
  259. $('#uploadFile').change(function(){
  260. if($('#uploadFile').val()!=''){
  261. $('#form1').submit();
  262. }
  263. });
  264. })
  265. </script>