excelinfo.php 13 KB

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