|
|
@@ -5,10 +5,7 @@
|
|
5
|
5
|
<meta charset="UTF-8">
|
|
6
|
6
|
<script src="../Script/Common/huayi.load.js"></script>
|
|
7
|
7
|
<script src="../Script/Common/huayi.config.js"></script>
|
|
8
|
|
- <script src="../js/visit/ajaxfileupload.js"></script>
|
|
9
|
|
- <link href="../css/Table/table1.css" rel="stylesheet" />
|
|
10
|
|
- <link href="../css/init.css" rel="stylesheet" />
|
|
11
|
|
- <link rel="stylesheet" href="../css/QutboundMessage/QutboundComm.css" />
|
|
|
8
|
+ <!-- <script src="../js/visit/ajaxfileupload.js"></script>-->
|
|
12
|
9
|
<title>导入号码</title>
|
|
13
|
10
|
<style>
|
|
14
|
11
|
.btn-success {
|
|
|
@@ -27,10 +24,23 @@
|
|
27
|
24
|
background-color: #1ab394;
|
|
28
|
25
|
}
|
|
29
|
26
|
|
|
|
27
|
+ .btn-success[disabled],
|
|
|
28
|
+ .btn-success[disabled]:active,
|
|
|
29
|
+ .btn-success[disabled]:focus,
|
|
|
30
|
+ .btn-success[disabled]:hover {
|
|
|
31
|
+ background-color: #1ab394;
|
|
|
32
|
+ }
|
|
|
33
|
+
|
|
30
|
34
|
#importNum {
|
|
31
|
35
|
width: 130px;
|
|
32
|
36
|
margin: 60px auto 0 auto;
|
|
33
|
37
|
}
|
|
|
38
|
+
|
|
|
39
|
+ .progress {
|
|
|
40
|
+ width: 80%;
|
|
|
41
|
+ margin: 20px auto 0 auto;
|
|
|
42
|
+ display: none;
|
|
|
43
|
+ }
|
|
34
|
44
|
</style>
|
|
35
|
45
|
</head>
|
|
36
|
46
|
|
|
|
@@ -53,6 +63,11 @@
|
|
53
|
63
|
<span class="excelName"></span>
|
|
54
|
64
|
</div>
|
|
55
|
65
|
</div>
|
|
|
66
|
+ <div class="progress">
|
|
|
67
|
+ <div class="progress-bar progress-bar-striped" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
|
|
|
68
|
+
|
|
|
69
|
+ </div>
|
|
|
70
|
+ </div>
|
|
56
|
71
|
<div class="form-group text-center">
|
|
57
|
72
|
<input type="button" id="importNum" class="form-control btn btn-success" value="导入" />
|
|
58
|
73
|
</div>
|
|
|
@@ -76,8 +91,110 @@
|
|
76
|
91
|
});
|
|
77
|
92
|
|
|
78
|
93
|
});
|
|
|
94
|
+ //上传Excel文件
|
|
|
95
|
+ function upload() {
|
|
|
96
|
+ var txtName = $('.excelName').text();
|
|
|
97
|
+ if(txtName == '') {
|
|
|
98
|
+ layer.confirm('请先上传文件', {
|
|
|
99
|
+ icon: 2,
|
|
|
100
|
+ btn: ['确定']
|
|
|
101
|
+ });
|
|
|
102
|
+ return;
|
|
|
103
|
+ }
|
|
|
104
|
+ //一般情况下,excel后缀是".xls",在2007以及以后的版本中又增加了".xlsx"。excel的模板文件后缀名是".xlt",启动宏的工作簿后缀名是".xlsm"。
|
|
|
105
|
+ if(txtName.indexOf('.xls') != -1 ||
|
|
|
106
|
+ txtName.indexOf('.xlsx') != -1 ||
|
|
|
107
|
+ txtName.indexOf('.xlt') != -1 ||
|
|
|
108
|
+ txtName.indexOf('.xlsm') != -1
|
|
|
109
|
+ ) {
|
|
|
110
|
+ var formData = new FormData();
|
|
|
111
|
+ var Files = document.getElementById("upFile").files;
|
|
|
112
|
+ formData.append("upFile", Files[0]);
|
|
|
113
|
+ formData.append("taskid", wid);
|
|
|
114
|
+ formData.append("token", $.cookie("token"));
|
|
|
115
|
+ $.ajax({
|
|
|
116
|
+ url: huayi.config.callcenter_url + "CallOutPlan/TelInput",
|
|
|
117
|
+ type: "POST",
|
|
|
118
|
+ data: formData,
|
|
|
119
|
+ /**
|
|
|
120
|
+ *必须false才会自动加上正确的Content-Type
|
|
|
121
|
+ */
|
|
|
122
|
+ contentType: false,
|
|
|
123
|
+ /**
|
|
|
124
|
+ * 必须false才会避开jQuery对 formdata 的默认处理
|
|
|
125
|
+ * XMLHttpRequest会对 formdata 进行正确的处理
|
|
|
126
|
+ */
|
|
|
127
|
+ processData: false,
|
|
|
128
|
+ xhr: function() { //这是关键 获取原生的xhr对象 做以前做的所有事情
|
|
|
129
|
+ var xhr = jQuery.ajaxSettings.xhr();
|
|
|
130
|
+ xhr.upload.onload = function() {
|
|
|
131
|
+ //alert('finish downloading')
|
|
|
132
|
+ }
|
|
|
133
|
+ xhr.upload.onprogress = function(ev) {
|
|
|
134
|
+ //console.log(ev);
|
|
|
135
|
+ //if(ev.lengthComputable) {
|
|
|
136
|
+ var percent = 100 * ev.loaded / ev.total;
|
|
|
137
|
+ //console.log(percent, ev);
|
|
|
138
|
+ $('.progress-bar').css('width', percent + '%');
|
|
|
139
|
+ $('.progress-bar').text(percent + '%');
|
|
|
140
|
+ //}
|
|
|
141
|
+ }
|
|
|
142
|
+ return xhr;
|
|
|
143
|
+ },
|
|
|
144
|
+ beforeSend: function(request) {
|
|
|
145
|
+ $('.progress').css('display', 'block');
|
|
|
146
|
+ $("#importNum").attr("disabled", true);
|
|
|
147
|
+ $("#importNum").val('导入中...');
|
|
|
148
|
+ },
|
|
|
149
|
+ success: function(result) {
|
|
|
150
|
+ var r = $.parseJSON(result);
|
|
|
151
|
+ $("#importNum").attr("disabled", false);
|
|
|
152
|
+ $("#importNum").val('导入');
|
|
|
153
|
+ if(r.state.toLowerCase() == "success") {
|
|
|
154
|
+ var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
|
|
|
155
|
+ parent.layer.close(index); //再执行关闭
|
|
|
156
|
+ parent.Right(wid);
|
|
|
157
|
+ parent.layer.alert(r.message, {
|
|
|
158
|
+ icon: 1,
|
|
|
159
|
+ btn: ['确定']
|
|
|
160
|
+ });
|
|
|
161
|
+
|
|
|
162
|
+ }
|
|
|
163
|
+ },
|
|
|
164
|
+ error: function(textStatus) {
|
|
|
165
|
+ $('.progress-bar').css('width', '0%');
|
|
|
166
|
+ $('.progress-bar').text('0%');
|
|
|
167
|
+ layer.confirm('网络繁忙,请稍后再试...', {
|
|
|
168
|
+ btn: ['确定'] //按钮
|
|
|
169
|
+ });
|
|
|
170
|
+ $("#importNum").attr("disabled", false);
|
|
|
171
|
+ $("#importNum").val('导入');
|
|
|
172
|
+ },
|
|
|
173
|
+ complete: function(XMLHttpRequest, textStatus) {
|
|
|
174
|
+ //$('.progress-bar').css('width', '0%');
|
|
|
175
|
+ //$('.progress-bar').text('0%');
|
|
|
176
|
+ if(textStatus == 'timeout') {
|
|
|
177
|
+ var xmlhttp = window.XMLHttpRequest ? new window.XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHttp");
|
|
|
178
|
+ xmlhttp.abort();
|
|
|
179
|
+ layer.confirm('网络超时,请稍后再试...', {
|
|
|
180
|
+ btn: ['确定'] //按钮
|
|
|
181
|
+ });
|
|
|
182
|
+ }
|
|
|
183
|
+ $("#importNum").attr("disabled", false);
|
|
|
184
|
+ $("#importNum").val('导入');
|
|
|
185
|
+ },
|
|
|
186
|
+ });
|
|
79
|
187
|
|
|
80
|
|
- function ajaxFileUpload() {
|
|
|
188
|
+ } else {
|
|
|
189
|
+ layer.confirm('请上传EXCEL文件', {
|
|
|
190
|
+ icon: 2,
|
|
|
191
|
+ btn: ['确定']
|
|
|
192
|
+ });
|
|
|
193
|
+ return;
|
|
|
194
|
+ }
|
|
|
195
|
+ }
|
|
|
196
|
+
|
|
|
197
|
+ /*function ajaxFileUpload() {
|
|
81
|
198
|
var txtName = $('.excelName').text();
|
|
82
|
199
|
if(txtName == '') {
|
|
83
|
200
|
layer.confirm('请先上传文件', {
|
|
|
@@ -127,46 +244,7 @@
|
|
127
|
244
|
}
|
|
128
|
245
|
|
|
129
|
246
|
}
|
|
130
|
|
-
|
|
131
|
|
- //上传Excel文件
|
|
132
|
|
- function upload() {
|
|
133
|
|
- var formData = new FormData();
|
|
134
|
|
- var Files = document.getElementById("upFile").files;
|
|
135
|
|
- formData.append("taskid", wid);
|
|
136
|
|
- formData.append("token", $.cookie("token"));
|
|
137
|
|
- if(Files.length > 0) {
|
|
138
|
|
- for(var i = 0; i < Files.length; i++) {
|
|
139
|
|
- formData.append('files' + i, Files[i]);
|
|
140
|
|
- }
|
|
141
|
|
- $.ajax({
|
|
142
|
|
- url: huayi.config.callcenter_url + "CallOutPlan/TelInput",
|
|
143
|
|
- type: "POST",
|
|
144
|
|
- data: formData,
|
|
145
|
|
- /**
|
|
146
|
|
- *必须false才会自动加上正确的Content-Type
|
|
147
|
|
- */
|
|
148
|
|
- contentType: false,
|
|
149
|
|
- /**
|
|
150
|
|
- * 必须false才会避开jQuery对 formdata 的默认处理
|
|
151
|
|
- * XMLHttpRequest会对 formdata 进行正确的处理
|
|
152
|
|
- */
|
|
153
|
|
- processData: false,
|
|
154
|
|
- beforeSend: function(request) {
|
|
155
|
|
- console.log(request);
|
|
156
|
|
- },
|
|
157
|
|
- success: function(result) {
|
|
158
|
|
- debugger
|
|
159
|
|
- var r = $.parseJSON(result);
|
|
160
|
|
- if(r.state.toLowerCase() == "success") {}
|
|
161
|
|
- },
|
|
162
|
|
- error: function() {},
|
|
163
|
|
- });
|
|
164
|
|
- } else {
|
|
165
|
|
- layer.confirm('请上传文件!', {
|
|
166
|
|
- btn: ['确定']
|
|
167
|
|
- });
|
|
168
|
|
- }
|
|
169
|
|
- }
|
|
|
247
|
+*/
|
|
170
|
248
|
</script>
|
|
171
|
249
|
</body>
|
|
172
|
250
|
|