@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
|
@@ -11,7 +11,7 @@ import { ProgressModule } from '@farris/ui-progress';
|
|
|
11
11
|
import { FormsModule } from '@angular/forms';
|
|
12
12
|
import { ComboListModule } from '@farris/ui-combo-list';
|
|
13
13
|
import { CacheService, HttpService, LanguageService, SessionService } from '@ecp-caf/caf-common';
|
|
14
|
-
import { Injectable, Pipe, Inject, LOCALE_ID, Component, Injector, ComponentFactoryResolver, ViewChild, Input,
|
|
14
|
+
import { Injectable, Pipe, Inject, LOCALE_ID, Component, NgModule, Injector, ComponentFactoryResolver, ViewChild, Input, defineInjectable } from '@angular/core';
|
|
15
15
|
import { BsModalService } from '@farris/ui-modal';
|
|
16
16
|
import { of as of$1 } from 'rxjs';
|
|
17
17
|
import { HttpClientModule, HttpClient } from '@angular/common/http';
|
|
@@ -99,13 +99,6 @@ DocType[DocType.Txt] = 'Txt';
|
|
|
99
99
|
DocType[DocType.Image] = 'Image';
|
|
100
100
|
DocType[DocType.Other] = 'Other';
|
|
101
101
|
|
|
102
|
-
/**
|
|
103
|
-
* @fileoverview added by tsickle
|
|
104
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
105
|
-
*/
|
|
106
|
-
class GspFormDocInfo {
|
|
107
|
-
}
|
|
108
|
-
|
|
109
102
|
/**
|
|
110
103
|
* @fileoverview added by tsickle
|
|
111
104
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -435,28 +428,9 @@ class UploadService {
|
|
|
435
428
|
* @param {?} rootId
|
|
436
429
|
* @return {?}
|
|
437
430
|
*/
|
|
438
|
-
|
|
439
|
-
/** @type {?} */
|
|
440
|
-
let url = "/api/runtime/dfs/v1.0/rootsetting/" + rootId;
|
|
441
|
-
return this.http.get(url).pipe(tap((/**
|
|
442
|
-
* @param {?} res
|
|
443
|
-
* @return {?}
|
|
444
|
-
*/
|
|
445
|
-
res => { })), catchError((/**
|
|
446
|
-
* @param {?} error
|
|
447
|
-
* @return {?}
|
|
448
|
-
*/
|
|
449
|
-
(error) => {
|
|
450
|
-
return of(error);
|
|
451
|
-
})));
|
|
452
|
-
}
|
|
453
|
-
/**
|
|
454
|
-
* @param {?} id
|
|
455
|
-
* @return {?}
|
|
456
|
-
*/
|
|
457
|
-
getValidation(id) {
|
|
431
|
+
getUploadInfo(rootId) {
|
|
458
432
|
/** @type {?} */
|
|
459
|
-
let url = "/api/runtime/dfs/v1.0/
|
|
433
|
+
let url = "/api/runtime/dfs/v1.0/rootsetting/info?id=" + rootId;
|
|
460
434
|
return this.http.get(url).pipe(tap((/**
|
|
461
435
|
* @param {?} res
|
|
462
436
|
* @return {?}
|
|
@@ -486,13 +460,6 @@ UploadService.ctorParameters = () => [
|
|
|
486
460
|
class UploadFileInfo {
|
|
487
461
|
}
|
|
488
462
|
|
|
489
|
-
/**
|
|
490
|
-
* @fileoverview added by tsickle
|
|
491
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
492
|
-
*/
|
|
493
|
-
class GspFormUploadEntity {
|
|
494
|
-
}
|
|
495
|
-
|
|
496
463
|
/**
|
|
497
464
|
* @fileoverview added by tsickle
|
|
498
465
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -544,7 +511,8 @@ const LANG_RESOURCES = {
|
|
|
544
511
|
'operation': '操作',
|
|
545
512
|
'size': '大小',
|
|
546
513
|
'close': '关闭',
|
|
547
|
-
'loading': '拼命加载中'
|
|
514
|
+
'loading': '拼命加载中',
|
|
515
|
+
'mismatchChunkSize': '文档分片上传部分丢失,请重新上传,如果多次上传失败,请联系管理员。'
|
|
548
516
|
},
|
|
549
517
|
'en-US': {
|
|
550
518
|
'uploadFile': 'Upload File',
|
|
@@ -572,7 +540,8 @@ const LANG_RESOURCES = {
|
|
|
572
540
|
'operation': 'Operation',
|
|
573
541
|
'size': 'Size',
|
|
574
542
|
'close': 'Close',
|
|
575
|
-
'loading': 'Loading'
|
|
543
|
+
'loading': 'Loading',
|
|
544
|
+
'mismatchChunkSize': 'The partial upload of document shards is missing. Please upload again. If multiple uploads fail, please contact the administrator.'
|
|
576
545
|
},
|
|
577
546
|
'en': {
|
|
578
547
|
'uploadFile': 'Upload File',
|
|
@@ -600,7 +569,8 @@ const LANG_RESOURCES = {
|
|
|
600
569
|
'operation': 'Operation',
|
|
601
570
|
'size': 'Size',
|
|
602
571
|
'close': 'Close',
|
|
603
|
-
'loading': 'Loading'
|
|
572
|
+
'loading': 'Loading',
|
|
573
|
+
'mismatchChunkSize': 'The partial upload of document shards is missing. Please upload again. If multiple uploads fail, please contact the administrator.'
|
|
604
574
|
},
|
|
605
575
|
'zh-CHT': {
|
|
606
576
|
'uploadFile': '上傳文件',
|
|
@@ -628,7 +598,8 @@ const LANG_RESOURCES = {
|
|
|
628
598
|
'operation': '操作',
|
|
629
599
|
'size': '大小',
|
|
630
600
|
'close': '關閉',
|
|
631
|
-
'loading': '拼命加載中'
|
|
601
|
+
'loading': '拼命加載中',
|
|
602
|
+
'mismatchChunkSize': '文檔分片上傳部分遺失,請重新上傳,如果多次上傳失敗,請聯系管理員。'
|
|
632
603
|
},
|
|
633
604
|
};
|
|
634
605
|
|
|
@@ -668,6 +639,34 @@ LocalLangPipe.ctorParameters = () => [
|
|
|
668
639
|
class GspDocSecurityBaseInfo {
|
|
669
640
|
}
|
|
670
641
|
|
|
642
|
+
/**
|
|
643
|
+
* @fileoverview added by tsickle
|
|
644
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
645
|
+
*/
|
|
646
|
+
class InitMultiUploadRequest {
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* @fileoverview added by tsickle
|
|
651
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
652
|
+
*/
|
|
653
|
+
class CompleteMultiUploadRequest {
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* @fileoverview added by tsickle
|
|
658
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
659
|
+
*/
|
|
660
|
+
class GspFormStreamEntity {
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* @fileoverview added by tsickle
|
|
665
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
666
|
+
*/
|
|
667
|
+
class MultiUploadRequest {
|
|
668
|
+
}
|
|
669
|
+
|
|
671
670
|
/**
|
|
672
671
|
* @fileoverview added by tsickle
|
|
673
672
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -693,7 +692,7 @@ class FileUploadComponent {
|
|
|
693
692
|
this.beyondFileList = [];
|
|
694
693
|
this.showType = 0;
|
|
695
694
|
this.mouseOn = false;
|
|
696
|
-
this.bufferSize =
|
|
695
|
+
this.bufferSize = 5 * 1024 * 1024;
|
|
697
696
|
this.selectedFileCount = 0;
|
|
698
697
|
this.uploadIconAddress = '/platform/runtime/dfs/images/upload.svg';
|
|
699
698
|
this.uploadLittleIconAddress = '/platform/runtime/dfs/images/uploadIcon.svg';
|
|
@@ -701,8 +700,6 @@ class FileUploadComponent {
|
|
|
701
700
|
this.fileAllSelected = false;
|
|
702
701
|
this.uploadProcess = { width: '0%' };
|
|
703
702
|
this.fileTotalChunk = {};
|
|
704
|
-
//fileUploadState: { [key: string]: boolean } = {};
|
|
705
|
-
//flag: number = 0;
|
|
706
703
|
this.requestArray = new Array;
|
|
707
704
|
this.requestBodyArray = new Array;
|
|
708
705
|
this.uploadedChunk = {};
|
|
@@ -783,14 +780,15 @@ class FileUploadComponent {
|
|
|
783
780
|
this.haveExtensionProperty = true;
|
|
784
781
|
}
|
|
785
782
|
}));
|
|
786
|
-
this.uploadService.
|
|
783
|
+
this.uploadService.getUploadInfo(this.rootId).subscribe((/**
|
|
787
784
|
* @param {?} res
|
|
788
785
|
* @return {?}
|
|
789
786
|
*/
|
|
790
787
|
res => {
|
|
791
788
|
if (res != null && res.error == null) {
|
|
792
789
|
this.sameNameAllowed = res.sameNameAllowed;
|
|
793
|
-
this.
|
|
790
|
+
this.maxFileSize = parseInt(JSON.parse(res.validateConfiguration).maxFileSize);
|
|
791
|
+
this.allowedMultiUpload = res.allowedMultiUpload;
|
|
794
792
|
if (!this.sameNameAllowed) {
|
|
795
793
|
this.uploadService.getUploadedFileInfoList(this.formId, this.rootId).subscribe((/**
|
|
796
794
|
* @param {?} res
|
|
@@ -803,18 +801,9 @@ class FileUploadComponent {
|
|
|
803
801
|
}
|
|
804
802
|
}));
|
|
805
803
|
}
|
|
806
|
-
this.uploadService.getValidation(this.validationId).subscribe((/**
|
|
807
|
-
* @param {?} res
|
|
808
|
-
* @return {?}
|
|
809
|
-
*/
|
|
810
|
-
res => {
|
|
811
|
-
this.maxFileSize = parseInt(JSON.parse(res.configuration).maxFileSize);
|
|
812
|
-
}));
|
|
813
804
|
}
|
|
814
805
|
}));
|
|
815
|
-
if (this.oldIdList != null && this.oldIdList.length > 0)
|
|
816
|
-
this.uploadService.cancel(this.oldIdList, this.rootId).subscribe();
|
|
817
|
-
}
|
|
806
|
+
if (this.oldIdList != null && this.oldIdList.length > 0) ;
|
|
818
807
|
}
|
|
819
808
|
/**
|
|
820
809
|
* @return {?}
|
|
@@ -831,11 +820,6 @@ class FileUploadComponent {
|
|
|
831
820
|
* @return {?}
|
|
832
821
|
*/
|
|
833
822
|
fileSelected($event) {
|
|
834
|
-
// const loading = this.loadService.show({
|
|
835
|
-
// message: this.localepipe.transform('uploading')
|
|
836
|
-
// });
|
|
837
|
-
// this.totalLoad.close();
|
|
838
|
-
// this.totalLoad = null;
|
|
839
823
|
this.hasSelectedFile = true;
|
|
840
824
|
this.selectedFiles = document.querySelector('#file');
|
|
841
825
|
if (this.fileCount > 0) {
|
|
@@ -869,11 +853,6 @@ class FileUploadComponent {
|
|
|
869
853
|
* @return {?}
|
|
870
854
|
*/
|
|
871
855
|
x => x.fileName == selectedFile.name)) != null) {
|
|
872
|
-
// this.uploadedNameList.push(selectedFile.name);
|
|
873
|
-
// this.msgService.question('之前已上传过同名文件: ' + selectedFile.name + ',需要替换么?', () => {
|
|
874
|
-
// uuid = this.uploadedFileInfoList.find(x => x.fileName == selectedFile.name).metadataId;
|
|
875
|
-
// this.uploadFile(uuid, selectedFile);
|
|
876
|
-
// })
|
|
877
856
|
/** @type {?} */
|
|
878
857
|
const msg = this.msgService.show('warning', this.localepipe.transform('haveSameName') + selectedFile.name, {
|
|
879
858
|
initialState: {
|
|
@@ -956,11 +935,6 @@ class FileUploadComponent {
|
|
|
956
935
|
}
|
|
957
936
|
this.uploadFile(uuid, selectedFile, selectedFile.name);
|
|
958
937
|
}
|
|
959
|
-
// if (this.uploadedNameList.length > 0) {
|
|
960
|
-
// let name: string = this.listToString(this.uploadedNameList);
|
|
961
|
-
// this.msgService.warning('之前已上传过同名文件: ' + name + '请重新选择上传文件。');
|
|
962
|
-
// this.uploadedNameList = [];
|
|
963
|
-
// }
|
|
964
938
|
if (this.errFileList.length > 0) {
|
|
965
939
|
/** @type {?} */
|
|
966
940
|
let name = this.listToString(this.errFileList);
|
|
@@ -981,11 +955,6 @@ class FileUploadComponent {
|
|
|
981
955
|
this.msgService.warning(name + this.localepipe.transform('sizeMax') + this.maxFileSize + "KB" + this.localepipe.transform('rechooseFile'));
|
|
982
956
|
this.beyondFileList = [];
|
|
983
957
|
}
|
|
984
|
-
// if (this.errTypeList.length > 0) {
|
|
985
|
-
// let type: string = this.listToString(this.errTypeList);
|
|
986
|
-
// this.msgService.warning('不支持上传类型为 ' + type + '的文件请重新选择上传文件。');
|
|
987
|
-
// this.errTypeList = [];
|
|
988
|
-
// }
|
|
989
958
|
this.files = this.files.slice();
|
|
990
959
|
this.fileAllSelected = false;
|
|
991
960
|
$event.target.value = '';
|
|
@@ -1073,60 +1042,145 @@ class FileUploadComponent {
|
|
|
1073
1042
|
/** @type {?} */
|
|
1074
1043
|
let fileInfo = this.handleFileInfo(uuid, selectedFile, fileName);
|
|
1075
1044
|
/** @type {?} */
|
|
1076
|
-
let chunkTotal = Math.ceil(selectedFile.size / this.bufferSize);
|
|
1077
|
-
/** @type {?} */
|
|
1078
|
-
let chunkIndex = 0;
|
|
1079
|
-
this.fileTotalChunk[uuid] = chunkTotal;
|
|
1080
|
-
/** @type {?} */
|
|
1081
1045
|
let uploadFileInfo = new UploadFileInfo();
|
|
1082
1046
|
uploadFileInfo.metadataId = uuid;
|
|
1083
1047
|
uploadFileInfo.fileName = fileInfo.name;
|
|
1084
|
-
uploadFileInfo.fileSize = fileInfo.
|
|
1048
|
+
uploadFileInfo.fileSize = fileInfo.fileSize;
|
|
1085
1049
|
uploadFileInfo.state = state;
|
|
1086
1050
|
uploadFileInfo.securityInfo = this.securityInfoList[0];
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
uploadInfo.formId = this.formId;
|
|
1091
|
-
uploadInfo.mode = OperatingModes.Temp;
|
|
1092
|
-
uploadInfo.rootId = this.rootId;
|
|
1093
|
-
/** @type {?} */
|
|
1094
|
-
let docInfo = new GspFormDocInfo;
|
|
1095
|
-
docInfo.fileName = fileName;
|
|
1096
|
-
docInfo.metadataId = uuid;
|
|
1097
|
-
docInfo.total = chunkTotal;
|
|
1098
|
-
this.uploadedChunk[docInfo.metadataId] = 0;
|
|
1099
|
-
/** @type {?} */
|
|
1100
|
-
let nextSize = Math.min((chunkIndex + 1) * this.bufferSize, selectedFile.size);
|
|
1051
|
+
//判断是否支持分片上传
|
|
1052
|
+
if (this.allowedMultiUpload) {
|
|
1053
|
+
//支持分片上传
|
|
1101
1054
|
/** @type {?} */
|
|
1102
|
-
let
|
|
1103
|
-
|
|
1104
|
-
|
|
1055
|
+
let initRequest = new InitMultiUploadRequest;
|
|
1056
|
+
initRequest.path = this.formId;
|
|
1057
|
+
initRequest.metadataId = uuid;
|
|
1058
|
+
initRequest.rootId = this.rootId;
|
|
1059
|
+
initRequest.size = fileInfo.fileSize;
|
|
1060
|
+
initRequest.fileName = fileName;
|
|
1061
|
+
//初始化分片
|
|
1062
|
+
this.initMultiUpload(initRequest).subscribe((/**
|
|
1063
|
+
* @param {?} res
|
|
1064
|
+
* @return {?}
|
|
1065
|
+
*/
|
|
1066
|
+
res => {
|
|
1067
|
+
if (res.error != null) {
|
|
1068
|
+
this.files[this.files.indexOf(fileInfo)].uploadResult = false;
|
|
1069
|
+
this.files[this.files.indexOf(fileInfo)].isUploading = false;
|
|
1070
|
+
this.files[this.files.indexOf(fileInfo)].errorMessage = res.error.Message;
|
|
1071
|
+
}
|
|
1072
|
+
else {
|
|
1073
|
+
/** @type {?} */
|
|
1074
|
+
let uploadId = res.uploadId;
|
|
1075
|
+
/** @type {?} */
|
|
1076
|
+
let chunkTotal = Math.ceil(selectedFile.size / this.bufferSize);
|
|
1077
|
+
/** @type {?} */
|
|
1078
|
+
let chunkIndex = 0;
|
|
1079
|
+
/** @type {?} */
|
|
1080
|
+
let multiResultList = [];
|
|
1081
|
+
this.fileTotalChunk[uuid] = chunkTotal;
|
|
1082
|
+
this.uploadedChunk[uuid] = 0;
|
|
1083
|
+
while (chunkIndex < chunkTotal) {
|
|
1084
|
+
/** @type {?} */
|
|
1085
|
+
let nextSize = Math.min((chunkIndex + 1) * this.bufferSize, selectedFile.size);
|
|
1086
|
+
/** @type {?} */
|
|
1087
|
+
let fileData = selectedFile.slice(chunkIndex * this.bufferSize, nextSize);
|
|
1088
|
+
/** @type {?} */
|
|
1089
|
+
let multiRequest = new MultiUploadRequest;
|
|
1090
|
+
multiRequest.metadataId = uuid;
|
|
1091
|
+
multiRequest.rootId = this.rootId;
|
|
1092
|
+
multiRequest.uploadId = uploadId;
|
|
1093
|
+
multiRequest.index = chunkIndex;
|
|
1094
|
+
multiRequest.total = chunkTotal;
|
|
1095
|
+
multiRequest.size = fileData.size;
|
|
1096
|
+
/** @type {?} */
|
|
1097
|
+
let formData = new FormData();
|
|
1098
|
+
formData.append('multiRequest', JSON.stringify(multiRequest));
|
|
1099
|
+
formData.append('file', fileData);
|
|
1100
|
+
this.multiUpload(formData).subscribe((/**
|
|
1101
|
+
* @param {?} res
|
|
1102
|
+
* @return {?}
|
|
1103
|
+
*/
|
|
1104
|
+
res => {
|
|
1105
|
+
if (res.error != null) {
|
|
1106
|
+
this.files[this.files.indexOf(fileInfo)].uploadResult = false;
|
|
1107
|
+
this.files[this.files.indexOf(fileInfo)].isUploading = false;
|
|
1108
|
+
this.files[this.files.indexOf(fileInfo)].errorMessage = res.error.Message;
|
|
1109
|
+
}
|
|
1110
|
+
else {
|
|
1111
|
+
multiResultList.push(res.result);
|
|
1112
|
+
this.uploadedChunk[uuid]++;
|
|
1113
|
+
this.files[this.files.indexOf(fileInfo)].uploadProcess = Number.parseInt((this.uploadedChunk[uuid] / this.fileTotalChunk[uuid] * 100).toFixed(0));
|
|
1114
|
+
if (this.uploadedChunk[uuid] == this.fileTotalChunk[uuid]) {
|
|
1115
|
+
if (multiResultList.length == this.fileTotalChunk[uuid]) {
|
|
1116
|
+
this.files[this.files.indexOf(fileInfo)].uploadResult = true;
|
|
1117
|
+
this.files[this.files.indexOf(fileInfo)].isUploading = false;
|
|
1118
|
+
this.uploadFileInfoList = this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1119
|
+
this.uploadedFileInfoList = this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1120
|
+
this.uploadedFileTotal++;
|
|
1121
|
+
/** @type {?} */
|
|
1122
|
+
let completeMultiUploadRequest = new CompleteMultiUploadRequest;
|
|
1123
|
+
completeMultiUploadRequest.metadataId = uuid;
|
|
1124
|
+
completeMultiUploadRequest.partList = multiResultList;
|
|
1125
|
+
completeMultiUploadRequest.rootId = this.rootId;
|
|
1126
|
+
completeMultiUploadRequest.uploadId = uploadId;
|
|
1127
|
+
completeMultiUploadRequest.size = fileInfo.fileSize;
|
|
1128
|
+
if (this.haveExtensionProperty)
|
|
1129
|
+
completeMultiUploadRequest.exPropertyName = this.defaultPropertyName;
|
|
1130
|
+
this.completeMultiUpload(completeMultiUploadRequest).subscribe((/**
|
|
1131
|
+
* @param {?} res
|
|
1132
|
+
* @return {?}
|
|
1133
|
+
*/
|
|
1134
|
+
res => {
|
|
1135
|
+
}));
|
|
1136
|
+
//后台异步拼接文档
|
|
1137
|
+
}
|
|
1138
|
+
else {
|
|
1139
|
+
this.files[this.files.indexOf(fileInfo)].uploadResult = false;
|
|
1140
|
+
this.files[this.files.indexOf(fileInfo)].isUploading = false;
|
|
1141
|
+
this.files[this.files.indexOf(fileInfo)].errorMessage = this.localepipe.transform('mismatchChunkSize');
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
}));
|
|
1146
|
+
chunkIndex = chunkIndex + 1;
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
}));
|
|
1150
|
+
}
|
|
1151
|
+
else {
|
|
1105
1152
|
/** @type {?} */
|
|
1106
|
-
let
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1153
|
+
let entity = new GspFormStreamEntity;
|
|
1154
|
+
entity.formId = this.formId;
|
|
1155
|
+
entity.metadataId = uuid;
|
|
1156
|
+
entity.mode = OperatingModes.Temp;
|
|
1157
|
+
entity.rootId = this.rootId;
|
|
1158
|
+
entity.size = selectedFile.size;
|
|
1159
|
+
entity.fileName = fileName;
|
|
1113
1160
|
if (this.haveExtensionProperty)
|
|
1114
|
-
|
|
1115
|
-
//docInfo.isLast = true;
|
|
1116
|
-
uploadInfo.docInfo = docInfo;
|
|
1117
|
-
// let info = uploadInfo;
|
|
1118
|
-
// this.requestArray.push(this.uploadService.uploadFile(uploadInfo));
|
|
1119
|
-
// this.requestBodyArray.push(info);
|
|
1120
|
-
//封装请求formdata
|
|
1161
|
+
entity.exPropertyName = this.defaultPropertyName;
|
|
1121
1162
|
/** @type {?} */
|
|
1122
1163
|
let formData = new FormData();
|
|
1123
|
-
formData.append('
|
|
1124
|
-
formData.append('
|
|
1125
|
-
formData.
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1164
|
+
formData.append('uploadEntity', JSON.stringify(entity));
|
|
1165
|
+
formData.append('file', selectedFile);
|
|
1166
|
+
this.uploadSingleFile(formData).subscribe((/**
|
|
1167
|
+
* @param {?} res
|
|
1168
|
+
* @return {?}
|
|
1169
|
+
*/
|
|
1170
|
+
res => {
|
|
1171
|
+
if (res != null) {
|
|
1172
|
+
this.files[this.files.indexOf(fileInfo)].uploadResult = false;
|
|
1173
|
+
this.files[this.files.indexOf(fileInfo)].isUploading = false;
|
|
1174
|
+
this.files[this.files.indexOf(fileInfo)].errorMessage = res.error.Message;
|
|
1175
|
+
}
|
|
1176
|
+
else {
|
|
1177
|
+
this.files[this.files.indexOf(fileInfo)].uploadResult = true;
|
|
1178
|
+
this.files[this.files.indexOf(fileInfo)].isUploading = false;
|
|
1179
|
+
this.uploadFileInfoList = this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1180
|
+
this.uploadedFileInfoList = this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1181
|
+
this.uploadedFileTotal++;
|
|
1182
|
+
}
|
|
1183
|
+
}));
|
|
1130
1184
|
}
|
|
1131
1185
|
/** @type {?} */
|
|
1132
1186
|
let index = -1;
|
|
@@ -1144,39 +1198,27 @@ class FileUploadComponent {
|
|
|
1144
1198
|
this.files.splice(index, 1);
|
|
1145
1199
|
this.uploadFileInfoList.splice(index, 1);
|
|
1146
1200
|
this.uploadedFileInfoList.splice(index, 1);
|
|
1147
|
-
this.uploadedFileTotal--;
|
|
1201
|
+
//this.uploadedFileTotal--;
|
|
1148
1202
|
}
|
|
1149
1203
|
}
|
|
1150
1204
|
/**
|
|
1151
|
-
* @param {?}
|
|
1152
|
-
* @param {?} fileInfo
|
|
1153
|
-
* @param {?} docInfo
|
|
1154
|
-
* @param {?} uploadFileInfo
|
|
1205
|
+
* @param {?} formdata
|
|
1155
1206
|
* @return {?}
|
|
1156
1207
|
*/
|
|
1157
|
-
|
|
1158
|
-
|
|
1208
|
+
uploadSingleFile(formdata) {
|
|
1209
|
+
/** @type {?} */
|
|
1210
|
+
let url = "/api/runtime/dfs/v1.0/formdoc/single";
|
|
1211
|
+
return this.httpclient.post(url, formdata).pipe(tap((/**
|
|
1159
1212
|
* @param {?} res
|
|
1160
1213
|
* @return {?}
|
|
1161
1214
|
*/
|
|
1162
|
-
res => {
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
this.uploadedChunk[docInfo.metadataId]++;
|
|
1170
|
-
this.files[this.files.indexOf(fileInfo)].uploadProcess = Number.parseInt((this.uploadedChunk[docInfo.metadataId] / this.fileTotalChunk[docInfo.metadataId] * 100).toFixed(0));
|
|
1171
|
-
if (this.uploadedChunk[docInfo.metadataId] == this.fileTotalChunk[docInfo.metadataId]) {
|
|
1172
|
-
this.files[this.files.indexOf(fileInfo)].uploadResult = true;
|
|
1173
|
-
this.files[this.files.indexOf(fileInfo)].isUploading = false;
|
|
1174
|
-
this.uploadFileInfoList = this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1175
|
-
this.uploadedFileInfoList = this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1176
|
-
this.uploadedFileTotal++;
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
}));
|
|
1215
|
+
res => { })), catchError((/**
|
|
1216
|
+
* @param {?} error
|
|
1217
|
+
* @return {?}
|
|
1218
|
+
*/
|
|
1219
|
+
(error) => {
|
|
1220
|
+
return of$1(error);
|
|
1221
|
+
})));
|
|
1180
1222
|
}
|
|
1181
1223
|
/**
|
|
1182
1224
|
* @param {?} formdata
|
|
@@ -1185,7 +1227,6 @@ class FileUploadComponent {
|
|
|
1185
1227
|
uploadSliceFile(formdata) {
|
|
1186
1228
|
/** @type {?} */
|
|
1187
1229
|
let url = "/api/runtime/dfs/v1.0/formdoc/slice";
|
|
1188
|
-
//url = "/api/runtime/dfs/v1.0/formdoc/list";
|
|
1189
1230
|
return this.httpclient.post(url, formdata).pipe(tap((/**
|
|
1190
1231
|
* @param {?} res
|
|
1191
1232
|
* @return {?}
|
|
@@ -1198,6 +1239,63 @@ class FileUploadComponent {
|
|
|
1198
1239
|
return of$1(error);
|
|
1199
1240
|
})));
|
|
1200
1241
|
}
|
|
1242
|
+
/**
|
|
1243
|
+
* @param {?} request
|
|
1244
|
+
* @return {?}
|
|
1245
|
+
*/
|
|
1246
|
+
initMultiUpload(request) {
|
|
1247
|
+
/** @type {?} */
|
|
1248
|
+
let url = "/api/runtime/dfs/v1.0/formdoc/multi/init";
|
|
1249
|
+
return this.httpclient.post(url, request).pipe(tap((/**
|
|
1250
|
+
* @param {?} res
|
|
1251
|
+
* @return {?}
|
|
1252
|
+
*/
|
|
1253
|
+
res => { })), catchError((/**
|
|
1254
|
+
* @param {?} error
|
|
1255
|
+
* @return {?}
|
|
1256
|
+
*/
|
|
1257
|
+
(error) => {
|
|
1258
|
+
return of$1(error);
|
|
1259
|
+
})));
|
|
1260
|
+
}
|
|
1261
|
+
/**
|
|
1262
|
+
* @param {?} formdata
|
|
1263
|
+
* @return {?}
|
|
1264
|
+
*/
|
|
1265
|
+
multiUpload(formdata) {
|
|
1266
|
+
/** @type {?} */
|
|
1267
|
+
let url = "/api/runtime/dfs/v1.0/formdoc/multi/upload";
|
|
1268
|
+
return this.httpclient.post(url, formdata).pipe(tap((/**
|
|
1269
|
+
* @param {?} res
|
|
1270
|
+
* @return {?}
|
|
1271
|
+
*/
|
|
1272
|
+
res => { })), catchError((/**
|
|
1273
|
+
* @param {?} error
|
|
1274
|
+
* @return {?}
|
|
1275
|
+
*/
|
|
1276
|
+
(error) => {
|
|
1277
|
+
return of$1(error);
|
|
1278
|
+
})));
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* @param {?} request
|
|
1282
|
+
* @return {?}
|
|
1283
|
+
*/
|
|
1284
|
+
completeMultiUpload(request) {
|
|
1285
|
+
/** @type {?} */
|
|
1286
|
+
let url = "/api/runtime/dfs/v1.0/formdoc/multi/complete";
|
|
1287
|
+
return this.httpclient.post(url, request).pipe(tap((/**
|
|
1288
|
+
* @param {?} res
|
|
1289
|
+
* @return {?}
|
|
1290
|
+
*/
|
|
1291
|
+
res => { })), catchError((/**
|
|
1292
|
+
* @param {?} error
|
|
1293
|
+
* @return {?}
|
|
1294
|
+
*/
|
|
1295
|
+
(error) => {
|
|
1296
|
+
return of$1(error);
|
|
1297
|
+
})));
|
|
1298
|
+
}
|
|
1201
1299
|
/**
|
|
1202
1300
|
* @return {?}
|
|
1203
1301
|
*/
|
|
@@ -1208,8 +1306,6 @@ class FileUploadComponent {
|
|
|
1208
1306
|
* @return {?}
|
|
1209
1307
|
*/
|
|
1210
1308
|
element => {
|
|
1211
|
-
// let obj: any = document.getElementById(element.name);
|
|
1212
|
-
// obj.checked = true;
|
|
1213
1309
|
element.selectd = true;
|
|
1214
1310
|
}));
|
|
1215
1311
|
this.fileAllSelected = true;
|
|
@@ -1221,8 +1317,6 @@ class FileUploadComponent {
|
|
|
1221
1317
|
* @return {?}
|
|
1222
1318
|
*/
|
|
1223
1319
|
element => {
|
|
1224
|
-
// let obj: any = document.getElementById(element.name);
|
|
1225
|
-
// obj.checked = false;
|
|
1226
1320
|
element.selectd = false;
|
|
1227
1321
|
}));
|
|
1228
1322
|
this.fileAllSelected = false;
|
|
@@ -1304,9 +1398,6 @@ class FileUploadComponent {
|
|
|
1304
1398
|
metadataList.push(element.id);
|
|
1305
1399
|
this.files.splice(this.files.indexOf(element), 1);
|
|
1306
1400
|
if (element.uploadResult) {
|
|
1307
|
-
// let idList: string[] = [];
|
|
1308
|
-
// idList.push(fileInfo.id);
|
|
1309
|
-
// this.uploadService.cancel(idList, this.rootId).subscribe();
|
|
1310
1401
|
this.uploadFileInfoList.splice(this.uploadFileInfoList.indexOf(this.uploadFileInfoList.filter((/**
|
|
1311
1402
|
* @param {?} x
|
|
1312
1403
|
* @return {?}
|
|
@@ -1406,16 +1497,28 @@ class FileUploadComponent {
|
|
|
1406
1497
|
}
|
|
1407
1498
|
fileInfo.source = imgUrl;
|
|
1408
1499
|
this.files.push(fileInfo);
|
|
1500
|
+
//因为异步处理的差异,补偿一次删除
|
|
1501
|
+
/** @type {?} */
|
|
1502
|
+
let index = -1;
|
|
1503
|
+
this.files.forEach((/**
|
|
1504
|
+
* @param {?} x
|
|
1505
|
+
* @return {?}
|
|
1506
|
+
*/
|
|
1507
|
+
x => {
|
|
1508
|
+
if (x.name == fileInfo.name) {
|
|
1509
|
+
if (index == -1)
|
|
1510
|
+
index = this.files.indexOf(x);
|
|
1511
|
+
}
|
|
1512
|
+
}));
|
|
1513
|
+
if (index != -1 && index != this.files.length - 1) {
|
|
1514
|
+
this.files.splice(index, 1);
|
|
1515
|
+
this.uploadFileInfoList.splice(index, 1);
|
|
1516
|
+
this.uploadedFileInfoList.splice(index, 1);
|
|
1517
|
+
}
|
|
1409
1518
|
});
|
|
1410
1519
|
}
|
|
1411
1520
|
}
|
|
1412
1521
|
}
|
|
1413
|
-
/**
|
|
1414
|
-
* @param {?} selectdFile
|
|
1415
|
-
* @return {?}
|
|
1416
|
-
*/
|
|
1417
|
-
getImageUrl(selectdFile) {
|
|
1418
|
-
}
|
|
1419
1522
|
/**
|
|
1420
1523
|
* @param {?} strList
|
|
1421
1524
|
* @return {?}
|
|
@@ -1493,9 +1596,6 @@ class FileUploadComponent {
|
|
|
1493
1596
|
* @return {?}
|
|
1494
1597
|
*/
|
|
1495
1598
|
x => x.isUploading || x.uploadResult)).length) {
|
|
1496
|
-
// this.notifyService.success(<NotifyOptions>{
|
|
1497
|
-
// msg: '保存成功!', timeout: 3000
|
|
1498
|
-
// });
|
|
1499
1599
|
this.msgService.warning(this.localepipe.transform('wait'));
|
|
1500
1600
|
return of$1(false);
|
|
1501
1601
|
}
|
|
@@ -1565,9 +1665,6 @@ class FileUploadComponent {
|
|
|
1565
1665
|
*/
|
|
1566
1666
|
x => x.metadataId == file.id)), 1);
|
|
1567
1667
|
}
|
|
1568
|
-
// var obj:any = document.querySelector('#file');
|
|
1569
|
-
// obj.files.remove();
|
|
1570
|
-
//obj.value='';
|
|
1571
1668
|
}
|
|
1572
1669
|
/**
|
|
1573
1670
|
* @param {?} size
|
|
@@ -1655,6 +1752,14 @@ class DownloadService {
|
|
|
1655
1752
|
getDownloadUrl(metadataId, rootId) {
|
|
1656
1753
|
return "/api/runtime/dfs/v1.0/doc/filecontent?metadataid=" + metadataId + "&rootid=" + rootId + "&token=" + this.getToken(this.mergeString(metadataId, rootId));
|
|
1657
1754
|
}
|
|
1755
|
+
/**
|
|
1756
|
+
* @param {?} metadataId
|
|
1757
|
+
* @param {?} rootId
|
|
1758
|
+
* @return {?}
|
|
1759
|
+
*/
|
|
1760
|
+
getStreamDownloadUrl(metadataId, rootId) {
|
|
1761
|
+
return "/api/runtime/dfs/v1.0/formdoc/stream?metadataid=" + metadataId + "&rootid=" + rootId + "&token=" + this.getToken(this.mergeString(metadataId, rootId));
|
|
1762
|
+
}
|
|
1658
1763
|
/**
|
|
1659
1764
|
* @param {?} metadataIdList
|
|
1660
1765
|
* @param {?} rootId
|
|
@@ -2078,6 +2183,13 @@ class UploadLimit {
|
|
|
2078
2183
|
class GspFormUploadListEntity {
|
|
2079
2184
|
}
|
|
2080
2185
|
|
|
2186
|
+
/**
|
|
2187
|
+
* @fileoverview added by tsickle
|
|
2188
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2189
|
+
*/
|
|
2190
|
+
class GspFormDocInfo {
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2081
2193
|
/**
|
|
2082
2194
|
* @fileoverview added by tsickle
|
|
2083
2195
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -2085,6 +2197,13 @@ class GspFormUploadListEntity {
|
|
|
2085
2197
|
class GspDocMetaProperty {
|
|
2086
2198
|
}
|
|
2087
2199
|
|
|
2200
|
+
/**
|
|
2201
|
+
* @fileoverview added by tsickle
|
|
2202
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2203
|
+
*/
|
|
2204
|
+
class GspFormUploadEntity {
|
|
2205
|
+
}
|
|
2206
|
+
|
|
2088
2207
|
/**
|
|
2089
2208
|
* @fileoverview added by tsickle
|
|
2090
2209
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|