importEmployee.ejs
2.6 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
<!DOCTYPE html>
<script src="/js/libs/jquery.ui.widget.js"></script>
<script src="/js/libs/jquery.iframe-transport.js"></script>
<script src="/js/libs/jquery.fileupload.js"></script>
<div class="import-head">
<div class="route-btn">
<div class="btn-back grey lighten-2">
<i class="fa fa-long-arrow-left fa-3x"></i>
<div class="btn-info">返回上一页</div>
</div>
</div>
<div class="head-title center-align">
<div class="head-title-wrap">
<h5>邀请加入正式员工</h5>
<p> 新的正式成员将自动添加到#企云在线<a href="#">编辑/添加</a></p>
</div>
</div>
<div class="route-btn">
<div class="btn-close grey lighten-2">
<i class="fa fa-close fa-3x"></i>
<div class="btn-info">关闭页面</div>
</div>
</div>
</div>
<div class="import-body">
<div class="employee-body">
<input id="fileupload" type="file" name="files[]" data-url="/hr/importEmployees" multiple>
<div class="file-wrap"></div>
<div class="submit-btn card-panel teal lighten-2 center-align waves-effect waves-light">
<a href="#" >导入此文件</a>
</div>
</div>
</div>
<script type="text/javascript">
$(function () {
var fileData;
$('#fileupload').fileupload({
dataType: 'json',
done: function (e, data) {
console.log(e);
console.log(data);
},
add: function (e, data) {
fileData=data;
$.each(data.files, function (index, file) {
$('.file-wrap').html("");
$('<p/>').text(file.name).appendTo('.file-wrap');
});
},
progressall: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
console.log(progress);
}
});
$('.submit-btn').click(function(e){
e.preventDefault();
var jqXHR = fileData.submit()
.success(function (result, textStatus, jqXHR) {
console.log(result);
})
.error(function (jqXHR, textStatus, errorThrown) {
})
.complete(function (result, textStatus, jqXHR) {
});
});
});
</script>