@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
|
@@ -105,16 +105,6 @@ DocType[DocType.Txt] = 'Txt';
|
|
|
105
105
|
DocType[DocType.Image] = 'Image';
|
|
106
106
|
DocType[DocType.Other] = 'Other';
|
|
107
107
|
|
|
108
|
-
/**
|
|
109
|
-
* @fileoverview added by tsickle
|
|
110
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
111
|
-
*/
|
|
112
|
-
var GspFormDocInfo = /** @class */ (function () {
|
|
113
|
-
function GspFormDocInfo() {
|
|
114
|
-
}
|
|
115
|
-
return GspFormDocInfo;
|
|
116
|
-
}());
|
|
117
|
-
|
|
118
108
|
/**
|
|
119
109
|
* @fileoverview added by tsickle
|
|
120
110
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -513,36 +503,13 @@ var UploadService = /** @class */ (function () {
|
|
|
513
503
|
* @param {?} rootId
|
|
514
504
|
* @return {?}
|
|
515
505
|
*/
|
|
516
|
-
UploadService.prototype.
|
|
506
|
+
UploadService.prototype.getUploadInfo = /**
|
|
517
507
|
* @param {?} rootId
|
|
518
508
|
* @return {?}
|
|
519
509
|
*/
|
|
520
510
|
function (rootId) {
|
|
521
511
|
/** @type {?} */
|
|
522
|
-
var url = "/api/runtime/dfs/v1.0/rootsetting/" + rootId;
|
|
523
|
-
return this.http.get(url).pipe(tap((/**
|
|
524
|
-
* @param {?} res
|
|
525
|
-
* @return {?}
|
|
526
|
-
*/
|
|
527
|
-
function (res) { })), catchError((/**
|
|
528
|
-
* @param {?} error
|
|
529
|
-
* @return {?}
|
|
530
|
-
*/
|
|
531
|
-
function (error) {
|
|
532
|
-
return of(error);
|
|
533
|
-
})));
|
|
534
|
-
};
|
|
535
|
-
/**
|
|
536
|
-
* @param {?} id
|
|
537
|
-
* @return {?}
|
|
538
|
-
*/
|
|
539
|
-
UploadService.prototype.getValidation = /**
|
|
540
|
-
* @param {?} id
|
|
541
|
-
* @return {?}
|
|
542
|
-
*/
|
|
543
|
-
function (id) {
|
|
544
|
-
/** @type {?} */
|
|
545
|
-
var url = "/api/runtime/dfs/v1.0/validation/" + id;
|
|
512
|
+
var url = "/api/runtime/dfs/v1.0/rootsetting/info?id=" + rootId;
|
|
546
513
|
return this.http.get(url).pipe(tap((/**
|
|
547
514
|
* @param {?} res
|
|
548
515
|
* @return {?}
|
|
@@ -576,16 +543,6 @@ var UploadFileInfo = /** @class */ (function () {
|
|
|
576
543
|
return UploadFileInfo;
|
|
577
544
|
}());
|
|
578
545
|
|
|
579
|
-
/**
|
|
580
|
-
* @fileoverview added by tsickle
|
|
581
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
582
|
-
*/
|
|
583
|
-
var GspFormUploadEntity = /** @class */ (function () {
|
|
584
|
-
function GspFormUploadEntity() {
|
|
585
|
-
}
|
|
586
|
-
return GspFormUploadEntity;
|
|
587
|
-
}());
|
|
588
|
-
|
|
589
546
|
/**
|
|
590
547
|
* @fileoverview added by tsickle
|
|
591
548
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -640,7 +597,8 @@ var LANG_RESOURCES = {
|
|
|
640
597
|
'operation': '操作',
|
|
641
598
|
'size': '大小',
|
|
642
599
|
'close': '关闭',
|
|
643
|
-
'loading': '拼命加载中'
|
|
600
|
+
'loading': '拼命加载中',
|
|
601
|
+
'mismatchChunkSize': '文档分片上传部分丢失,请重新上传,如果多次上传失败,请联系管理员。'
|
|
644
602
|
},
|
|
645
603
|
'en-US': {
|
|
646
604
|
'uploadFile': 'Upload File',
|
|
@@ -668,7 +626,8 @@ var LANG_RESOURCES = {
|
|
|
668
626
|
'operation': 'Operation',
|
|
669
627
|
'size': 'Size',
|
|
670
628
|
'close': 'Close',
|
|
671
|
-
'loading': 'Loading'
|
|
629
|
+
'loading': 'Loading',
|
|
630
|
+
'mismatchChunkSize': 'The partial upload of document shards is missing. Please upload again. If multiple uploads fail, please contact the administrator.'
|
|
672
631
|
},
|
|
673
632
|
'en': {
|
|
674
633
|
'uploadFile': 'Upload File',
|
|
@@ -696,7 +655,8 @@ var LANG_RESOURCES = {
|
|
|
696
655
|
'operation': 'Operation',
|
|
697
656
|
'size': 'Size',
|
|
698
657
|
'close': 'Close',
|
|
699
|
-
'loading': 'Loading'
|
|
658
|
+
'loading': 'Loading',
|
|
659
|
+
'mismatchChunkSize': 'The partial upload of document shards is missing. Please upload again. If multiple uploads fail, please contact the administrator.'
|
|
700
660
|
},
|
|
701
661
|
'zh-CHT': {
|
|
702
662
|
'uploadFile': '上傳文件',
|
|
@@ -724,7 +684,8 @@ var LANG_RESOURCES = {
|
|
|
724
684
|
'operation': '操作',
|
|
725
685
|
'size': '大小',
|
|
726
686
|
'close': '關閉',
|
|
727
|
-
'loading': '拼命加載中'
|
|
687
|
+
'loading': '拼命加載中',
|
|
688
|
+
'mismatchChunkSize': '文檔分片上傳部分遺失,請重新上傳,如果多次上傳失敗,請聯系管理員。'
|
|
728
689
|
},
|
|
729
690
|
};
|
|
730
691
|
|
|
@@ -769,6 +730,46 @@ var GspDocSecurityBaseInfo = /** @class */ (function () {
|
|
|
769
730
|
return GspDocSecurityBaseInfo;
|
|
770
731
|
}());
|
|
771
732
|
|
|
733
|
+
/**
|
|
734
|
+
* @fileoverview added by tsickle
|
|
735
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
736
|
+
*/
|
|
737
|
+
var InitMultiUploadRequest = /** @class */ (function () {
|
|
738
|
+
function InitMultiUploadRequest() {
|
|
739
|
+
}
|
|
740
|
+
return InitMultiUploadRequest;
|
|
741
|
+
}());
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* @fileoverview added by tsickle
|
|
745
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
746
|
+
*/
|
|
747
|
+
var CompleteMultiUploadRequest = /** @class */ (function () {
|
|
748
|
+
function CompleteMultiUploadRequest() {
|
|
749
|
+
}
|
|
750
|
+
return CompleteMultiUploadRequest;
|
|
751
|
+
}());
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* @fileoverview added by tsickle
|
|
755
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
756
|
+
*/
|
|
757
|
+
var GspFormStreamEntity = /** @class */ (function () {
|
|
758
|
+
function GspFormStreamEntity() {
|
|
759
|
+
}
|
|
760
|
+
return GspFormStreamEntity;
|
|
761
|
+
}());
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* @fileoverview added by tsickle
|
|
765
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
766
|
+
*/
|
|
767
|
+
var MultiUploadRequest = /** @class */ (function () {
|
|
768
|
+
function MultiUploadRequest() {
|
|
769
|
+
}
|
|
770
|
+
return MultiUploadRequest;
|
|
771
|
+
}());
|
|
772
|
+
|
|
772
773
|
/**
|
|
773
774
|
* @fileoverview added by tsickle
|
|
774
775
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -788,7 +789,7 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
788
789
|
this.beyondFileList = [];
|
|
789
790
|
this.showType = 0;
|
|
790
791
|
this.mouseOn = false;
|
|
791
|
-
this.bufferSize =
|
|
792
|
+
this.bufferSize = 5 * 1024 * 1024;
|
|
792
793
|
this.selectedFileCount = 0;
|
|
793
794
|
this.uploadIconAddress = '/platform/runtime/dfs/images/upload.svg';
|
|
794
795
|
this.uploadLittleIconAddress = '/platform/runtime/dfs/images/uploadIcon.svg';
|
|
@@ -796,8 +797,6 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
796
797
|
this.fileAllSelected = false;
|
|
797
798
|
this.uploadProcess = { width: '0%' };
|
|
798
799
|
this.fileTotalChunk = {};
|
|
799
|
-
//fileUploadState: { [key: string]: boolean } = {};
|
|
800
|
-
//flag: number = 0;
|
|
801
800
|
this.requestArray = new Array;
|
|
802
801
|
this.requestBodyArray = new Array;
|
|
803
802
|
this.uploadedChunk = {};
|
|
@@ -881,14 +880,15 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
881
880
|
_this.haveExtensionProperty = true;
|
|
882
881
|
}
|
|
883
882
|
}));
|
|
884
|
-
this.uploadService.
|
|
883
|
+
this.uploadService.getUploadInfo(this.rootId).subscribe((/**
|
|
885
884
|
* @param {?} res
|
|
886
885
|
* @return {?}
|
|
887
886
|
*/
|
|
888
887
|
function (res) {
|
|
889
888
|
if (res != null && res.error == null) {
|
|
890
889
|
_this.sameNameAllowed = res.sameNameAllowed;
|
|
891
|
-
_this.
|
|
890
|
+
_this.maxFileSize = parseInt(JSON.parse(res.validateConfiguration).maxFileSize);
|
|
891
|
+
_this.allowedMultiUpload = res.allowedMultiUpload;
|
|
892
892
|
if (!_this.sameNameAllowed) {
|
|
893
893
|
_this.uploadService.getUploadedFileInfoList(_this.formId, _this.rootId).subscribe((/**
|
|
894
894
|
* @param {?} res
|
|
@@ -901,18 +901,9 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
901
901
|
}
|
|
902
902
|
}));
|
|
903
903
|
}
|
|
904
|
-
_this.uploadService.getValidation(_this.validationId).subscribe((/**
|
|
905
|
-
* @param {?} res
|
|
906
|
-
* @return {?}
|
|
907
|
-
*/
|
|
908
|
-
function (res) {
|
|
909
|
-
_this.maxFileSize = parseInt(JSON.parse(res.configuration).maxFileSize);
|
|
910
|
-
}));
|
|
911
904
|
}
|
|
912
905
|
}));
|
|
913
|
-
if (this.oldIdList != null && this.oldIdList.length > 0)
|
|
914
|
-
this.uploadService.cancel(this.oldIdList, this.rootId).subscribe();
|
|
915
|
-
}
|
|
906
|
+
if (this.oldIdList != null && this.oldIdList.length > 0) ;
|
|
916
907
|
};
|
|
917
908
|
/**
|
|
918
909
|
* @return {?}
|
|
@@ -936,12 +927,7 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
936
927
|
* @return {?}
|
|
937
928
|
*/
|
|
938
929
|
function ($event) {
|
|
939
|
-
// const loading = this.loadService.show({
|
|
940
|
-
// message: this.localepipe.transform('uploading')
|
|
941
|
-
// });
|
|
942
930
|
var _this = this;
|
|
943
|
-
// this.totalLoad.close();
|
|
944
|
-
// this.totalLoad = null;
|
|
945
931
|
this.hasSelectedFile = true;
|
|
946
932
|
this.selectedFiles = document.querySelector('#file');
|
|
947
933
|
if (this.fileCount > 0) {
|
|
@@ -974,11 +960,6 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
974
960
|
* @return {?}
|
|
975
961
|
*/
|
|
976
962
|
function (x) { return x.fileName == selectedFile.name; })) != null) {
|
|
977
|
-
// this.uploadedNameList.push(selectedFile.name);
|
|
978
|
-
// this.msgService.question('之前已上传过同名文件: ' + selectedFile.name + ',需要替换么?', () => {
|
|
979
|
-
// uuid = this.uploadedFileInfoList.find(x => x.fileName == selectedFile.name).metadataId;
|
|
980
|
-
// this.uploadFile(uuid, selectedFile);
|
|
981
|
-
// })
|
|
982
963
|
/** @type {?} */
|
|
983
964
|
var msg_1 = this_1.msgService.show('warning', this_1.localepipe.transform('haveSameName') + selectedFile.name, {
|
|
984
965
|
initialState: {
|
|
@@ -1066,11 +1047,6 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
1066
1047
|
for (var i = 0; i < this.selectedFiles.files.length; i++) {
|
|
1067
1048
|
_loop_1(i);
|
|
1068
1049
|
}
|
|
1069
|
-
// if (this.uploadedNameList.length > 0) {
|
|
1070
|
-
// let name: string = this.listToString(this.uploadedNameList);
|
|
1071
|
-
// this.msgService.warning('之前已上传过同名文件: ' + name + '请重新选择上传文件。');
|
|
1072
|
-
// this.uploadedNameList = [];
|
|
1073
|
-
// }
|
|
1074
1050
|
if (this.errFileList.length > 0) {
|
|
1075
1051
|
/** @type {?} */
|
|
1076
1052
|
var name_1 = this.listToString(this.errFileList);
|
|
@@ -1091,11 +1067,6 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
1091
1067
|
this.msgService.warning(name_3 + this.localepipe.transform('sizeMax') + this.maxFileSize + "KB" + this.localepipe.transform('rechooseFile'));
|
|
1092
1068
|
this.beyondFileList = [];
|
|
1093
1069
|
}
|
|
1094
|
-
// if (this.errTypeList.length > 0) {
|
|
1095
|
-
// let type: string = this.listToString(this.errTypeList);
|
|
1096
|
-
// this.msgService.warning('不支持上传类型为 ' + type + '的文件请重新选择上传文件。');
|
|
1097
|
-
// this.errTypeList = [];
|
|
1098
|
-
// }
|
|
1099
1070
|
this.files = this.files.slice();
|
|
1100
1071
|
this.fileAllSelected = false;
|
|
1101
1072
|
$event.target.value = '';
|
|
@@ -1202,60 +1173,145 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
1202
1173
|
/** @type {?} */
|
|
1203
1174
|
var fileInfo = this.handleFileInfo(uuid, selectedFile, fileName);
|
|
1204
1175
|
/** @type {?} */
|
|
1205
|
-
var chunkTotal = Math.ceil(selectedFile.size / this.bufferSize);
|
|
1206
|
-
/** @type {?} */
|
|
1207
|
-
var chunkIndex = 0;
|
|
1208
|
-
this.fileTotalChunk[uuid] = chunkTotal;
|
|
1209
|
-
/** @type {?} */
|
|
1210
1176
|
var uploadFileInfo = new UploadFileInfo();
|
|
1211
1177
|
uploadFileInfo.metadataId = uuid;
|
|
1212
1178
|
uploadFileInfo.fileName = fileInfo.name;
|
|
1213
|
-
uploadFileInfo.fileSize = fileInfo.
|
|
1179
|
+
uploadFileInfo.fileSize = fileInfo.fileSize;
|
|
1214
1180
|
uploadFileInfo.state = state;
|
|
1215
1181
|
uploadFileInfo.securityInfo = this.securityInfoList[0];
|
|
1216
|
-
|
|
1182
|
+
//判断是否支持分片上传
|
|
1183
|
+
if (this.allowedMultiUpload) {
|
|
1184
|
+
//支持分片上传
|
|
1217
1185
|
/** @type {?} */
|
|
1218
|
-
var
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1186
|
+
var initRequest = new InitMultiUploadRequest;
|
|
1187
|
+
initRequest.path = this.formId;
|
|
1188
|
+
initRequest.metadataId = uuid;
|
|
1189
|
+
initRequest.rootId = this.rootId;
|
|
1190
|
+
initRequest.size = fileInfo.fileSize;
|
|
1191
|
+
initRequest.fileName = fileName;
|
|
1192
|
+
//初始化分片
|
|
1193
|
+
this.initMultiUpload(initRequest).subscribe((/**
|
|
1194
|
+
* @param {?} res
|
|
1195
|
+
* @return {?}
|
|
1196
|
+
*/
|
|
1197
|
+
function (res) {
|
|
1198
|
+
if (res.error != null) {
|
|
1199
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadResult = false;
|
|
1200
|
+
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1201
|
+
_this.files[_this.files.indexOf(fileInfo)].errorMessage = res.error.Message;
|
|
1202
|
+
}
|
|
1203
|
+
else {
|
|
1204
|
+
/** @type {?} */
|
|
1205
|
+
var uploadId_1 = res.uploadId;
|
|
1206
|
+
/** @type {?} */
|
|
1207
|
+
var chunkTotal = Math.ceil(selectedFile.size / _this.bufferSize);
|
|
1208
|
+
/** @type {?} */
|
|
1209
|
+
var chunkIndex = 0;
|
|
1210
|
+
/** @type {?} */
|
|
1211
|
+
var multiResultList_1 = [];
|
|
1212
|
+
_this.fileTotalChunk[uuid] = chunkTotal;
|
|
1213
|
+
_this.uploadedChunk[uuid] = 0;
|
|
1214
|
+
while (chunkIndex < chunkTotal) {
|
|
1215
|
+
/** @type {?} */
|
|
1216
|
+
var nextSize = Math.min((chunkIndex + 1) * _this.bufferSize, selectedFile.size);
|
|
1217
|
+
/** @type {?} */
|
|
1218
|
+
var fileData = selectedFile.slice(chunkIndex * _this.bufferSize, nextSize);
|
|
1219
|
+
/** @type {?} */
|
|
1220
|
+
var multiRequest = new MultiUploadRequest;
|
|
1221
|
+
multiRequest.metadataId = uuid;
|
|
1222
|
+
multiRequest.rootId = _this.rootId;
|
|
1223
|
+
multiRequest.uploadId = uploadId_1;
|
|
1224
|
+
multiRequest.index = chunkIndex;
|
|
1225
|
+
multiRequest.total = chunkTotal;
|
|
1226
|
+
multiRequest.size = fileData.size;
|
|
1227
|
+
/** @type {?} */
|
|
1228
|
+
var formData = new FormData();
|
|
1229
|
+
formData.append('multiRequest', JSON.stringify(multiRequest));
|
|
1230
|
+
formData.append('file', fileData);
|
|
1231
|
+
_this.multiUpload(formData).subscribe((/**
|
|
1232
|
+
* @param {?} res
|
|
1233
|
+
* @return {?}
|
|
1234
|
+
*/
|
|
1235
|
+
function (res) {
|
|
1236
|
+
if (res.error != null) {
|
|
1237
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadResult = false;
|
|
1238
|
+
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1239
|
+
_this.files[_this.files.indexOf(fileInfo)].errorMessage = res.error.Message;
|
|
1240
|
+
}
|
|
1241
|
+
else {
|
|
1242
|
+
multiResultList_1.push(res.result);
|
|
1243
|
+
_this.uploadedChunk[uuid]++;
|
|
1244
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadProcess = Number.parseInt((_this.uploadedChunk[uuid] / _this.fileTotalChunk[uuid] * 100).toFixed(0));
|
|
1245
|
+
if (_this.uploadedChunk[uuid] == _this.fileTotalChunk[uuid]) {
|
|
1246
|
+
if (multiResultList_1.length == _this.fileTotalChunk[uuid]) {
|
|
1247
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadResult = true;
|
|
1248
|
+
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1249
|
+
_this.uploadFileInfoList = _this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1250
|
+
_this.uploadedFileInfoList = _this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1251
|
+
_this.uploadedFileTotal++;
|
|
1252
|
+
/** @type {?} */
|
|
1253
|
+
var completeMultiUploadRequest = new CompleteMultiUploadRequest;
|
|
1254
|
+
completeMultiUploadRequest.metadataId = uuid;
|
|
1255
|
+
completeMultiUploadRequest.partList = multiResultList_1;
|
|
1256
|
+
completeMultiUploadRequest.rootId = _this.rootId;
|
|
1257
|
+
completeMultiUploadRequest.uploadId = uploadId_1;
|
|
1258
|
+
completeMultiUploadRequest.size = fileInfo.fileSize;
|
|
1259
|
+
if (_this.haveExtensionProperty)
|
|
1260
|
+
completeMultiUploadRequest.exPropertyName = _this.defaultPropertyName;
|
|
1261
|
+
_this.completeMultiUpload(completeMultiUploadRequest).subscribe((/**
|
|
1262
|
+
* @param {?} res
|
|
1263
|
+
* @return {?}
|
|
1264
|
+
*/
|
|
1265
|
+
function (res) {
|
|
1266
|
+
}));
|
|
1267
|
+
//后台异步拼接文档
|
|
1268
|
+
}
|
|
1269
|
+
else {
|
|
1270
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadResult = false;
|
|
1271
|
+
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1272
|
+
_this.files[_this.files.indexOf(fileInfo)].errorMessage = _this.localepipe.transform('mismatchChunkSize');
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
}));
|
|
1277
|
+
chunkIndex = chunkIndex + 1;
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
}));
|
|
1281
|
+
}
|
|
1282
|
+
else {
|
|
1234
1283
|
/** @type {?} */
|
|
1235
|
-
var
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1284
|
+
var entity = new GspFormStreamEntity;
|
|
1285
|
+
entity.formId = this.formId;
|
|
1286
|
+
entity.metadataId = uuid;
|
|
1287
|
+
entity.mode = OperatingModes.Temp;
|
|
1288
|
+
entity.rootId = this.rootId;
|
|
1289
|
+
entity.size = selectedFile.size;
|
|
1290
|
+
entity.fileName = fileName;
|
|
1242
1291
|
if (this.haveExtensionProperty)
|
|
1243
|
-
|
|
1244
|
-
//docInfo.isLast = true;
|
|
1245
|
-
uploadInfo.docInfo = docInfo;
|
|
1246
|
-
// let info = uploadInfo;
|
|
1247
|
-
// this.requestArray.push(this.uploadService.uploadFile(uploadInfo));
|
|
1248
|
-
// this.requestBodyArray.push(info);
|
|
1249
|
-
//封装请求formdata
|
|
1292
|
+
entity.exPropertyName = this.defaultPropertyName;
|
|
1250
1293
|
/** @type {?} */
|
|
1251
1294
|
var formData = new FormData();
|
|
1252
|
-
formData.append('
|
|
1253
|
-
formData.append('
|
|
1254
|
-
formData.
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1295
|
+
formData.append('uploadEntity', JSON.stringify(entity));
|
|
1296
|
+
formData.append('file', selectedFile);
|
|
1297
|
+
this.uploadSingleFile(formData).subscribe((/**
|
|
1298
|
+
* @param {?} res
|
|
1299
|
+
* @return {?}
|
|
1300
|
+
*/
|
|
1301
|
+
function (res) {
|
|
1302
|
+
if (res != null) {
|
|
1303
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadResult = false;
|
|
1304
|
+
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1305
|
+
_this.files[_this.files.indexOf(fileInfo)].errorMessage = res.error.Message;
|
|
1306
|
+
}
|
|
1307
|
+
else {
|
|
1308
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadResult = true;
|
|
1309
|
+
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1310
|
+
_this.uploadFileInfoList = _this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1311
|
+
_this.uploadedFileInfoList = _this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1312
|
+
_this.uploadedFileTotal++;
|
|
1313
|
+
}
|
|
1314
|
+
}));
|
|
1259
1315
|
}
|
|
1260
1316
|
/** @type {?} */
|
|
1261
1317
|
var index = -1;
|
|
@@ -1273,47 +1329,31 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
1273
1329
|
this.files.splice(index, 1);
|
|
1274
1330
|
this.uploadFileInfoList.splice(index, 1);
|
|
1275
1331
|
this.uploadedFileInfoList.splice(index, 1);
|
|
1276
|
-
this.uploadedFileTotal--;
|
|
1332
|
+
//this.uploadedFileTotal--;
|
|
1277
1333
|
}
|
|
1278
1334
|
};
|
|
1279
1335
|
/**
|
|
1280
|
-
* @param {?}
|
|
1281
|
-
* @param {?} fileInfo
|
|
1282
|
-
* @param {?} docInfo
|
|
1283
|
-
* @param {?} uploadFileInfo
|
|
1336
|
+
* @param {?} formdata
|
|
1284
1337
|
* @return {?}
|
|
1285
1338
|
*/
|
|
1286
|
-
FileUploadComponent.prototype.
|
|
1287
|
-
* @param {?}
|
|
1288
|
-
* @param {?} fileInfo
|
|
1289
|
-
* @param {?} docInfo
|
|
1290
|
-
* @param {?} uploadFileInfo
|
|
1339
|
+
FileUploadComponent.prototype.uploadSingleFile = /**
|
|
1340
|
+
* @param {?} formdata
|
|
1291
1341
|
* @return {?}
|
|
1292
1342
|
*/
|
|
1293
|
-
function (
|
|
1294
|
-
|
|
1295
|
-
|
|
1343
|
+
function (formdata) {
|
|
1344
|
+
/** @type {?} */
|
|
1345
|
+
var url = "/api/runtime/dfs/v1.0/formdoc/single";
|
|
1346
|
+
return this.httpclient.post(url, formdata).pipe(tap((/**
|
|
1296
1347
|
* @param {?} res
|
|
1297
1348
|
* @return {?}
|
|
1298
1349
|
*/
|
|
1299
|
-
function (res) {
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
_this.uploadedChunk[docInfo.metadataId]++;
|
|
1307
|
-
_this.files[_this.files.indexOf(fileInfo)].uploadProcess = Number.parseInt((_this.uploadedChunk[docInfo.metadataId] / _this.fileTotalChunk[docInfo.metadataId] * 100).toFixed(0));
|
|
1308
|
-
if (_this.uploadedChunk[docInfo.metadataId] == _this.fileTotalChunk[docInfo.metadataId]) {
|
|
1309
|
-
_this.files[_this.files.indexOf(fileInfo)].uploadResult = true;
|
|
1310
|
-
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1311
|
-
_this.uploadFileInfoList = _this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1312
|
-
_this.uploadedFileInfoList = _this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1313
|
-
_this.uploadedFileTotal++;
|
|
1314
|
-
}
|
|
1315
|
-
}
|
|
1316
|
-
}));
|
|
1350
|
+
function (res) { })), catchError((/**
|
|
1351
|
+
* @param {?} error
|
|
1352
|
+
* @return {?}
|
|
1353
|
+
*/
|
|
1354
|
+
function (error) {
|
|
1355
|
+
return of$1(error);
|
|
1356
|
+
})));
|
|
1317
1357
|
};
|
|
1318
1358
|
/**
|
|
1319
1359
|
* @param {?} formdata
|
|
@@ -1326,7 +1366,6 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
1326
1366
|
function (formdata) {
|
|
1327
1367
|
/** @type {?} */
|
|
1328
1368
|
var url = "/api/runtime/dfs/v1.0/formdoc/slice";
|
|
1329
|
-
//url = "/api/runtime/dfs/v1.0/formdoc/list";
|
|
1330
1369
|
return this.httpclient.post(url, formdata).pipe(tap((/**
|
|
1331
1370
|
* @param {?} res
|
|
1332
1371
|
* @return {?}
|
|
@@ -1339,6 +1378,75 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
1339
1378
|
return of$1(error);
|
|
1340
1379
|
})));
|
|
1341
1380
|
};
|
|
1381
|
+
/**
|
|
1382
|
+
* @param {?} request
|
|
1383
|
+
* @return {?}
|
|
1384
|
+
*/
|
|
1385
|
+
FileUploadComponent.prototype.initMultiUpload = /**
|
|
1386
|
+
* @param {?} request
|
|
1387
|
+
* @return {?}
|
|
1388
|
+
*/
|
|
1389
|
+
function (request) {
|
|
1390
|
+
/** @type {?} */
|
|
1391
|
+
var url = "/api/runtime/dfs/v1.0/formdoc/multi/init";
|
|
1392
|
+
return this.httpclient.post(url, request).pipe(tap((/**
|
|
1393
|
+
* @param {?} res
|
|
1394
|
+
* @return {?}
|
|
1395
|
+
*/
|
|
1396
|
+
function (res) { })), catchError((/**
|
|
1397
|
+
* @param {?} error
|
|
1398
|
+
* @return {?}
|
|
1399
|
+
*/
|
|
1400
|
+
function (error) {
|
|
1401
|
+
return of$1(error);
|
|
1402
|
+
})));
|
|
1403
|
+
};
|
|
1404
|
+
/**
|
|
1405
|
+
* @param {?} formdata
|
|
1406
|
+
* @return {?}
|
|
1407
|
+
*/
|
|
1408
|
+
FileUploadComponent.prototype.multiUpload = /**
|
|
1409
|
+
* @param {?} formdata
|
|
1410
|
+
* @return {?}
|
|
1411
|
+
*/
|
|
1412
|
+
function (formdata) {
|
|
1413
|
+
/** @type {?} */
|
|
1414
|
+
var url = "/api/runtime/dfs/v1.0/formdoc/multi/upload";
|
|
1415
|
+
return this.httpclient.post(url, formdata).pipe(tap((/**
|
|
1416
|
+
* @param {?} res
|
|
1417
|
+
* @return {?}
|
|
1418
|
+
*/
|
|
1419
|
+
function (res) { })), catchError((/**
|
|
1420
|
+
* @param {?} error
|
|
1421
|
+
* @return {?}
|
|
1422
|
+
*/
|
|
1423
|
+
function (error) {
|
|
1424
|
+
return of$1(error);
|
|
1425
|
+
})));
|
|
1426
|
+
};
|
|
1427
|
+
/**
|
|
1428
|
+
* @param {?} request
|
|
1429
|
+
* @return {?}
|
|
1430
|
+
*/
|
|
1431
|
+
FileUploadComponent.prototype.completeMultiUpload = /**
|
|
1432
|
+
* @param {?} request
|
|
1433
|
+
* @return {?}
|
|
1434
|
+
*/
|
|
1435
|
+
function (request) {
|
|
1436
|
+
/** @type {?} */
|
|
1437
|
+
var url = "/api/runtime/dfs/v1.0/formdoc/multi/complete";
|
|
1438
|
+
return this.httpclient.post(url, request).pipe(tap((/**
|
|
1439
|
+
* @param {?} res
|
|
1440
|
+
* @return {?}
|
|
1441
|
+
*/
|
|
1442
|
+
function (res) { })), catchError((/**
|
|
1443
|
+
* @param {?} error
|
|
1444
|
+
* @return {?}
|
|
1445
|
+
*/
|
|
1446
|
+
function (error) {
|
|
1447
|
+
return of$1(error);
|
|
1448
|
+
})));
|
|
1449
|
+
};
|
|
1342
1450
|
/**
|
|
1343
1451
|
* @return {?}
|
|
1344
1452
|
*/
|
|
@@ -1352,8 +1460,6 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
1352
1460
|
* @return {?}
|
|
1353
1461
|
*/
|
|
1354
1462
|
function (element) {
|
|
1355
|
-
// let obj: any = document.getElementById(element.name);
|
|
1356
|
-
// obj.checked = true;
|
|
1357
1463
|
element.selectd = true;
|
|
1358
1464
|
}));
|
|
1359
1465
|
this.fileAllSelected = true;
|
|
@@ -1365,8 +1471,6 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
1365
1471
|
* @return {?}
|
|
1366
1472
|
*/
|
|
1367
1473
|
function (element) {
|
|
1368
|
-
// let obj: any = document.getElementById(element.name);
|
|
1369
|
-
// obj.checked = false;
|
|
1370
1474
|
element.selectd = false;
|
|
1371
1475
|
}));
|
|
1372
1476
|
this.fileAllSelected = false;
|
|
@@ -1460,9 +1564,6 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
1460
1564
|
metadataList.push(element.id);
|
|
1461
1565
|
_this.files.splice(_this.files.indexOf(element), 1);
|
|
1462
1566
|
if (element.uploadResult) {
|
|
1463
|
-
// let idList: string[] = [];
|
|
1464
|
-
// idList.push(fileInfo.id);
|
|
1465
|
-
// this.uploadService.cancel(idList, this.rootId).subscribe();
|
|
1466
1567
|
_this.uploadFileInfoList.splice(_this.uploadFileInfoList.indexOf(_this.uploadFileInfoList.filter((/**
|
|
1467
1568
|
* @param {?} x
|
|
1468
1569
|
* @return {?}
|
|
@@ -1577,20 +1678,28 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
1577
1678
|
}
|
|
1578
1679
|
fileInfo.source = imgUrl;
|
|
1579
1680
|
_this.files.push(fileInfo);
|
|
1681
|
+
//因为异步处理的差异,补偿一次删除
|
|
1682
|
+
/** @type {?} */
|
|
1683
|
+
var index = -1;
|
|
1684
|
+
_this.files.forEach((/**
|
|
1685
|
+
* @param {?} x
|
|
1686
|
+
* @return {?}
|
|
1687
|
+
*/
|
|
1688
|
+
function (x) {
|
|
1689
|
+
if (x.name == fileInfo.name) {
|
|
1690
|
+
if (index == -1)
|
|
1691
|
+
index = _this.files.indexOf(x);
|
|
1692
|
+
}
|
|
1693
|
+
}));
|
|
1694
|
+
if (index != -1 && index != _this.files.length - 1) {
|
|
1695
|
+
_this.files.splice(index, 1);
|
|
1696
|
+
_this.uploadFileInfoList.splice(index, 1);
|
|
1697
|
+
_this.uploadedFileInfoList.splice(index, 1);
|
|
1698
|
+
}
|
|
1580
1699
|
});
|
|
1581
1700
|
}
|
|
1582
1701
|
}
|
|
1583
1702
|
};
|
|
1584
|
-
/**
|
|
1585
|
-
* @param {?} selectdFile
|
|
1586
|
-
* @return {?}
|
|
1587
|
-
*/
|
|
1588
|
-
FileUploadComponent.prototype.getImageUrl = /**
|
|
1589
|
-
* @param {?} selectdFile
|
|
1590
|
-
* @return {?}
|
|
1591
|
-
*/
|
|
1592
|
-
function (selectdFile) {
|
|
1593
|
-
};
|
|
1594
1703
|
/**
|
|
1595
1704
|
* @param {?} strList
|
|
1596
1705
|
* @return {?}
|
|
@@ -1686,9 +1795,6 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
1686
1795
|
* @return {?}
|
|
1687
1796
|
*/
|
|
1688
1797
|
function (x) { return x.isUploading || x.uploadResult; })).length) {
|
|
1689
|
-
// this.notifyService.success(<NotifyOptions>{
|
|
1690
|
-
// msg: '保存成功!', timeout: 3000
|
|
1691
|
-
// });
|
|
1692
1798
|
this.msgService.warning(this.localepipe.transform('wait'));
|
|
1693
1799
|
return of$1(false);
|
|
1694
1800
|
}
|
|
@@ -1769,9 +1875,6 @@ var FileUploadComponent = /** @class */ (function () {
|
|
|
1769
1875
|
*/
|
|
1770
1876
|
function (x) { return x.metadataId == file.id; })), 1);
|
|
1771
1877
|
}
|
|
1772
|
-
// var obj:any = document.querySelector('#file');
|
|
1773
|
-
// obj.files.remove();
|
|
1774
|
-
//obj.value='';
|
|
1775
1878
|
};
|
|
1776
1879
|
/**
|
|
1777
1880
|
* @param {?} size
|
|
@@ -1884,6 +1987,19 @@ var DownloadService = /** @class */ (function () {
|
|
|
1884
1987
|
function (metadataId, rootId) {
|
|
1885
1988
|
return "/api/runtime/dfs/v1.0/doc/filecontent?metadataid=" + metadataId + "&rootid=" + rootId + "&token=" + this.getToken(this.mergeString(metadataId, rootId));
|
|
1886
1989
|
};
|
|
1990
|
+
/**
|
|
1991
|
+
* @param {?} metadataId
|
|
1992
|
+
* @param {?} rootId
|
|
1993
|
+
* @return {?}
|
|
1994
|
+
*/
|
|
1995
|
+
DownloadService.prototype.getStreamDownloadUrl = /**
|
|
1996
|
+
* @param {?} metadataId
|
|
1997
|
+
* @param {?} rootId
|
|
1998
|
+
* @return {?}
|
|
1999
|
+
*/
|
|
2000
|
+
function (metadataId, rootId) {
|
|
2001
|
+
return "/api/runtime/dfs/v1.0/formdoc/stream?metadataid=" + metadataId + "&rootid=" + rootId + "&token=" + this.getToken(this.mergeString(metadataId, rootId));
|
|
2002
|
+
};
|
|
1887
2003
|
/**
|
|
1888
2004
|
* @param {?} metadataIdList
|
|
1889
2005
|
* @param {?} rootId
|
|
@@ -2377,6 +2493,16 @@ var GspFormUploadListEntity = /** @class */ (function () {
|
|
|
2377
2493
|
return GspFormUploadListEntity;
|
|
2378
2494
|
}());
|
|
2379
2495
|
|
|
2496
|
+
/**
|
|
2497
|
+
* @fileoverview added by tsickle
|
|
2498
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2499
|
+
*/
|
|
2500
|
+
var GspFormDocInfo = /** @class */ (function () {
|
|
2501
|
+
function GspFormDocInfo() {
|
|
2502
|
+
}
|
|
2503
|
+
return GspFormDocInfo;
|
|
2504
|
+
}());
|
|
2505
|
+
|
|
2380
2506
|
/**
|
|
2381
2507
|
* @fileoverview added by tsickle
|
|
2382
2508
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -2387,6 +2513,16 @@ var GspDocMetaProperty = /** @class */ (function () {
|
|
|
2387
2513
|
return GspDocMetaProperty;
|
|
2388
2514
|
}());
|
|
2389
2515
|
|
|
2516
|
+
/**
|
|
2517
|
+
* @fileoverview added by tsickle
|
|
2518
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2519
|
+
*/
|
|
2520
|
+
var GspFormUploadEntity = /** @class */ (function () {
|
|
2521
|
+
function GspFormUploadEntity() {
|
|
2522
|
+
}
|
|
2523
|
+
return GspFormUploadEntity;
|
|
2524
|
+
}());
|
|
2525
|
+
|
|
2390
2526
|
/**
|
|
2391
2527
|
* @fileoverview added by tsickle
|
|
2392
2528
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|