|
|
<!DOCTYPE html>
|
|
|
<html>
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<title>成绩导入excel</title>
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
<meta name="renderer" content="webkit">
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
|
<meta name="viewport"
|
|
|
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
|
|
<link rel="stylesheet" href="../../static/css/font.css">
|
|
|
<link rel="stylesheet" href="../../static/css/weadmin.css">
|
|
|
<link rel="stylesheet" href="../../lib/layui/css/layui.css">
|
|
|
<!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
|
|
|
<!--[if lt IE 9]>
|
|
|
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
|
|
|
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
|
|
|
<![endif]-->
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
<div class="weadmin-body">
|
|
|
<div class="layui-form-item template">
|
|
|
<button type="button" class="layui-btn layui-btn-normal" id="test8">选择文件</button>
|
|
|
<button type="button" class="layui-btn layui-btn-danger" id="test10" style="display: none;margin-left:12px">下载错误模板</button>
|
|
|
<div style="color: red;font-size:12px;margin-top: 50px;">温馨提示:导入<font class="import_module">成绩</font>需要严格按照导入模板编辑<font class="import_module">成绩</font>信息,如果已经存在本年度的专业成绩数据,重新导入将清空原有的数据!!!
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="layui-form-item" style="margin-top: 68px">
|
|
|
<button type="button" class="layui-btn" id="test9">上传</button>
|
|
|
<button class="layui-btn" id="closeDialog">关闭</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<script src="../../lib/layui/layui.js"></script>
|
|
|
<script src="../../lib/base64.js"></script>
|
|
|
<script>
|
|
|
//获取url传参的办法
|
|
|
window.GetQueryString = function (name, istop) {
|
|
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
|
|
var r = window.location.search.substr(1).match(reg);
|
|
|
if (typeof (istop) != "undefined") r = top.location.search.substr(1).match(reg);
|
|
|
|
|
|
if (r != null) return unescape(r[2]);
|
|
|
return null;
|
|
|
};
|
|
|
|
|
|
layui.extend({
|
|
|
admin: '{/}../../static/js/admin'
|
|
|
});
|
|
|
layui.use(['jquery', 'admin','upload','layer'], function () {
|
|
|
var $ = layui.jquery,
|
|
|
admin = layui.admin,
|
|
|
layer = layui.layer,
|
|
|
upload= layui.upload;
|
|
|
|
|
|
//批次ID
|
|
|
var batch_id=GetQueryString("batch_id");
|
|
|
//选完文件后不自动上传
|
|
|
upload.render({
|
|
|
elem: '#test8'
|
|
|
,url: '/baseService/zhaosheng/UploadToImportChengJi?batch_id='+batch_id
|
|
|
,auto: false
|
|
|
,accept: 'file' //普通文件
|
|
|
,bindAction: '#test9'
|
|
|
,before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
|
|
|
layer.load(); //上传loading
|
|
|
}
|
|
|
,done: function(res, index, upload){
|
|
|
layer.closeAll('loading'); //关闭loading
|
|
|
console.log(res);
|
|
|
if(res.success){
|
|
|
layer.msg("导入成功",{icon:1},function () {
|
|
|
var index = parent.layer.getFrameIndex(window.name);
|
|
|
parent.layer.close(index);
|
|
|
parent.layui.table.reload('idTest',{page:{curr:1}});
|
|
|
})
|
|
|
}else {
|
|
|
layer.alert(res.message,{icon: 2, title:'错误'},function (index) {
|
|
|
layer.close(index);
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
,error: function(index, upload){
|
|
|
layer.msg("导入失败,请检查密号的是否完全正确!",{icon:2},function () {
|
|
|
});
|
|
|
layer.closeAll('loading'); //关闭loading
|
|
|
}
|
|
|
});
|
|
|
// 关闭页面
|
|
|
$("#closeDialog").click(function () {
|
|
|
var index = parent.layer.getFrameIndex(window.name);
|
|
|
parent.layer.close(index);
|
|
|
})
|
|
|
})
|
|
|
</script>
|
|
|
</body>
|
|
|
</html> |