upload.html
2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<div class="modal fade" id="uploadFile" tabindex="-1" role="basic"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true"></button>
<h4 class="modal-title">导入Excel</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" role="form" id="excelFile" method="post"
action="" enctype="multipart/form-data">
<input type="hidden" name="groupType" value="3">
<div class="alert alert-danger display-hide">
<button class="close" data-close="alert"></button>
您的输入有误,请检查下面的输入项
</div>
<div class="form-body">
<div class="form-group">
<label class="col-md-4 control-label">选择文件</label>
<div class="col-md-6">
<input type="file" name="file" id="file"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"/>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" id="submit">确认导入</button>
</div>
</div>
</div>
</div>
</script>
<script data-exclude=1>
$(function() {
var form = $('#excelFile');
var error = $('.alert-danger', form);
var curDate = new Date();
var preDate = new Date(curDate.getTime() - 24*60*60*1000);
$("#date").val(preDate);
$("#date").datetimepicker({
format : 'YYYY-MM-DD',
locale : 'zh-cn',
maxDate : preDate
});
//modal 显示事件
$('#uploadFile').on('show.bs.modal', function(){
})
.modal('show');
$('#submit').on('click', function() {
var j = layer.load(2);
var param = {
};
$.ajaxFileUpload({
url : '/ddexam/uploadFile',
secureuri : false,
fileElementId : 'file',
dataType : 'json',
data : param,
success : function(data) {
layer.close(j);
alert(data.result);
// alert("文件导入成功");
$('#uploadFile').modal('hide');
$('tr.filter .filter-submit').click();
},
error : function(data, status, e) {
layer.close(j);
alert("文件导入失败");
}
})
});
});
</script>