编写教师批量添加,增加学生批传表格验证
This commit is contained in:
1 parent
da96d601f0
commit
c7a9ec1be6
6 files changed
+47
-12
No files matched your search
@@ -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');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
{/block}
|
||||
{block name="formaa"}
|
||||
<div class="form form-horizontal">
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-3">注意:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
友情提示:批传前请先确定上传名单与服务器是否重复,如果重复请删除重复数据。不同学校数据不可以放在同一个文件内。确定学校无误后再提交表单。
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-3">模板:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9">
|
||||
@@ -29,11 +35,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cl">
|
||||
<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>工作单位:</label>
|
||||
<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>学校:</label>
|
||||
<div class="formControls col-xs-8 col-sm-9 f-l">
|
||||
<span class="select-box f-l" style="width:300px;">
|
||||
{php} $school = schlist('校级','区级');{/php}
|
||||
<select class="select" id="danwei" name="danwei" size="1" required>
|
||||
{php} $school = schlist('校级','校级');{/php}
|
||||
<select class="select" id="school" name="school" size="1" required>
|
||||
<option value="">--请选择现工作单位--</option>
|
||||
{volist name="school" id="vo" key="k"}
|
||||
<option value="{$vo.id}">{$vo.title}</option>
|
||||
@@ -90,7 +96,7 @@
|
||||
},
|
||||
|
||||
fileNumLimit: 1, // 上传文件数
|
||||
fileSizeLimit:51200,
|
||||
fileSizeLimit:2*1024*1024,
|
||||
});
|
||||
uploader.on( 'fileQueued', function( file ) {
|
||||
var $li = $(
|
||||
|
||||
Loaded 3 of 6 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user