@gsp-svc/formdoc-upload 0.1.39 → 0.2.0
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.
- package/bundles/gsp-svc-formdoc-upload.umd.js +307 -180
- package/bundles/gsp-svc-formdoc-upload.umd.js.map +1 -1
- package/bundles/gsp-svc-formdoc-upload.umd.min.js +1 -1
- package/bundles/gsp-svc-formdoc-upload.umd.min.js.map +1 -1
- package/esm2015/lib/i18n/language.resource.js +9 -5
- package/esm2015/lib/upload/download.service.js +9 -1
- package/esm2015/lib/upload/entity/completemultiuploadrequest.js +21 -0
- package/esm2015/lib/upload/entity/{gspdocsecuritynaseinfo.js → gspdocsecuritybaseinfo.js} +1 -1
- package/esm2015/lib/upload/entity/gspformstreamentity.js +25 -0
- package/esm2015/lib/upload/entity/gspformuploadentity.js +1 -1
- package/esm2015/lib/upload/entity/initmultiuploadrequest.js +19 -0
- package/esm2015/lib/upload/entity/multiuploadrequest.js +21 -0
- package/esm2015/lib/upload/entity/multiuploadresult.js +13 -0
- package/esm2015/lib/upload/entity/uploadlimit.js +1 -1
- package/esm2015/lib/upload/file-upload/file-upload.component.js +229 -127
- package/esm2015/lib/upload/upload.service.js +3 -22
- package/esm2015/public-api.js +2 -2
- package/esm5/lib/i18n/language.resource.js +9 -5
- package/esm5/lib/upload/download.service.js +14 -1
- package/esm5/lib/upload/entity/completemultiuploadrequest.js +25 -0
- package/esm5/lib/upload/entity/{gspdocsecuritynaseinfo.js → gspdocsecuritybaseinfo.js} +1 -1
- package/esm5/lib/upload/entity/gspformstreamentity.js +29 -0
- package/esm5/lib/upload/entity/gspformuploadentity.js +1 -1
- package/esm5/lib/upload/entity/initmultiuploadrequest.js +23 -0
- package/esm5/lib/upload/entity/multiuploadrequest.js +25 -0
- package/esm5/lib/upload/entity/multiuploadresult.js +17 -0
- package/esm5/lib/upload/entity/uploadlimit.js +1 -1
- package/esm5/lib/upload/file-upload/file-upload.component.js +243 -137
- package/esm5/lib/upload/upload.service.js +3 -26
- package/esm5/public-api.js +2 -2
- package/fesm2015/gsp-svc-formdoc-upload.js +283 -164
- package/fesm2015/gsp-svc-formdoc-upload.js.map +1 -1
- package/fesm5/gsp-svc-formdoc-upload.js +319 -183
- package/fesm5/gsp-svc-formdoc-upload.js.map +1 -1
- package/gsp-svc-formdoc-upload.metadata.json +1 -1
- package/lib/i18n/language.resource.d.ts +4 -0
- package/lib/upload/download.service.d.ts +1 -0
- package/lib/upload/entity/completemultiuploadrequest.d.ts +9 -0
- package/lib/upload/entity/gspformstreamentity.d.ts +12 -0
- package/lib/upload/entity/initmultiuploadrequest.d.ts +7 -0
- package/lib/upload/entity/multiuploadrequest.d.ts +8 -0
- package/lib/upload/entity/multiuploadresult.d.ts +4 -0
- package/lib/upload/entity/uploadlimit.d.ts +1 -1
- package/lib/upload/file-upload/file-upload.component.d.ts +8 -4
- package/lib/upload/upload.service.d.ts +2 -3
- package/package.json +1 -1
- package/public-api.d.ts +1 -1
- /package/lib/upload/entity/{gspdocsecuritynaseinfo.d.ts → gspdocsecuritybaseinfo.d.ts} +0 -0
|
@@ -92,16 +92,6 @@
|
|
|
92
92
|
DocType[DocType.Image] = 'Image';
|
|
93
93
|
DocType[DocType.Other] = 'Other';
|
|
94
94
|
|
|
95
|
-
/**
|
|
96
|
-
* @fileoverview added by tsickle
|
|
97
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
98
|
-
*/
|
|
99
|
-
var GspFormDocInfo = /** @class */ (function () {
|
|
100
|
-
function GspFormDocInfo() {
|
|
101
|
-
}
|
|
102
|
-
return GspFormDocInfo;
|
|
103
|
-
}());
|
|
104
|
-
|
|
105
95
|
/**
|
|
106
96
|
* @fileoverview added by tsickle
|
|
107
97
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -480,34 +470,13 @@
|
|
|
480
470
|
* @param {?} rootId
|
|
481
471
|
* @return {?}
|
|
482
472
|
*/
|
|
483
|
-
UploadService.prototype.
|
|
473
|
+
UploadService.prototype.getUploadInfo = /**
|
|
484
474
|
* @param {?} rootId
|
|
485
475
|
* @return {?}
|
|
486
476
|
*/
|
|
487
477
|
function (rootId) {
|
|
488
478
|
/** @type {?} */
|
|
489
|
-
var url = "/api/runtime/dfs/v1.0/rootsetting/" + rootId;
|
|
490
|
-
return this.http.get(url).pipe(operators.tap(( /**
|
|
491
|
-
* @param {?} res
|
|
492
|
-
* @return {?}
|
|
493
|
-
*/function (res) { })), operators.catchError(( /**
|
|
494
|
-
* @param {?} error
|
|
495
|
-
* @return {?}
|
|
496
|
-
*/function (error) {
|
|
497
|
-
return of.of(error);
|
|
498
|
-
})));
|
|
499
|
-
};
|
|
500
|
-
/**
|
|
501
|
-
* @param {?} id
|
|
502
|
-
* @return {?}
|
|
503
|
-
*/
|
|
504
|
-
UploadService.prototype.getValidation = /**
|
|
505
|
-
* @param {?} id
|
|
506
|
-
* @return {?}
|
|
507
|
-
*/
|
|
508
|
-
function (id) {
|
|
509
|
-
/** @type {?} */
|
|
510
|
-
var url = "/api/runtime/dfs/v1.0/validation/" + id;
|
|
479
|
+
var url = "/api/runtime/dfs/v1.0/rootsetting/info?id=" + rootId;
|
|
511
480
|
return this.http.get(url).pipe(operators.tap(( /**
|
|
512
481
|
* @param {?} res
|
|
513
482
|
* @return {?}
|
|
@@ -541,16 +510,6 @@
|
|
|
541
510
|
return UploadFileInfo;
|
|
542
511
|
}());
|
|
543
512
|
|
|
544
|
-
/**
|
|
545
|
-
* @fileoverview added by tsickle
|
|
546
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
547
|
-
*/
|
|
548
|
-
var GspFormUploadEntity = /** @class */ (function () {
|
|
549
|
-
function GspFormUploadEntity() {
|
|
550
|
-
}
|
|
551
|
-
return GspFormUploadEntity;
|
|
552
|
-
}());
|
|
553
|
-
|
|
554
513
|
/**
|
|
555
514
|
* @fileoverview added by tsickle
|
|
556
515
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -605,7 +564,8 @@
|
|
|
605
564
|
'operation': '操作',
|
|
606
565
|
'size': '大小',
|
|
607
566
|
'close': '关闭',
|
|
608
|
-
'loading': '拼命加载中'
|
|
567
|
+
'loading': '拼命加载中',
|
|
568
|
+
'mismatchChunkSize': '文档分片上传部分丢失,请重新上传,如果多次上传失败,请联系管理员。'
|
|
609
569
|
},
|
|
610
570
|
'en-US': {
|
|
611
571
|
'uploadFile': 'Upload File',
|
|
@@ -633,7 +593,8 @@
|
|
|
633
593
|
'operation': 'Operation',
|
|
634
594
|
'size': 'Size',
|
|
635
595
|
'close': 'Close',
|
|
636
|
-
'loading': 'Loading'
|
|
596
|
+
'loading': 'Loading',
|
|
597
|
+
'mismatchChunkSize': 'The partial upload of document shards is missing. Please upload again. If multiple uploads fail, please contact the administrator.'
|
|
637
598
|
},
|
|
638
599
|
'en': {
|
|
639
600
|
'uploadFile': 'Upload File',
|
|
@@ -661,7 +622,8 @@
|
|
|
661
622
|
'operation': 'Operation',
|
|
662
623
|
'size': 'Size',
|
|
663
624
|
'close': 'Close',
|
|
664
|
-
'loading': 'Loading'
|
|
625
|
+
'loading': 'Loading',
|
|
626
|
+
'mismatchChunkSize': 'The partial upload of document shards is missing. Please upload again. If multiple uploads fail, please contact the administrator.'
|
|
665
627
|
},
|
|
666
628
|
'zh-CHT': {
|
|
667
629
|
'uploadFile': '上傳文件',
|
|
@@ -689,7 +651,8 @@
|
|
|
689
651
|
'operation': '操作',
|
|
690
652
|
'size': '大小',
|
|
691
653
|
'close': '關閉',
|
|
692
|
-
'loading': '拼命加載中'
|
|
654
|
+
'loading': '拼命加載中',
|
|
655
|
+
'mismatchChunkSize': '文檔分片上傳部分遺失,請重新上傳,如果多次上傳失敗,請聯系管理員。'
|
|
693
656
|
},
|
|
694
657
|
};
|
|
695
658
|
|
|
@@ -726,6 +689,46 @@
|
|
|
726
689
|
return LocalLangPipe;
|
|
727
690
|
}());
|
|
728
691
|
|
|
692
|
+
/**
|
|
693
|
+
* @fileoverview added by tsickle
|
|
694
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
695
|
+
*/
|
|
696
|
+
var InitMultiUploadRequest = /** @class */ (function () {
|
|
697
|
+
function InitMultiUploadRequest() {
|
|
698
|
+
}
|
|
699
|
+
return InitMultiUploadRequest;
|
|
700
|
+
}());
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* @fileoverview added by tsickle
|
|
704
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
705
|
+
*/
|
|
706
|
+
var CompleteMultiUploadRequest = /** @class */ (function () {
|
|
707
|
+
function CompleteMultiUploadRequest() {
|
|
708
|
+
}
|
|
709
|
+
return CompleteMultiUploadRequest;
|
|
710
|
+
}());
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* @fileoverview added by tsickle
|
|
714
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
715
|
+
*/
|
|
716
|
+
var GspFormStreamEntity = /** @class */ (function () {
|
|
717
|
+
function GspFormStreamEntity() {
|
|
718
|
+
}
|
|
719
|
+
return GspFormStreamEntity;
|
|
720
|
+
}());
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* @fileoverview added by tsickle
|
|
724
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
725
|
+
*/
|
|
726
|
+
var MultiUploadRequest = /** @class */ (function () {
|
|
727
|
+
function MultiUploadRequest() {
|
|
728
|
+
}
|
|
729
|
+
return MultiUploadRequest;
|
|
730
|
+
}());
|
|
731
|
+
|
|
729
732
|
/**
|
|
730
733
|
* @fileoverview added by tsickle
|
|
731
734
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -745,7 +748,7 @@
|
|
|
745
748
|
this.beyondFileList = [];
|
|
746
749
|
this.showType = 0;
|
|
747
750
|
this.mouseOn = false;
|
|
748
|
-
this.bufferSize =
|
|
751
|
+
this.bufferSize = 5 * 1024 * 1024;
|
|
749
752
|
this.selectedFileCount = 0;
|
|
750
753
|
this.uploadIconAddress = '/platform/runtime/dfs/images/upload.svg';
|
|
751
754
|
this.uploadLittleIconAddress = '/platform/runtime/dfs/images/uploadIcon.svg';
|
|
@@ -753,8 +756,6 @@
|
|
|
753
756
|
this.fileAllSelected = false;
|
|
754
757
|
this.uploadProcess = { width: '0%' };
|
|
755
758
|
this.fileTotalChunk = {};
|
|
756
|
-
//fileUploadState: { [key: string]: boolean } = {};
|
|
757
|
-
//flag: number = 0;
|
|
758
759
|
this.requestArray = new Array;
|
|
759
760
|
this.requestBodyArray = new Array;
|
|
760
761
|
this.uploadedChunk = {};
|
|
@@ -834,13 +835,14 @@
|
|
|
834
835
|
_this.haveExtensionProperty = true;
|
|
835
836
|
}
|
|
836
837
|
}));
|
|
837
|
-
this.uploadService.
|
|
838
|
+
this.uploadService.getUploadInfo(this.rootId).subscribe(( /**
|
|
838
839
|
* @param {?} res
|
|
839
840
|
* @return {?}
|
|
840
841
|
*/function (res) {
|
|
841
842
|
if (res != null && res.error == null) {
|
|
842
843
|
_this.sameNameAllowed = res.sameNameAllowed;
|
|
843
|
-
_this.
|
|
844
|
+
_this.maxFileSize = parseInt(JSON.parse(res.validateConfiguration).maxFileSize);
|
|
845
|
+
_this.allowedMultiUpload = res.allowedMultiUpload;
|
|
844
846
|
if (!_this.sameNameAllowed) {
|
|
845
847
|
_this.uploadService.getUploadedFileInfoList(_this.formId, _this.rootId).subscribe(( /**
|
|
846
848
|
* @param {?} res
|
|
@@ -852,17 +854,9 @@
|
|
|
852
854
|
}
|
|
853
855
|
}));
|
|
854
856
|
}
|
|
855
|
-
_this.uploadService.getValidation(_this.validationId).subscribe(( /**
|
|
856
|
-
* @param {?} res
|
|
857
|
-
* @return {?}
|
|
858
|
-
*/function (res) {
|
|
859
|
-
_this.maxFileSize = parseInt(JSON.parse(res.configuration).maxFileSize);
|
|
860
|
-
}));
|
|
861
857
|
}
|
|
862
858
|
}));
|
|
863
|
-
if (this.oldIdList != null && this.oldIdList.length > 0)
|
|
864
|
-
this.uploadService.cancel(this.oldIdList, this.rootId).subscribe();
|
|
865
|
-
}
|
|
859
|
+
if (this.oldIdList != null && this.oldIdList.length > 0) ;
|
|
866
860
|
};
|
|
867
861
|
/**
|
|
868
862
|
* @return {?}
|
|
@@ -886,12 +880,7 @@
|
|
|
886
880
|
* @return {?}
|
|
887
881
|
*/
|
|
888
882
|
function ($event) {
|
|
889
|
-
// const loading = this.loadService.show({
|
|
890
|
-
// message: this.localepipe.transform('uploading')
|
|
891
|
-
// });
|
|
892
883
|
var _this = this;
|
|
893
|
-
// this.totalLoad.close();
|
|
894
|
-
// this.totalLoad = null;
|
|
895
884
|
this.hasSelectedFile = true;
|
|
896
885
|
this.selectedFiles = document.querySelector('#file');
|
|
897
886
|
if (this.fileCount > 0) {
|
|
@@ -923,11 +912,6 @@
|
|
|
923
912
|
* @param {?} x
|
|
924
913
|
* @return {?}
|
|
925
914
|
*/function (x) { return x.fileName == selectedFile.name; })) != null) {
|
|
926
|
-
// this.uploadedNameList.push(selectedFile.name);
|
|
927
|
-
// this.msgService.question('之前已上传过同名文件: ' + selectedFile.name + ',需要替换么?', () => {
|
|
928
|
-
// uuid = this.uploadedFileInfoList.find(x => x.fileName == selectedFile.name).metadataId;
|
|
929
|
-
// this.uploadFile(uuid, selectedFile);
|
|
930
|
-
// })
|
|
931
915
|
/** @type {?} */
|
|
932
916
|
var msg_1 = this_1.msgService.show('warning', this_1.localepipe.transform('haveSameName') + selectedFile.name, {
|
|
933
917
|
initialState: {
|
|
@@ -1008,11 +992,6 @@
|
|
|
1008
992
|
for (var i = 0; i < this.selectedFiles.files.length; i++) {
|
|
1009
993
|
_loop_1(i);
|
|
1010
994
|
}
|
|
1011
|
-
// if (this.uploadedNameList.length > 0) {
|
|
1012
|
-
// let name: string = this.listToString(this.uploadedNameList);
|
|
1013
|
-
// this.msgService.warning('之前已上传过同名文件: ' + name + '请重新选择上传文件。');
|
|
1014
|
-
// this.uploadedNameList = [];
|
|
1015
|
-
// }
|
|
1016
995
|
if (this.errFileList.length > 0) {
|
|
1017
996
|
/** @type {?} */
|
|
1018
997
|
var name_1 = this.listToString(this.errFileList);
|
|
@@ -1033,11 +1012,6 @@
|
|
|
1033
1012
|
this.msgService.warning(name_3 + this.localepipe.transform('sizeMax') + this.maxFileSize + "KB" + this.localepipe.transform('rechooseFile'));
|
|
1034
1013
|
this.beyondFileList = [];
|
|
1035
1014
|
}
|
|
1036
|
-
// if (this.errTypeList.length > 0) {
|
|
1037
|
-
// let type: string = this.listToString(this.errTypeList);
|
|
1038
|
-
// this.msgService.warning('不支持上传类型为 ' + type + '的文件请重新选择上传文件。');
|
|
1039
|
-
// this.errTypeList = [];
|
|
1040
|
-
// }
|
|
1041
1015
|
this.files = this.files.slice();
|
|
1042
1016
|
this.fileAllSelected = false;
|
|
1043
1017
|
$event.target.value = '';
|
|
@@ -1146,60 +1120,141 @@
|
|
|
1146
1120
|
/** @type {?} */
|
|
1147
1121
|
var fileInfo = this.handleFileInfo(uuid, selectedFile, fileName);
|
|
1148
1122
|
/** @type {?} */
|
|
1149
|
-
var chunkTotal = Math.ceil(selectedFile.size / this.bufferSize);
|
|
1150
|
-
/** @type {?} */
|
|
1151
|
-
var chunkIndex = 0;
|
|
1152
|
-
this.fileTotalChunk[uuid] = chunkTotal;
|
|
1153
|
-
/** @type {?} */
|
|
1154
1123
|
var uploadFileInfo = new UploadFileInfo();
|
|
1155
1124
|
uploadFileInfo.metadataId = uuid;
|
|
1156
1125
|
uploadFileInfo.fileName = fileInfo.name;
|
|
1157
|
-
uploadFileInfo.fileSize = fileInfo.
|
|
1126
|
+
uploadFileInfo.fileSize = fileInfo.fileSize;
|
|
1158
1127
|
uploadFileInfo.state = state;
|
|
1159
1128
|
uploadFileInfo.securityInfo = this.securityInfoList[0];
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
uploadInfo.formId = this.formId;
|
|
1164
|
-
uploadInfo.mode = OperatingModes.Temp;
|
|
1165
|
-
uploadInfo.rootId = this.rootId;
|
|
1166
|
-
/** @type {?} */
|
|
1167
|
-
var docInfo = new GspFormDocInfo;
|
|
1168
|
-
docInfo.fileName = fileName;
|
|
1169
|
-
docInfo.metadataId = uuid;
|
|
1170
|
-
docInfo.total = chunkTotal;
|
|
1171
|
-
this.uploadedChunk[docInfo.metadataId] = 0;
|
|
1129
|
+
//判断是否支持分片上传
|
|
1130
|
+
if (this.allowedMultiUpload) {
|
|
1131
|
+
//支持分片上传
|
|
1172
1132
|
/** @type {?} */
|
|
1173
|
-
var
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1133
|
+
var initRequest = new InitMultiUploadRequest;
|
|
1134
|
+
initRequest.path = this.formId;
|
|
1135
|
+
initRequest.metadataId = uuid;
|
|
1136
|
+
initRequest.rootId = this.rootId;
|
|
1137
|
+
initRequest.size = fileInfo.fileSize;
|
|
1138
|
+
initRequest.fileName = fileName;
|
|
1139
|
+
//初始化分片
|
|
1140
|
+
this.initMultiUpload(initRequest).subscribe(( /**
|
|
1141
|
+
* @param {?} res
|
|
1142
|
+
* @return {?}
|
|
1143
|
+
*/function (res) {
|
|
1144
|
+
if (res.error != null) {
|
|
1145
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadResult = false;
|
|
1146
|
+
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1147
|
+
_this.files[_this.files.indexOf(fileInfo)].errorMessage = res.error.Message;
|
|
1148
|
+
}
|
|
1149
|
+
else {
|
|
1150
|
+
/** @type {?} */
|
|
1151
|
+
var uploadId_1 = res.uploadId;
|
|
1152
|
+
/** @type {?} */
|
|
1153
|
+
var chunkTotal = Math.ceil(selectedFile.size / _this.bufferSize);
|
|
1154
|
+
/** @type {?} */
|
|
1155
|
+
var chunkIndex = 0;
|
|
1156
|
+
/** @type {?} */
|
|
1157
|
+
var multiResultList_1 = [];
|
|
1158
|
+
_this.fileTotalChunk[uuid] = chunkTotal;
|
|
1159
|
+
_this.uploadedChunk[uuid] = 0;
|
|
1160
|
+
while (chunkIndex < chunkTotal) {
|
|
1161
|
+
/** @type {?} */
|
|
1162
|
+
var nextSize = Math.min((chunkIndex + 1) * _this.bufferSize, selectedFile.size);
|
|
1163
|
+
/** @type {?} */
|
|
1164
|
+
var fileData = selectedFile.slice(chunkIndex * _this.bufferSize, nextSize);
|
|
1165
|
+
/** @type {?} */
|
|
1166
|
+
var multiRequest = new MultiUploadRequest;
|
|
1167
|
+
multiRequest.metadataId = uuid;
|
|
1168
|
+
multiRequest.rootId = _this.rootId;
|
|
1169
|
+
multiRequest.uploadId = uploadId_1;
|
|
1170
|
+
multiRequest.index = chunkIndex;
|
|
1171
|
+
multiRequest.total = chunkTotal;
|
|
1172
|
+
multiRequest.size = fileData.size;
|
|
1173
|
+
/** @type {?} */
|
|
1174
|
+
var formData = new FormData();
|
|
1175
|
+
formData.append('multiRequest', JSON.stringify(multiRequest));
|
|
1176
|
+
formData.append('file', fileData);
|
|
1177
|
+
_this.multiUpload(formData).subscribe(( /**
|
|
1178
|
+
* @param {?} res
|
|
1179
|
+
* @return {?}
|
|
1180
|
+
*/function (res) {
|
|
1181
|
+
if (res.error != null) {
|
|
1182
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadResult = false;
|
|
1183
|
+
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1184
|
+
_this.files[_this.files.indexOf(fileInfo)].errorMessage = res.error.Message;
|
|
1185
|
+
}
|
|
1186
|
+
else {
|
|
1187
|
+
multiResultList_1.push(res.result);
|
|
1188
|
+
_this.uploadedChunk[uuid]++;
|
|
1189
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadProcess = Number.parseInt((_this.uploadedChunk[uuid] / _this.fileTotalChunk[uuid] * 100).toFixed(0));
|
|
1190
|
+
if (_this.uploadedChunk[uuid] == _this.fileTotalChunk[uuid]) {
|
|
1191
|
+
if (multiResultList_1.length == _this.fileTotalChunk[uuid]) {
|
|
1192
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadResult = true;
|
|
1193
|
+
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1194
|
+
_this.uploadFileInfoList = _this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1195
|
+
_this.uploadedFileInfoList = _this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1196
|
+
_this.uploadedFileTotal++;
|
|
1197
|
+
/** @type {?} */
|
|
1198
|
+
var completeMultiUploadRequest = new CompleteMultiUploadRequest;
|
|
1199
|
+
completeMultiUploadRequest.metadataId = uuid;
|
|
1200
|
+
completeMultiUploadRequest.partList = multiResultList_1;
|
|
1201
|
+
completeMultiUploadRequest.rootId = _this.rootId;
|
|
1202
|
+
completeMultiUploadRequest.uploadId = uploadId_1;
|
|
1203
|
+
completeMultiUploadRequest.size = fileInfo.fileSize;
|
|
1204
|
+
if (_this.haveExtensionProperty)
|
|
1205
|
+
completeMultiUploadRequest.exPropertyName = _this.defaultPropertyName;
|
|
1206
|
+
_this.completeMultiUpload(completeMultiUploadRequest).subscribe(( /**
|
|
1207
|
+
* @param {?} res
|
|
1208
|
+
* @return {?}
|
|
1209
|
+
*/function (res) {
|
|
1210
|
+
}));
|
|
1211
|
+
//后台异步拼接文档
|
|
1212
|
+
}
|
|
1213
|
+
else {
|
|
1214
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadResult = false;
|
|
1215
|
+
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1216
|
+
_this.files[_this.files.indexOf(fileInfo)].errorMessage = _this.localepipe.transform('mismatchChunkSize');
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
}));
|
|
1221
|
+
chunkIndex = chunkIndex + 1;
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
}));
|
|
1225
|
+
}
|
|
1226
|
+
else {
|
|
1178
1227
|
/** @type {?} */
|
|
1179
|
-
var
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1228
|
+
var entity = new GspFormStreamEntity;
|
|
1229
|
+
entity.formId = this.formId;
|
|
1230
|
+
entity.metadataId = uuid;
|
|
1231
|
+
entity.mode = OperatingModes.Temp;
|
|
1232
|
+
entity.rootId = this.rootId;
|
|
1233
|
+
entity.size = selectedFile.size;
|
|
1234
|
+
entity.fileName = fileName;
|
|
1186
1235
|
if (this.haveExtensionProperty)
|
|
1187
|
-
|
|
1188
|
-
//docInfo.isLast = true;
|
|
1189
|
-
uploadInfo.docInfo = docInfo;
|
|
1190
|
-
// let info = uploadInfo;
|
|
1191
|
-
// this.requestArray.push(this.uploadService.uploadFile(uploadInfo));
|
|
1192
|
-
// this.requestBodyArray.push(info);
|
|
1193
|
-
//封装请求formdata
|
|
1236
|
+
entity.exPropertyName = this.defaultPropertyName;
|
|
1194
1237
|
/** @type {?} */
|
|
1195
1238
|
var formData = new FormData();
|
|
1196
|
-
formData.append('
|
|
1197
|
-
formData.append('
|
|
1198
|
-
formData.
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1239
|
+
formData.append('uploadEntity', JSON.stringify(entity));
|
|
1240
|
+
formData.append('file', selectedFile);
|
|
1241
|
+
this.uploadSingleFile(formData).subscribe(( /**
|
|
1242
|
+
* @param {?} res
|
|
1243
|
+
* @return {?}
|
|
1244
|
+
*/function (res) {
|
|
1245
|
+
if (res != null) {
|
|
1246
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadResult = false;
|
|
1247
|
+
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1248
|
+
_this.files[_this.files.indexOf(fileInfo)].errorMessage = res.error.Message;
|
|
1249
|
+
}
|
|
1250
|
+
else {
|
|
1251
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadResult = true;
|
|
1252
|
+
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1253
|
+
_this.uploadFileInfoList = _this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1254
|
+
_this.uploadedFileInfoList = _this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1255
|
+
_this.uploadedFileTotal++;
|
|
1256
|
+
}
|
|
1257
|
+
}));
|
|
1203
1258
|
}
|
|
1204
1259
|
/** @type {?} */
|
|
1205
1260
|
var index = -1;
|
|
@@ -1216,46 +1271,29 @@
|
|
|
1216
1271
|
this.files.splice(index, 1);
|
|
1217
1272
|
this.uploadFileInfoList.splice(index, 1);
|
|
1218
1273
|
this.uploadedFileInfoList.splice(index, 1);
|
|
1219
|
-
this.uploadedFileTotal--;
|
|
1274
|
+
//this.uploadedFileTotal--;
|
|
1220
1275
|
}
|
|
1221
1276
|
};
|
|
1222
1277
|
/**
|
|
1223
|
-
* @param {?}
|
|
1224
|
-
* @param {?} fileInfo
|
|
1225
|
-
* @param {?} docInfo
|
|
1226
|
-
* @param {?} uploadFileInfo
|
|
1278
|
+
* @param {?} formdata
|
|
1227
1279
|
* @return {?}
|
|
1228
1280
|
*/
|
|
1229
|
-
FileUploadComponent.prototype.
|
|
1230
|
-
* @param {?}
|
|
1231
|
-
* @param {?} fileInfo
|
|
1232
|
-
* @param {?} docInfo
|
|
1233
|
-
* @param {?} uploadFileInfo
|
|
1281
|
+
FileUploadComponent.prototype.uploadSingleFile = /**
|
|
1282
|
+
* @param {?} formdata
|
|
1234
1283
|
* @return {?}
|
|
1235
1284
|
*/
|
|
1236
|
-
function (
|
|
1237
|
-
|
|
1238
|
-
|
|
1285
|
+
function (formdata) {
|
|
1286
|
+
/** @type {?} */
|
|
1287
|
+
var url = "/api/runtime/dfs/v1.0/formdoc/single";
|
|
1288
|
+
return this.httpclient.post(url, formdata).pipe(operators.tap(( /**
|
|
1239
1289
|
* @param {?} res
|
|
1240
1290
|
* @return {?}
|
|
1241
|
-
*/function (res) {
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
else {
|
|
1248
|
-
_this.uploadedChunk[docInfo.metadataId]++;
|
|
1249
|
-
_this.files[_this.files.indexOf(fileInfo)].uploadProcess = Number.parseInt((_this.uploadedChunk[docInfo.metadataId] / _this.fileTotalChunk[docInfo.metadataId] * 100).toFixed(0));
|
|
1250
|
-
if (_this.uploadedChunk[docInfo.metadataId] == _this.fileTotalChunk[docInfo.metadataId]) {
|
|
1251
|
-
_this.files[_this.files.indexOf(fileInfo)].uploadResult = true;
|
|
1252
|
-
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1253
|
-
_this.uploadFileInfoList = _this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1254
|
-
_this.uploadedFileInfoList = _this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1255
|
-
_this.uploadedFileTotal++;
|
|
1256
|
-
}
|
|
1257
|
-
}
|
|
1258
|
-
}));
|
|
1291
|
+
*/function (res) { })), operators.catchError(( /**
|
|
1292
|
+
* @param {?} error
|
|
1293
|
+
* @return {?}
|
|
1294
|
+
*/function (error) {
|
|
1295
|
+
return rxjs.of(error);
|
|
1296
|
+
})));
|
|
1259
1297
|
};
|
|
1260
1298
|
/**
|
|
1261
1299
|
* @param {?} formdata
|
|
@@ -1268,7 +1306,6 @@
|
|
|
1268
1306
|
function (formdata) {
|
|
1269
1307
|
/** @type {?} */
|
|
1270
1308
|
var url = "/api/runtime/dfs/v1.0/formdoc/slice";
|
|
1271
|
-
//url = "/api/runtime/dfs/v1.0/formdoc/list";
|
|
1272
1309
|
return this.httpclient.post(url, formdata).pipe(operators.tap(( /**
|
|
1273
1310
|
* @param {?} res
|
|
1274
1311
|
* @return {?}
|
|
@@ -1279,6 +1316,69 @@
|
|
|
1279
1316
|
return rxjs.of(error);
|
|
1280
1317
|
})));
|
|
1281
1318
|
};
|
|
1319
|
+
/**
|
|
1320
|
+
* @param {?} request
|
|
1321
|
+
* @return {?}
|
|
1322
|
+
*/
|
|
1323
|
+
FileUploadComponent.prototype.initMultiUpload = /**
|
|
1324
|
+
* @param {?} request
|
|
1325
|
+
* @return {?}
|
|
1326
|
+
*/
|
|
1327
|
+
function (request) {
|
|
1328
|
+
/** @type {?} */
|
|
1329
|
+
var url = "/api/runtime/dfs/v1.0/formdoc/multi/init";
|
|
1330
|
+
return this.httpclient.post(url, request).pipe(operators.tap(( /**
|
|
1331
|
+
* @param {?} res
|
|
1332
|
+
* @return {?}
|
|
1333
|
+
*/function (res) { })), operators.catchError(( /**
|
|
1334
|
+
* @param {?} error
|
|
1335
|
+
* @return {?}
|
|
1336
|
+
*/function (error) {
|
|
1337
|
+
return rxjs.of(error);
|
|
1338
|
+
})));
|
|
1339
|
+
};
|
|
1340
|
+
/**
|
|
1341
|
+
* @param {?} formdata
|
|
1342
|
+
* @return {?}
|
|
1343
|
+
*/
|
|
1344
|
+
FileUploadComponent.prototype.multiUpload = /**
|
|
1345
|
+
* @param {?} formdata
|
|
1346
|
+
* @return {?}
|
|
1347
|
+
*/
|
|
1348
|
+
function (formdata) {
|
|
1349
|
+
/** @type {?} */
|
|
1350
|
+
var url = "/api/runtime/dfs/v1.0/formdoc/multi/upload";
|
|
1351
|
+
return this.httpclient.post(url, formdata).pipe(operators.tap(( /**
|
|
1352
|
+
* @param {?} res
|
|
1353
|
+
* @return {?}
|
|
1354
|
+
*/function (res) { })), operators.catchError(( /**
|
|
1355
|
+
* @param {?} error
|
|
1356
|
+
* @return {?}
|
|
1357
|
+
*/function (error) {
|
|
1358
|
+
return rxjs.of(error);
|
|
1359
|
+
})));
|
|
1360
|
+
};
|
|
1361
|
+
/**
|
|
1362
|
+
* @param {?} request
|
|
1363
|
+
* @return {?}
|
|
1364
|
+
*/
|
|
1365
|
+
FileUploadComponent.prototype.completeMultiUpload = /**
|
|
1366
|
+
* @param {?} request
|
|
1367
|
+
* @return {?}
|
|
1368
|
+
*/
|
|
1369
|
+
function (request) {
|
|
1370
|
+
/** @type {?} */
|
|
1371
|
+
var url = "/api/runtime/dfs/v1.0/formdoc/multi/complete";
|
|
1372
|
+
return this.httpclient.post(url, request).pipe(operators.tap(( /**
|
|
1373
|
+
* @param {?} res
|
|
1374
|
+
* @return {?}
|
|
1375
|
+
*/function (res) { })), operators.catchError(( /**
|
|
1376
|
+
* @param {?} error
|
|
1377
|
+
* @return {?}
|
|
1378
|
+
*/function (error) {
|
|
1379
|
+
return rxjs.of(error);
|
|
1380
|
+
})));
|
|
1381
|
+
};
|
|
1282
1382
|
/**
|
|
1283
1383
|
* @return {?}
|
|
1284
1384
|
*/
|
|
@@ -1291,8 +1391,6 @@
|
|
|
1291
1391
|
* @param {?} element
|
|
1292
1392
|
* @return {?}
|
|
1293
1393
|
*/function (element) {
|
|
1294
|
-
// let obj: any = document.getElementById(element.name);
|
|
1295
|
-
// obj.checked = true;
|
|
1296
1394
|
element.selectd = true;
|
|
1297
1395
|
}));
|
|
1298
1396
|
this.fileAllSelected = true;
|
|
@@ -1303,8 +1401,6 @@
|
|
|
1303
1401
|
* @param {?} element
|
|
1304
1402
|
* @return {?}
|
|
1305
1403
|
*/function (element) {
|
|
1306
|
-
// let obj: any = document.getElementById(element.name);
|
|
1307
|
-
// obj.checked = false;
|
|
1308
1404
|
element.selectd = false;
|
|
1309
1405
|
}));
|
|
1310
1406
|
this.fileAllSelected = false;
|
|
@@ -1394,9 +1490,6 @@
|
|
|
1394
1490
|
metadataList.push(element.id);
|
|
1395
1491
|
_this.files.splice(_this.files.indexOf(element), 1);
|
|
1396
1492
|
if (element.uploadResult) {
|
|
1397
|
-
// let idList: string[] = [];
|
|
1398
|
-
// idList.push(fileInfo.id);
|
|
1399
|
-
// this.uploadService.cancel(idList, this.rootId).subscribe();
|
|
1400
1493
|
_this.uploadFileInfoList.splice(_this.uploadFileInfoList.indexOf(_this.uploadFileInfoList.filter(( /**
|
|
1401
1494
|
* @param {?} x
|
|
1402
1495
|
* @return {?}
|
|
@@ -1508,20 +1601,27 @@
|
|
|
1508
1601
|
}
|
|
1509
1602
|
fileInfo.source = imgUrl;
|
|
1510
1603
|
_this.files.push(fileInfo);
|
|
1604
|
+
//因为异步处理的差异,补偿一次删除
|
|
1605
|
+
/** @type {?} */
|
|
1606
|
+
var index = -1;
|
|
1607
|
+
_this.files.forEach(( /**
|
|
1608
|
+
* @param {?} x
|
|
1609
|
+
* @return {?}
|
|
1610
|
+
*/function (x) {
|
|
1611
|
+
if (x.name == fileInfo.name) {
|
|
1612
|
+
if (index == -1)
|
|
1613
|
+
index = _this.files.indexOf(x);
|
|
1614
|
+
}
|
|
1615
|
+
}));
|
|
1616
|
+
if (index != -1 && index != _this.files.length - 1) {
|
|
1617
|
+
_this.files.splice(index, 1);
|
|
1618
|
+
_this.uploadFileInfoList.splice(index, 1);
|
|
1619
|
+
_this.uploadedFileInfoList.splice(index, 1);
|
|
1620
|
+
}
|
|
1511
1621
|
});
|
|
1512
1622
|
}
|
|
1513
1623
|
}
|
|
1514
1624
|
};
|
|
1515
|
-
/**
|
|
1516
|
-
* @param {?} selectdFile
|
|
1517
|
-
* @return {?}
|
|
1518
|
-
*/
|
|
1519
|
-
FileUploadComponent.prototype.getImageUrl = /**
|
|
1520
|
-
* @param {?} selectdFile
|
|
1521
|
-
* @return {?}
|
|
1522
|
-
*/
|
|
1523
|
-
function (selectdFile) {
|
|
1524
|
-
};
|
|
1525
1625
|
/**
|
|
1526
1626
|
* @param {?} strList
|
|
1527
1627
|
* @return {?}
|
|
@@ -1611,9 +1711,6 @@
|
|
|
1611
1711
|
* @param {?} x
|
|
1612
1712
|
* @return {?}
|
|
1613
1713
|
*/function (x) { return x.isUploading || x.uploadResult; })).length) {
|
|
1614
|
-
// this.notifyService.success(<NotifyOptions>{
|
|
1615
|
-
// msg: '保存成功!', timeout: 3000
|
|
1616
|
-
// });
|
|
1617
1714
|
this.msgService.warning(this.localepipe.transform('wait'));
|
|
1618
1715
|
return rxjs.of(false);
|
|
1619
1716
|
}
|
|
@@ -1690,9 +1787,6 @@
|
|
|
1690
1787
|
* @return {?}
|
|
1691
1788
|
*/function (x) { return x.metadataId == file.id; })), 1);
|
|
1692
1789
|
}
|
|
1693
|
-
// var obj:any = document.querySelector('#file');
|
|
1694
|
-
// obj.files.remove();
|
|
1695
|
-
//obj.value='';
|
|
1696
1790
|
};
|
|
1697
1791
|
/**
|
|
1698
1792
|
* @param {?} size
|
|
@@ -1807,6 +1901,19 @@
|
|
|
1807
1901
|
function (metadataId, rootId) {
|
|
1808
1902
|
return "/api/runtime/dfs/v1.0/doc/filecontent?metadataid=" + metadataId + "&rootid=" + rootId + "&token=" + this.getToken(this.mergeString(metadataId, rootId));
|
|
1809
1903
|
};
|
|
1904
|
+
/**
|
|
1905
|
+
* @param {?} metadataId
|
|
1906
|
+
* @param {?} rootId
|
|
1907
|
+
* @return {?}
|
|
1908
|
+
*/
|
|
1909
|
+
DownloadService.prototype.getStreamDownloadUrl = /**
|
|
1910
|
+
* @param {?} metadataId
|
|
1911
|
+
* @param {?} rootId
|
|
1912
|
+
* @return {?}
|
|
1913
|
+
*/
|
|
1914
|
+
function (metadataId, rootId) {
|
|
1915
|
+
return "/api/runtime/dfs/v1.0/formdoc/stream?metadataid=" + metadataId + "&rootid=" + rootId + "&token=" + this.getToken(this.mergeString(metadataId, rootId));
|
|
1916
|
+
};
|
|
1810
1917
|
/**
|
|
1811
1918
|
* @param {?} metadataIdList
|
|
1812
1919
|
* @param {?} rootId
|
|
@@ -2296,6 +2403,16 @@
|
|
|
2296
2403
|
return GspFormUploadListEntity;
|
|
2297
2404
|
}());
|
|
2298
2405
|
|
|
2406
|
+
/**
|
|
2407
|
+
* @fileoverview added by tsickle
|
|
2408
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2409
|
+
*/
|
|
2410
|
+
var GspFormDocInfo = /** @class */ (function () {
|
|
2411
|
+
function GspFormDocInfo() {
|
|
2412
|
+
}
|
|
2413
|
+
return GspFormDocInfo;
|
|
2414
|
+
}());
|
|
2415
|
+
|
|
2299
2416
|
/**
|
|
2300
2417
|
* @fileoverview added by tsickle
|
|
2301
2418
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -2306,6 +2423,16 @@
|
|
|
2306
2423
|
return GspDocMetaProperty;
|
|
2307
2424
|
}());
|
|
2308
2425
|
|
|
2426
|
+
/**
|
|
2427
|
+
* @fileoverview added by tsickle
|
|
2428
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2429
|
+
*/
|
|
2430
|
+
var GspFormUploadEntity = /** @class */ (function () {
|
|
2431
|
+
function GspFormUploadEntity() {
|
|
2432
|
+
}
|
|
2433
|
+
return GspFormUploadEntity;
|
|
2434
|
+
}());
|
|
2435
|
+
|
|
2309
2436
|
/**
|
|
2310
2437
|
* @fileoverview added by tsickle
|
|
2311
2438
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|