easy3wui 4.0.38 → 4.0.39-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -105,13 +105,6 @@ var Easy3wGridPage = function (_Component) {
|
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
107
|
|
|
108
|
-
Easy3wGridPage.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
109
|
-
var that = this;
|
|
110
|
-
if (this.props.totalResult && this.props.totalResult !== prevProps.totalResult) {
|
|
111
|
-
that.setState({ pagination: { offset: 1, limit: 10 } });
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
|
|
115
108
|
Easy3wGridPage.prototype.render = function render() {
|
|
116
109
|
var _this2 = this;
|
|
117
110
|
|
|
@@ -174,7 +174,7 @@ var NewBigFileUpload = function (_Component) {
|
|
|
174
174
|
uploadRequest = _state.uploadRequest,
|
|
175
175
|
uploading = _state.uploading;
|
|
176
176
|
|
|
177
|
-
var
|
|
177
|
+
var upProps = {
|
|
178
178
|
// name,
|
|
179
179
|
listType: listType,
|
|
180
180
|
showUploadList: showUploadList,
|
|
@@ -304,7 +304,7 @@ var NewBigFileUpload = function (_Component) {
|
|
|
304
304
|
upProps = (0, _extends3['default'])({}, upProps, { showUploadList: { showDownloadIcon: downloadFileFlag === '1', showPreviewIcon: true, showRemoveIcon: false } });
|
|
305
305
|
}
|
|
306
306
|
if (previewFileFlag && fileViewFlag !== false) {
|
|
307
|
-
|
|
307
|
+
upProps.onPreview = this.onPreview;
|
|
308
308
|
}
|
|
309
309
|
return _react2['default'].createElement(
|
|
310
310
|
'div',
|
|
@@ -322,7 +322,7 @@ var NewBigFileUpload = function (_Component) {
|
|
|
322
322
|
},
|
|
323
323
|
_react2['default'].createElement(
|
|
324
324
|
_upload2['default'],
|
|
325
|
-
(0, _extends3['default'])({},
|
|
325
|
+
(0, _extends3['default'])({}, upProps, {
|
|
326
326
|
disabled: this.state.loading
|
|
327
327
|
}),
|
|
328
328
|
isRead ? null : _react2['default'].createElement(
|
|
@@ -114,8 +114,7 @@ var BigFileUpload = function (_Component) {
|
|
|
114
114
|
uploadData: null, // 上传的数据
|
|
115
115
|
iniSetedFlag: false, // 是否初始化
|
|
116
116
|
CUSize: 0, // 当前上传附件大小
|
|
117
|
-
speed: 0
|
|
118
|
-
uploadQueue: [] // 队列
|
|
117
|
+
speed: 0 // 上传速率
|
|
119
118
|
};
|
|
120
119
|
return _this;
|
|
121
120
|
}
|
|
@@ -141,10 +140,6 @@ var BigFileUpload = function (_Component) {
|
|
|
141
140
|
};
|
|
142
141
|
// 预览
|
|
143
142
|
|
|
144
|
-
// 新增:从队列中取下一个开始上传(顺序上传)
|
|
145
|
-
|
|
146
|
-
// 处理下一个文件
|
|
147
|
-
|
|
148
143
|
|
|
149
144
|
BigFileUpload.prototype.render = function render() {
|
|
150
145
|
var _this2 = this;
|
|
@@ -163,18 +158,16 @@ var BigFileUpload = function (_Component) {
|
|
|
163
158
|
labelCol = _props.labelCol,
|
|
164
159
|
wrapperCol = _props.wrapperCol,
|
|
165
160
|
showUploadList = _props.showUploadList,
|
|
166
|
-
multiple = _props.multiple,
|
|
167
161
|
fileViewFlag = _props.fileViewFlag;
|
|
168
162
|
var _state = this.state,
|
|
169
163
|
preUploading = _state.preUploading,
|
|
170
164
|
uploadPercent = _state.uploadPercent,
|
|
171
165
|
preUploadPercent = _state.preUploadPercent,
|
|
172
166
|
uploadRequest = _state.uploadRequest,
|
|
173
|
-
uploading = _state.uploading
|
|
174
|
-
currentFile = _state.currentFile;
|
|
167
|
+
uploading = _state.uploading;
|
|
175
168
|
var getFieldDecorator = form.getFieldDecorator;
|
|
176
169
|
|
|
177
|
-
var
|
|
170
|
+
var upProps = {
|
|
178
171
|
// name,
|
|
179
172
|
listType: listType,
|
|
180
173
|
showUploadList: showUploadList,
|
|
@@ -196,7 +189,6 @@ var BigFileUpload = function (_Component) {
|
|
|
196
189
|
_this2.setState((0, _extends3['default'])({}, _this2.state, {
|
|
197
190
|
cancelStatus: true,
|
|
198
191
|
loading: false,
|
|
199
|
-
uploading: false,
|
|
200
192
|
fileList: fileList,
|
|
201
193
|
iniSetedFlag: iniSetedFlag
|
|
202
194
|
}), function () {
|
|
@@ -209,7 +201,6 @@ var BigFileUpload = function (_Component) {
|
|
|
209
201
|
_this2.setState((0, _extends3['default'])({}, _this2.state, {
|
|
210
202
|
cancelStatus: true,
|
|
211
203
|
loading: false,
|
|
212
|
-
uploading: false,
|
|
213
204
|
fileList: fileList,
|
|
214
205
|
currentFile: null,
|
|
215
206
|
iniSetedFlag: iniSetedFlag
|
|
@@ -220,7 +211,6 @@ var BigFileUpload = function (_Component) {
|
|
|
220
211
|
_this2.setState((0, _extends3['default'])({}, _this2.state, {
|
|
221
212
|
cancelStatus: false,
|
|
222
213
|
loading: true,
|
|
223
|
-
uploading: false,
|
|
224
214
|
fileList: fileList,
|
|
225
215
|
iniSetedFlag: iniSetedFlag
|
|
226
216
|
}), function () {
|
|
@@ -231,7 +221,6 @@ var BigFileUpload = function (_Component) {
|
|
|
231
221
|
_this2.setState((0, _extends3['default'])({}, _this2.state, {
|
|
232
222
|
cancelStatus: true,
|
|
233
223
|
loading: false,
|
|
234
|
-
uploading: false,
|
|
235
224
|
fileList: fileList,
|
|
236
225
|
iniSetedFlag: iniSetedFlag
|
|
237
226
|
}), function () {
|
|
@@ -273,63 +262,50 @@ var BigFileUpload = function (_Component) {
|
|
|
273
262
|
});
|
|
274
263
|
return false;
|
|
275
264
|
}
|
|
265
|
+
var multiple = _this2.props.multiple;
|
|
276
266
|
var _state3 = _this2.state,
|
|
277
267
|
fileList = _state3.fileList,
|
|
278
268
|
iniSetedFlag = _state3.iniSetedFlag;
|
|
279
|
-
// 单附件
|
|
280
269
|
|
|
281
270
|
if (!multiple) {
|
|
282
271
|
fileList = [file];
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
currentFile: file,
|
|
286
|
-
preUploading: true, // 预处理中
|
|
287
|
-
uploading: false, // 上传中
|
|
288
|
-
uploadRequest: false, // 上传预处理
|
|
289
|
-
uploadPercent: -1,
|
|
290
|
-
preUploadPercent: -1,
|
|
291
|
-
chunkProgressStatus: 'active',
|
|
292
|
-
cancelStatus: false, // 取消状态
|
|
293
|
-
CUSize: 0, // 当前附件上传大小
|
|
294
|
-
loading: true, // 禁用上传
|
|
295
|
-
iniSetedFlag: iniSetedFlag
|
|
296
|
-
}), function () {
|
|
297
|
-
setImmediate(_this2.readFile, file);
|
|
298
|
-
});
|
|
299
|
-
return false; // 阻止 Upload 自动上传
|
|
272
|
+
} else {
|
|
273
|
+
fileList.push(file);
|
|
300
274
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
//
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
});
|
|
321
|
-
}
|
|
275
|
+
if (!iniSetedFlag) {
|
|
276
|
+
iniSetedFlag = true;
|
|
277
|
+
}
|
|
278
|
+
// 首先清除一下各种上传的状态
|
|
279
|
+
_this2.setState((0, _extends3['default'])({}, _this2.state, {
|
|
280
|
+
fileList: fileList,
|
|
281
|
+
currentFile: file,
|
|
282
|
+
preUploading: true, // 预处理中
|
|
283
|
+
uploading: false, // 上传中
|
|
284
|
+
uploadRequest: false, // 上传预处理
|
|
285
|
+
uploadPercent: -1,
|
|
286
|
+
preUploadPercent: -1,
|
|
287
|
+
chunkProgressStatus: 'active',
|
|
288
|
+
cancelStatus: false, // 取消状态
|
|
289
|
+
CUSize: 0, // 当前附件上传大小
|
|
290
|
+
loading: true, // 禁用上传
|
|
291
|
+
iniSetedFlag: iniSetedFlag
|
|
292
|
+
}), function () {
|
|
293
|
+
setImmediate(_this2.readFile, file);
|
|
322
294
|
});
|
|
323
295
|
return false;
|
|
324
296
|
},
|
|
325
|
-
multiple: !!multiple,
|
|
326
297
|
fileList: this.state.fileList
|
|
327
298
|
};
|
|
328
299
|
var objPreviewFileNew = (0, _extends3['default'])({}, _comonConfig.objPreviewFile, this.props.objPreviewFile);
|
|
329
|
-
var previewFileFlag = objPreviewFileNew.previewFileFlag
|
|
300
|
+
var previewFileFlag = objPreviewFileNew.previewFileFlag,
|
|
301
|
+
_objPreviewFileNew$do = objPreviewFileNew.downloadFileFlag,
|
|
302
|
+
downloadFileFlag = _objPreviewFileNew$do === undefined ? '1' : _objPreviewFileNew$do;
|
|
330
303
|
|
|
304
|
+
if (isRead) {
|
|
305
|
+
upProps = (0, _extends3['default'])({}, upProps, { showUploadList: { showDownloadIcon: downloadFileFlag === '1', showPreviewIcon: true, showRemoveIcon: false } });
|
|
306
|
+
}
|
|
331
307
|
if (previewFileFlag && fileViewFlag !== false) {
|
|
332
|
-
|
|
308
|
+
upProps.onPreview = this.onPreview;
|
|
333
309
|
}
|
|
334
310
|
return _react2['default'].createElement(
|
|
335
311
|
_compatible.Form.Item,
|
|
@@ -348,7 +324,7 @@ var BigFileUpload = function (_Component) {
|
|
|
348
324
|
rules: [{ validator: this.requiredFile }, { required: required, message: help }]
|
|
349
325
|
})(_react2['default'].createElement(
|
|
350
326
|
_upload2['default'],
|
|
351
|
-
(0, _extends3['default'])({},
|
|
327
|
+
(0, _extends3['default'])({}, upProps, {
|
|
352
328
|
disabled: this.state.loading
|
|
353
329
|
}),
|
|
354
330
|
isRead ? null : _react2['default'].createElement(
|
|
@@ -382,7 +358,6 @@ var BigFileUpload = function (_Component) {
|
|
|
382
358
|
_react2['default'].createElement(
|
|
383
359
|
'span',
|
|
384
360
|
{ style: { margin: '10px auto', color: '#1890ff' } },
|
|
385
|
-
currentFile ? currentFile.name : '',
|
|
386
361
|
'\u6587\u4EF6\u8BFB\u53D6\u4E2D...'
|
|
387
362
|
),
|
|
388
363
|
_react2['default'].createElement(
|
|
@@ -391,13 +366,17 @@ var BigFileUpload = function (_Component) {
|
|
|
391
366
|
_react2['default'].createElement(_progress2['default'], { width: 80, percent: preUploadPercent, status: 'active' })
|
|
392
367
|
)
|
|
393
368
|
) : '',
|
|
369
|
+
!this.state.cancelStatus && this.state.fileList.length > 0 && !!uploadRequest && _react2['default'].createElement(
|
|
370
|
+
'span',
|
|
371
|
+
{ style: { margin: '10px auto', color: '#1890ff' } },
|
|
372
|
+
'\u6587\u4EF6\u6821\u9A8C\u4E2D...'
|
|
373
|
+
),
|
|
394
374
|
!this.state.cancelStatus && this.state.fileList.length > 0 && uploadPercent >= 0 && uploadPercent < 100 && _react2['default'].createElement(
|
|
395
375
|
'div',
|
|
396
376
|
null,
|
|
397
377
|
!!uploading && _react2['default'].createElement(
|
|
398
378
|
'span',
|
|
399
379
|
{ style: { margin: '10px auto', color: '#1890ff' } },
|
|
400
|
-
currentFile ? currentFile.name : '',
|
|
401
380
|
'\u6587\u4EF6\u4E0A\u4F20\u4E2D(',
|
|
402
381
|
Math.floor(this.state.speed / 1024),
|
|
403
382
|
'KB/S)'
|
|
@@ -518,52 +497,8 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
518
497
|
return iniVal;
|
|
519
498
|
};
|
|
520
499
|
|
|
521
|
-
this.processQueue = function () {
|
|
522
|
-
var _state4 = _this3.state,
|
|
523
|
-
uploadQueue = _state4.uploadQueue,
|
|
524
|
-
uploading = _state4.uploading;
|
|
525
|
-
|
|
526
|
-
if (uploading) return;
|
|
527
|
-
// 没有待处理的文件
|
|
528
|
-
if (!uploadQueue || uploadQueue.length === 0) {
|
|
529
|
-
_this3.setState({ currentFile: null, uploading: false });
|
|
530
|
-
return;
|
|
531
|
-
}
|
|
532
|
-
// 取第一个文件
|
|
533
|
-
var nextFile = uploadQueue[0];
|
|
534
|
-
_this3.setState({
|
|
535
|
-
cancelStatus: false,
|
|
536
|
-
currentFile: nextFile,
|
|
537
|
-
uploading: true,
|
|
538
|
-
preUploading: true
|
|
539
|
-
}, function () {
|
|
540
|
-
setImmediate(_this3.readFile, nextFile);
|
|
541
|
-
});
|
|
542
|
-
};
|
|
543
|
-
|
|
544
|
-
this.dequeueAndProcessNext = function () {
|
|
545
|
-
var uploadQueue = _this3.state.uploadQueue;
|
|
546
|
-
|
|
547
|
-
var remainingQueue = uploadQueue.slice(1);
|
|
548
|
-
_this3.setState({
|
|
549
|
-
uploadQueue: remainingQueue,
|
|
550
|
-
currentFile: null,
|
|
551
|
-
uploading: false,
|
|
552
|
-
preUploading: false,
|
|
553
|
-
loading: false
|
|
554
|
-
}, function () {
|
|
555
|
-
if (remainingQueue.length > 0) {
|
|
556
|
-
setTimeout(function () {
|
|
557
|
-
_this3.processQueue();
|
|
558
|
-
}, 300);
|
|
559
|
-
}
|
|
560
|
-
});
|
|
561
|
-
};
|
|
562
|
-
|
|
563
500
|
this.checkFile = function (uploadParams) {
|
|
564
501
|
_this3.setState({ uploadRequest: true });
|
|
565
|
-
var currentFile = _this3.state.currentFile;
|
|
566
|
-
|
|
567
502
|
var formData = new FormData();
|
|
568
503
|
var authToken = (0, _Easy3wGetCookie2['default'])('userToken') || 'E3WSAFEAPPQWEFGHYI7I483S';
|
|
569
504
|
var _props3 = _this3.props,
|
|
@@ -580,7 +515,9 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
580
515
|
formData.append('sign', '2959f1aea8db0f7fbba61f0f8474d0ef');
|
|
581
516
|
_superagent2['default'].post('' + urlCheckProgress).send(formData).withCredentials().end(function (err, res) {
|
|
582
517
|
if (err) {
|
|
583
|
-
var
|
|
518
|
+
var _state4 = _this3.state,
|
|
519
|
+
fileList = _state4.fileList,
|
|
520
|
+
currentFile = _state4.currentFile;
|
|
584
521
|
|
|
585
522
|
var index = fileList.indexOf(currentFile);
|
|
586
523
|
if (index >= 0) {
|
|
@@ -588,22 +525,20 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
588
525
|
_this3.setState((0, _extends3['default'])({}, _this3.state, {
|
|
589
526
|
fileList: fileList,
|
|
590
527
|
cancelStatus: true,
|
|
591
|
-
loading: false
|
|
592
|
-
uploading: false
|
|
528
|
+
loading: false
|
|
593
529
|
}), function () {
|
|
594
530
|
_this3.setUploadValue(fileList);
|
|
595
|
-
_this3.dequeueAndProcessNext();
|
|
596
531
|
});
|
|
597
532
|
}
|
|
598
533
|
if (err.timeout) {
|
|
599
534
|
_modal2['default'].error({
|
|
600
535
|
style: { top: '38%' },
|
|
601
|
-
content: '
|
|
536
|
+
content: '网络超时,上传失败,请检查网络后,重新续传。'
|
|
602
537
|
});
|
|
603
538
|
} else {
|
|
604
539
|
_modal2['default'].error({
|
|
605
540
|
style: { top: '38%' },
|
|
606
|
-
content:
|
|
541
|
+
content: '服务请求异常,请重试'
|
|
607
542
|
});
|
|
608
543
|
}
|
|
609
544
|
return;
|
|
@@ -642,7 +577,6 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
642
577
|
if (uploadDoneCallback) {
|
|
643
578
|
uploadDoneCallback(name, fileInfo, newList);
|
|
644
579
|
}
|
|
645
|
-
_this3.dequeueAndProcessNext();
|
|
646
580
|
});
|
|
647
581
|
} else {
|
|
648
582
|
var uploadPercent = 0;
|
|
@@ -668,14 +602,15 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
668
602
|
style: { top: '38%' },
|
|
669
603
|
content: res.body.rspMsg
|
|
670
604
|
});
|
|
671
|
-
var
|
|
605
|
+
var _state5 = _this3.state,
|
|
606
|
+
_fileList2 = _state5.fileList,
|
|
607
|
+
_currentFile = _state5.currentFile;
|
|
672
608
|
|
|
673
|
-
var _index2 = _fileList2.indexOf(
|
|
609
|
+
var _index2 = _fileList2.indexOf(_currentFile);
|
|
674
610
|
if (_index2 >= 0) {
|
|
675
611
|
_fileList2.splice(_index2, 1);
|
|
676
|
-
_this3.setState((0, _extends3['default'])({}, _this3.state, {
|
|
612
|
+
_this3.setState((0, _extends3['default'])({}, _this3.state, { loading: false, fileList: _fileList2 }), function () {
|
|
677
613
|
_this3.setUploadValue(_fileList2);
|
|
678
|
-
_this3.dequeueAndProcessNext();
|
|
679
614
|
});
|
|
680
615
|
}
|
|
681
616
|
}
|
|
@@ -684,13 +619,13 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
684
619
|
|
|
685
620
|
this.handlePartUpload = function () {
|
|
686
621
|
try {
|
|
687
|
-
var
|
|
688
|
-
currentFile =
|
|
689
|
-
CUSize =
|
|
690
|
-
cancelStatus =
|
|
691
|
-
uploadData =
|
|
692
|
-
loading =
|
|
693
|
-
speed =
|
|
622
|
+
var _state6 = _this3.state,
|
|
623
|
+
currentFile = _state6.currentFile,
|
|
624
|
+
CUSize = _state6.CUSize,
|
|
625
|
+
cancelStatus = _state6.cancelStatus,
|
|
626
|
+
uploadData = _state6.uploadData,
|
|
627
|
+
loading = _state6.loading,
|
|
628
|
+
speed = _state6.speed;
|
|
694
629
|
|
|
695
630
|
if (cancelStatus) {
|
|
696
631
|
if (loading) {
|
|
@@ -772,24 +707,21 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
772
707
|
_this3.setState((0, _extends3['default'])({}, _this3.state, {
|
|
773
708
|
fileList: fileList,
|
|
774
709
|
cancelStatus: true,
|
|
775
|
-
loading: false
|
|
776
|
-
uploading: false
|
|
710
|
+
loading: false
|
|
777
711
|
}), function () {
|
|
778
712
|
_this3.setUploadValue(fileList);
|
|
779
|
-
_this3.dequeueAndProcessNext();
|
|
780
713
|
});
|
|
781
714
|
}
|
|
782
715
|
if (err.timeout) {
|
|
783
716
|
_modal2['default'].error({
|
|
784
717
|
style: { top: '38%' },
|
|
785
|
-
content: '
|
|
718
|
+
content: '网络超时,上传失败,请检查网络后,重新续传。'
|
|
786
719
|
});
|
|
787
720
|
} else {
|
|
788
721
|
_modal2['default'].error({
|
|
789
722
|
style: { top: '38%' },
|
|
790
|
-
content:
|
|
723
|
+
content: '服务请求异常,请重试'
|
|
791
724
|
});
|
|
792
|
-
_this3.dequeueAndProcessNext();
|
|
793
725
|
}
|
|
794
726
|
return;
|
|
795
727
|
}
|
|
@@ -843,7 +775,6 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
843
775
|
speed: curSpeed
|
|
844
776
|
}), function () {
|
|
845
777
|
_this3.setUploadValue(newList);
|
|
846
|
-
_this3.dequeueAndProcessNext();
|
|
847
778
|
});
|
|
848
779
|
if (uploadCallback && typeof uploadCallback === 'function') {
|
|
849
780
|
uploadCallback(newList);
|
|
@@ -856,12 +787,12 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
856
787
|
if (checkStatus !== '1') {
|
|
857
788
|
_modal2['default'].error({
|
|
858
789
|
style: { top: '38%' },
|
|
859
|
-
content:
|
|
790
|
+
content: '附件完整性验证失败:可能由于网络丢包原因,您上传的附件未通过完整性校验,需要您重新上传。'
|
|
860
791
|
});
|
|
861
792
|
} else {
|
|
862
793
|
_modal2['default'].error({
|
|
863
794
|
style: { top: '38%' },
|
|
864
|
-
content:
|
|
795
|
+
content: '上传失败'
|
|
865
796
|
});
|
|
866
797
|
}
|
|
867
798
|
var _index3 = _fileList3.indexOf(currentFile);
|
|
@@ -878,7 +809,6 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
878
809
|
speed: curSpeed
|
|
879
810
|
}), function () {
|
|
880
811
|
_this3.setUploadValue(_fileList3);
|
|
881
|
-
_this3.dequeueAndProcessNext();
|
|
882
812
|
});
|
|
883
813
|
}
|
|
884
814
|
}
|
|
@@ -904,24 +834,22 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
904
834
|
var _index4 = _fileList4.indexOf(currentFile);
|
|
905
835
|
if (_index4 >= 0) {
|
|
906
836
|
_fileList4.splice(_index4, 1);
|
|
907
|
-
_this3.setState((0, _extends3['default'])({}, _this3.state, { loading: false,
|
|
837
|
+
_this3.setState((0, _extends3['default'])({}, _this3.state, { loading: false, fileList: _fileList4 }), function () {
|
|
908
838
|
_this3.setUploadValue(_fileList4);
|
|
909
|
-
_this3.dequeueAndProcessNext();
|
|
910
839
|
});
|
|
911
840
|
}
|
|
912
841
|
} else {
|
|
913
842
|
_modal2['default'].error({
|
|
914
843
|
style: { top: '38%' },
|
|
915
|
-
content:
|
|
844
|
+
content: '上传失败'
|
|
916
845
|
});
|
|
917
846
|
var _fileList5 = _this3.state.fileList;
|
|
918
847
|
|
|
919
848
|
var _index5 = _fileList5.indexOf(currentFile);
|
|
920
849
|
if (_index5 >= 0) {
|
|
921
850
|
_fileList5.splice(_index5, 1);
|
|
922
|
-
_this3.setState((0, _extends3['default'])({}, _this3.state, { loading: false,
|
|
851
|
+
_this3.setState((0, _extends3['default'])({}, _this3.state, { loading: false, fileList: _fileList5 }), function () {
|
|
923
852
|
_this3.setUploadValue(_fileList5);
|
|
924
|
-
_this3.dequeueAndProcessNext();
|
|
925
853
|
});
|
|
926
854
|
}
|
|
927
855
|
}
|
|
@@ -934,16 +862,15 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
934
862
|
style: { top: '38%' },
|
|
935
863
|
content: error
|
|
936
864
|
});
|
|
937
|
-
var
|
|
938
|
-
fileList =
|
|
939
|
-
|
|
865
|
+
var _state7 = _this3.state,
|
|
866
|
+
fileList = _state7.fileList,
|
|
867
|
+
_currentFile2 = _state7.currentFile;
|
|
940
868
|
|
|
941
|
-
var index = fileList.indexOf(
|
|
869
|
+
var index = fileList.indexOf(_currentFile2);
|
|
942
870
|
if (index >= 0) {
|
|
943
871
|
fileList.splice(index, 1);
|
|
944
872
|
_this3.setState((0, _extends3['default'])({}, _this3.state, { fileList: fileList }), function () {
|
|
945
873
|
_this3.setUploadValue(fileList);
|
|
946
|
-
_this3.dequeueAndProcessNext();
|
|
947
874
|
});
|
|
948
875
|
}
|
|
949
876
|
}
|
|
@@ -1042,16 +969,15 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
1042
969
|
style: { top: '38%' },
|
|
1043
970
|
content: error
|
|
1044
971
|
});
|
|
1045
|
-
var
|
|
1046
|
-
fileList =
|
|
1047
|
-
currentFile =
|
|
972
|
+
var _state8 = _this3.state,
|
|
973
|
+
fileList = _state8.fileList,
|
|
974
|
+
currentFile = _state8.currentFile;
|
|
1048
975
|
|
|
1049
976
|
var index = fileList.indexOf(currentFile);
|
|
1050
977
|
if (index >= 0) {
|
|
1051
978
|
fileList.splice(index, 1);
|
|
1052
979
|
_this3.setState((0, _extends3['default'])({}, _this3.state, { fileList: fileList }), function () {
|
|
1053
980
|
_this3.setUploadValue(fileList);
|
|
1054
|
-
_this3.dequeueAndProcessNext();
|
|
1055
981
|
});
|
|
1056
982
|
}
|
|
1057
983
|
}
|
|
@@ -91,10 +91,7 @@ var Easy3wUploadM = function (_Component) {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3['default'])(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.state = {
|
|
94
|
-
fileList: []
|
|
95
|
-
beforeFileList: [], // 上传前获取上传文件
|
|
96
|
-
finishFileList: [] // 上传完成文件
|
|
97
|
-
|
|
94
|
+
fileList: [{}]
|
|
98
95
|
// 预览
|
|
99
96
|
}, _this.onPreview = function (file) {
|
|
100
97
|
var objPreviewFileNew = (0, _extends3['default'])({}, _comonConfig.objPreviewFile, _this.props.objPreviewFile);
|
|
@@ -259,11 +256,6 @@ var Easy3wUploadM = function (_Component) {
|
|
|
259
256
|
});
|
|
260
257
|
return false;
|
|
261
258
|
} else {
|
|
262
|
-
_this2.setState(function (prev) {
|
|
263
|
-
return (0, _extends3['default'])({}, _this2.state, {
|
|
264
|
-
beforeFileList: [].concat(prev.beforeFileList, [file])
|
|
265
|
-
});
|
|
266
|
-
});
|
|
267
259
|
return true;
|
|
268
260
|
}
|
|
269
261
|
};
|
|
@@ -275,7 +267,6 @@ var Easy3wUploadM = function (_Component) {
|
|
|
275
267
|
};
|
|
276
268
|
var handleFileChange = function handleFileChange(e) {
|
|
277
269
|
var fileList = e.fileList;
|
|
278
|
-
var file = e.file;
|
|
279
270
|
// 移除大小不符、类型不符的文件
|
|
280
271
|
|
|
281
272
|
fileList = fileList.filter(function (f1) {
|
|
@@ -319,9 +310,9 @@ var Easy3wUploadM = function (_Component) {
|
|
|
319
310
|
return nFile;
|
|
320
311
|
});
|
|
321
312
|
// 3. filter successfully uploaded files according to response from server
|
|
322
|
-
fileList = fileList.filter(function (
|
|
323
|
-
var status =
|
|
324
|
-
name =
|
|
313
|
+
fileList = fileList.filter(function (file) {
|
|
314
|
+
var status = file.status,
|
|
315
|
+
name = file.name;
|
|
325
316
|
|
|
326
317
|
if (status === 'error') {
|
|
327
318
|
_modal2['default'].error({
|
|
@@ -330,17 +321,17 @@ var Easy3wUploadM = function (_Component) {
|
|
|
330
321
|
});
|
|
331
322
|
return false; // 上传失败
|
|
332
323
|
}
|
|
333
|
-
if (
|
|
334
|
-
if (
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
324
|
+
if (file.response) {
|
|
325
|
+
if (file.response.rspCode === '0000') {
|
|
326
|
+
if (uploadDoneCallback) {
|
|
327
|
+
uploadDoneCallback(uploadName, fileList, file);
|
|
328
|
+
}
|
|
338
329
|
return true;
|
|
339
330
|
}
|
|
340
|
-
if (
|
|
331
|
+
if (file.response.rspMsg) {
|
|
341
332
|
_modal2['default'].error({
|
|
342
333
|
style: { top: '38%' },
|
|
343
|
-
content:
|
|
334
|
+
content: file.response.rspMsg
|
|
344
335
|
});
|
|
345
336
|
} else {
|
|
346
337
|
_modal2['default'].error({
|
|
@@ -364,24 +355,6 @@ var Easy3wUploadM = function (_Component) {
|
|
|
364
355
|
}
|
|
365
356
|
});
|
|
366
357
|
_this2.setState({ fileList: fileList });
|
|
367
|
-
var status = file.status;
|
|
368
|
-
|
|
369
|
-
if (status === 'done') {
|
|
370
|
-
_this2.setState(function (prev) {
|
|
371
|
-
return { finishFileList: [].concat(prev.finishFileList, [file]) };
|
|
372
|
-
}, function () {
|
|
373
|
-
var _state = _this2.state,
|
|
374
|
-
beforeFileList = _state.beforeFileList,
|
|
375
|
-
finishFileList = _state.finishFileList;
|
|
376
|
-
|
|
377
|
-
if (beforeFileList.length > 0 && finishFileList.length > 0 && beforeFileList.length === finishFileList.length) {
|
|
378
|
-
if (uploadDoneCallback) {
|
|
379
|
-
uploadDoneCallback(uploadName, fileList, file);
|
|
380
|
-
_this2.setState({ finishFileList: [], beforeFileList: [] });
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
358
|
return fileList;
|
|
386
359
|
};
|
|
387
360
|
var checkFile = function checkFile(rule, value, callback) {
|