diff --git a/README.md b/README.md index 4505cbdb..9a8beeb0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -统计学生成绩是我们日常工作中不可缺少的一部分,它为教学与学习提供参考,它的工作量又占用老师们的大量时间与精力。网上统计成绩的软件很多,与教师工作习惯相同、又能提供教师需要的数据的软件却少之又少,为让了统计成绩变得更优雅,才有了这个小学生成绩统计系统。前端采用H-ui框架,后端采用ThinkPHP框架开发。 +统计学生成绩是教育教学中不可缺少的一部分,它为教师的教与学生的学提供数据参考,它的工作量又占用老师们的大量时间与精力。网上统计成绩的软件很多,与教师工作习惯相同、又能提供教师需要的数据的软件却少之又少,开发者是一名小学教师,为让自己统计成绩工作变得更优雅,才有了这个小学生成绩统计系统。前端采用H-ui框架,后端采用ThinkPHP框架开发。更完善的功能正在开发中。 ## 主要功能: diff --git a/application/renshi/controller/Index.php b/application/renshi/controller/Index.php index 6941533b..df4e736c 100644 --- a/application/renshi/controller/Index.php +++ b/application/renshi/controller/Index.php @@ -244,16 +244,29 @@ class Index extends Base // 批量保存 public function saveAll() { - // 未完成 - // 获取表单数据 - $list = request()->only(['danwei','url'],'post'); + $list = request()->only(['school','url'],'post'); // 实例化操作表格类 - $excel = new Myexcel(); + $excel = new \app\renshi\controller\Myexcel;; // 读取表格数据 - $teacherinfo = $excel->readExcel($list['url']); + $teacherinfo = $excel->readXls($list['url']); + + // 判断表格是否正确 + if($teacherinfo[0][1] != "教师基本情况表" ) + { + $data = array('msg'=>'请使用模板上传','val'=>false,'url'=>null); + return json($data); + } + + // 删除标题行 + array_splice($stuinfo,0,3); + + // 整理数据 + $i = 0; + $teacher = array(); + @@ -320,5 +333,13 @@ class Index extends Base } + // 下载表格模板 + public function download() + { + $download = new \think\response\Download('TeacherInfo.xlsx'); + return $download->name('TeacherInfo.xlsx'); + } + + } diff --git a/application/renshi/controller/Student.php b/application/renshi/controller/Student.php index f07ff64a..8c0e858e 100644 --- a/application/renshi/controller/Student.php +++ b/application/renshi/controller/Student.php @@ -269,6 +269,14 @@ class Student extends Base // 读取表格数据 $stuinfo = $excel->readXls($list['url']); + + // 判断表格是否正确 + if($stuinfo[0][0] != "学生信息上传模板" ) + { + $data = array('msg'=>'请使用模板上传','val'=>false,'url'=>null); + return json($data); + } + // 删除标题行 array_splice($stuinfo,0,3); diff --git a/application/renshi/view/index/create_all.html b/application/renshi/view/index/create_all.html index e59cf266..b0a42af7 100644 --- a/application/renshi/view/index/create_all.html +++ b/application/renshi/view/index/create_all.html @@ -4,6 +4,12 @@ {/block} {block name="formaa"}
+
+ +
+ 友情提示:批传前请先确定上传名单与服务器是否重复,如果重复请删除重复数据。不同学校数据不可以放在同一个文件内。确定学校无误后再提交表单。 +
+
@@ -29,11 +35,11 @@
- +
- {php} $school = schlist('校级','区级');{/php} - {volist name="school" id="vo" key="k"} @@ -90,7 +96,7 @@ }, fileNumLimit: 1, // 上传文件数 - fileSizeLimit:51200, + fileSizeLimit:2*1024*1024, }); uploader.on( 'fileQueued', function( file ) { var $li = $( diff --git a/application/renshi/view/index/index.html b/application/renshi/view/index/index.html index 10eea60b..def8e73d 100644 --- a/application/renshi/view/index/index.html +++ b/application/renshi/view/index/index.html @@ -21,10 +21,10 @@ 批量删除 - + 添加教师 diff --git a/public/TeacherInfo.xlsx b/public/TeacherInfo.xlsx new file mode 100644 index 00000000..7ff39a6b Binary files /dev/null and b/public/TeacherInfo.xlsx differ