You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
5.3 KiB
HTML

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!--# layout("/common/layout.html",{"jsBase":"/js/jlw/teacher/"}){ -->
<link rel="stylesheet" type="text/css" href="${ctxPath}/css/plugin.css?v=${jsVer}" media="all"/>
<form class="layui-form" id="addForm">
<div>
<layui:submitButtons id="addButton" buttonType="" />
</div>
<div class="layui-row">
<div class="layui-form-item">
<div class="layui-inline">
学生管理/批量添加学生
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">批量导入模板下载:</label>
<div class="layui-form-mid layui-word-aux" style="cursor: pointer;">
<a id="downloadTemplate">
<i class="iconfont" style="font-size: 30px;color: #1296db;">&#xebc7;</i>下载模板
</a>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">上传批量导入文件:</label>
<div class="layui-form-mid layui-word-aux">
<a id="importTemplate" style="cursor: pointer;">
<i class="iconfont" style="font-size: 40px;color: #1296db;">&#xebb8;</i>
</a>
</div>
</div>
</div>
</div>
<div class="layui-row">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">批量导入错误列表:</label>
</div>
</div>
</div>
<table class="layui-table" style="width: 1000px;border: 1px solid #eeeeee;" lay-even="true" lay-skin="nob">
<colgroup>
<col width="60">
<col>
<col width="120">
</colgroup>
<thead>
<tr style="background-color: #e3e3e3;">
<th style="text-align: center;">序号</th>
<th>提示信息</th>
<!-- <th style="text-align: center;border-left:1px solid #dddddd;">操作</th>-->
</tr>
</thead>
<tbody id="view" >
</tbody>
</table>
</form>
<script id="demo" type="text/html">
{{# layui.each(d.list, function(index, item){ }}
<tr>
<td style="text-align: center;">{{index + 1}}</td>
<td>{{item.failMessage}}</td>
<!-- <td style="text-align: center;">-->
<!-- {{#if(item.length ==2){}}-->
<!-- <a studentId="{{item[1]}}" class="layui-btn layui-btn-sm bg_button del">删除</a>-->
<!-- {{#}}}-->
<!-- </td>-->
</tr>
{{# }); }}
</script>
<!--#} -->
<script>
layui.use(['upload'], function(){
var upload = layui.upload;
var laytpl = layui.laytpl;
/*var studentLocal = localStorage.getItem($.getKeyInfo("studentLocal")); //取出上次导入出现错误的数据
if(!$.isEmpty(studentLocal)){
var getTpl = demo.innerHTML
,view = document.getElementById('view');
laytpl(getTpl).render({list:JSON.parse(studentLocal)}, function(html){
view.innerHTML = html;
$(".del").click(deleteInfo);
});
}*/
upload.render({
elem: '#importTemplate',
url: Common.ctxPath + "/jlw/student/importTemplate.json",
size: 5120,
accept: 'file',
data: {
},
before: function (obj) { //上传前
layer.load();
},
done: function (res, index, upload) { //上传后的回调
layer.closeAll('loading');
if (res.code == 0) {
parent.window.dataReload();
layer.msg(res.msg, {icon: 1});
} else {
// localStorage.setItem($.getKeyInfo("studentLocal"), JSON.stringify(res.msg)); //存入本次导入出现错误的数据
var getTpl = demo.innerHTML
,view = document.getElementById('view');
laytpl(getTpl).render({list:JSON.parse(res.msg)}, function(html){
view.innerHTML = html;
$(".del").click(deleteInfo);
});
}
},
error: function () { //请求异常回调
layer.closeAll('loading');
}
});
//删除数据
function deleteInfo(){
layer.confirm('是否确定删除该信息?', function (index) {
var studentId = $(this).attr("studentId");
var ret = Common.postAjax("/jlw/student/delete.json", {ids: studentId});
layer.msg(ret.code == 0 ? "删除成功!" : ret.msg, {
offset: ['50%'],
icon: ret.code == 0 ? 1 : 2,
time: 1500 //2秒关闭如果不配置默认是3秒
});
});
}
$("#downloadTemplate").click(function () {
$.downFile(Common.ctxPath + "/jlw/student/downloadTemplate.json",'学生导入模板.xlsx');
});
$("#addButton").click(function(){
Lib.closeFrame();
});
$("#addButton-cancel").click(function(){
Lib.closeFrame();
});
});
</script>