@gsp-svc/formdoc-upload 0.1.34 → 0.1.36
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 +71 -47
- 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/upload/entity/gspformdocinfo.js +3 -1
- package/esm2015/lib/upload/file-upload/file-upload.component.js +46 -47
- package/esm2015/lib/upload/upload.service.js +32 -3
- package/esm5/lib/upload/entity/gspformdocinfo.js +3 -1
- package/esm5/lib/upload/file-upload/file-upload.component.js +46 -47
- package/esm5/lib/upload/upload.service.js +35 -3
- package/fesm2015/gsp-svc-formdoc-upload.js +72 -50
- package/fesm2015/gsp-svc-formdoc-upload.js.map +1 -1
- package/fesm5/gsp-svc-formdoc-upload.js +75 -50
- package/fesm5/gsp-svc-formdoc-upload.js.map +1 -1
- package/gsp-svc-formdoc-upload.metadata.json +1 -1
- package/lib/upload/entity/gspformdocinfo.d.ts +1 -0
- package/lib/upload/upload.service.d.ts +4 -2
- package/package.json +1 -1
|
@@ -11,10 +11,10 @@ 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 { LanguageService, HttpService } from '@ecp-caf/caf-common';
|
|
14
|
-
import { Injectable, Pipe, Inject, LOCALE_ID, Component,
|
|
14
|
+
import { Injectable, Pipe, Inject, LOCALE_ID, Component, ViewChild, Input, NgModule, Injector, ComponentFactoryResolver, defineInjectable } from '@angular/core';
|
|
15
15
|
import { BsModalService } from '@farris/ui-modal';
|
|
16
16
|
import { of as of$1 } from 'rxjs';
|
|
17
|
-
import { HttpClientModule } from '@angular/common/http';
|
|
17
|
+
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
|
18
18
|
import { NotifyModule } from '@farris/ui-notify';
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -144,9 +144,11 @@ class ChangeInstanceRequest {
|
|
|
144
144
|
class UploadService {
|
|
145
145
|
/**
|
|
146
146
|
* @param {?} http
|
|
147
|
+
* @param {?} httpclient
|
|
147
148
|
*/
|
|
148
|
-
constructor(http) {
|
|
149
|
+
constructor(http, httpclient) {
|
|
149
150
|
this.http = http;
|
|
151
|
+
this.httpclient = httpclient;
|
|
150
152
|
}
|
|
151
153
|
/**
|
|
152
154
|
* @param {?} docListInfo
|
|
@@ -265,6 +267,26 @@ class UploadService {
|
|
|
265
267
|
return of(error);
|
|
266
268
|
})));
|
|
267
269
|
}
|
|
270
|
+
/**
|
|
271
|
+
* @param {?} formdata
|
|
272
|
+
* @return {?}
|
|
273
|
+
*/
|
|
274
|
+
uploadSliceFile(formdata) {
|
|
275
|
+
/** @type {?} */
|
|
276
|
+
let url = "/api/runtime/dfs/v1.0/formdoc/slice";
|
|
277
|
+
//url = "/api/runtime/dfs/v1.0/formdoc/list";
|
|
278
|
+
return this.httpclient.post(url, formdata).pipe(tap((/**
|
|
279
|
+
* @param {?} res
|
|
280
|
+
* @return {?}
|
|
281
|
+
*/
|
|
282
|
+
res => { })), catchError((/**
|
|
283
|
+
* @param {?} error
|
|
284
|
+
* @return {?}
|
|
285
|
+
*/
|
|
286
|
+
(error) => {
|
|
287
|
+
return of(error);
|
|
288
|
+
})));
|
|
289
|
+
}
|
|
268
290
|
/**
|
|
269
291
|
* @return {?}
|
|
270
292
|
*/
|
|
@@ -424,7 +446,8 @@ UploadService.decorators = [
|
|
|
424
446
|
];
|
|
425
447
|
/** @nocollapse */
|
|
426
448
|
UploadService.ctorParameters = () => [
|
|
427
|
-
{ type: HttpService }
|
|
449
|
+
{ type: HttpService },
|
|
450
|
+
{ type: HttpClient }
|
|
428
451
|
];
|
|
429
452
|
|
|
430
453
|
/**
|
|
@@ -804,9 +827,11 @@ class FileUploadComponent {
|
|
|
804
827
|
this.nullFileList.push(selectedFile.name);
|
|
805
828
|
continue;
|
|
806
829
|
}
|
|
807
|
-
if (
|
|
808
|
-
|
|
809
|
-
|
|
830
|
+
if (this.maxFileSize != null && this.maxFileSize > 0) {
|
|
831
|
+
if (selectedFile.size > this.maxFileSize * 1000) {
|
|
832
|
+
this.beyondFileList.push(selectedFile.name);
|
|
833
|
+
continue;
|
|
834
|
+
}
|
|
810
835
|
}
|
|
811
836
|
if (!this.sameNameAllowed) {
|
|
812
837
|
if (this.uploadedFileInfoList.find((/**
|
|
@@ -899,12 +924,6 @@ class FileUploadComponent {
|
|
|
899
924
|
continue;
|
|
900
925
|
}
|
|
901
926
|
}
|
|
902
|
-
// if (this.files.find(x => x.name == selectedFile.name) != null) {
|
|
903
|
-
// this.errFileList.push(selectedFile.name);
|
|
904
|
-
// continue;
|
|
905
|
-
// }
|
|
906
|
-
//this.flag += Math.ceil(selectedFile.size / this.bufferSize);
|
|
907
|
-
//let reader = new FileReader();
|
|
908
927
|
this.uploadFile(uuid, selectedFile, selectedFile.name);
|
|
909
928
|
}
|
|
910
929
|
// if (this.uploadedNameList.length > 0) {
|
|
@@ -1014,49 +1033,52 @@ class FileUploadComponent {
|
|
|
1014
1033
|
let nextSize = Math.min((chunkIndex + 1) * this.bufferSize, selectedFile.size);
|
|
1015
1034
|
/** @type {?} */
|
|
1016
1035
|
let fileData = selectedFile.slice(chunkIndex * this.bufferSize, nextSize);
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
reader.readAsBinaryString(fileData);
|
|
1036
|
+
// let reader = new FileReader();
|
|
1037
|
+
// reader.readAsBinaryString(fileData);
|
|
1020
1038
|
/** @type {?} */
|
|
1021
1039
|
let innerIndex = chunkIndex;
|
|
1022
|
-
reader.onload = (
|
|
1040
|
+
// reader.onload = () => {
|
|
1041
|
+
// docInfo.fileContent = btoa(reader.result.toString());
|
|
1042
|
+
docInfo.size = selectedFile.size;
|
|
1043
|
+
docInfo.index = innerIndex;
|
|
1044
|
+
docInfo.fileContent = "";
|
|
1045
|
+
//chunkIndex++;
|
|
1046
|
+
if (this.haveExtensionProperty)
|
|
1047
|
+
docInfo.exPropertyName = this.defaultPropertyName;
|
|
1048
|
+
//docInfo.isLast = true;
|
|
1049
|
+
uploadInfo.docInfo = docInfo;
|
|
1050
|
+
// let info = uploadInfo;
|
|
1051
|
+
// this.requestArray.push(this.uploadService.uploadFile(uploadInfo));
|
|
1052
|
+
// this.requestBodyArray.push(info);
|
|
1053
|
+
//封装请求formdata
|
|
1054
|
+
/** @type {?} */
|
|
1055
|
+
let formData = new FormData();
|
|
1056
|
+
formData.append('uploadInfo', JSON.stringify(uploadInfo));
|
|
1057
|
+
formData.append('docInfo', JSON.stringify(docInfo));
|
|
1058
|
+
formData.append('file', fileData);
|
|
1059
|
+
this.uploadService.uploadSliceFile(formData).subscribe((/**
|
|
1060
|
+
* @param {?} res
|
|
1023
1061
|
* @return {?}
|
|
1024
1062
|
*/
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
this.requestBodyArray.push(info);
|
|
1037
|
-
this.uploadService.uploadFile(info).subscribe((/**
|
|
1038
|
-
* @param {?} res
|
|
1039
|
-
* @return {?}
|
|
1040
|
-
*/
|
|
1041
|
-
res => {
|
|
1042
|
-
if (res != null) {
|
|
1043
|
-
this.files[this.files.indexOf(fileInfo)].uploadResult = false;
|
|
1063
|
+
res => {
|
|
1064
|
+
if (res != null) {
|
|
1065
|
+
this.files[this.files.indexOf(fileInfo)].uploadResult = false;
|
|
1066
|
+
this.files[this.files.indexOf(fileInfo)].isUploading = false;
|
|
1067
|
+
this.files[this.files.indexOf(fileInfo)].errorMessage = res.error.Message;
|
|
1068
|
+
}
|
|
1069
|
+
else {
|
|
1070
|
+
this.uploadedChunk[docInfo.metadataId]++;
|
|
1071
|
+
this.files[this.files.indexOf(fileInfo)].uploadProcess = Number.parseInt((this.uploadedChunk[docInfo.metadataId] / this.fileTotalChunk[docInfo.metadataId] * 100).toFixed(0));
|
|
1072
|
+
if (this.uploadedChunk[docInfo.metadataId] == this.fileTotalChunk[docInfo.metadataId]) {
|
|
1073
|
+
this.files[this.files.indexOf(fileInfo)].uploadResult = true;
|
|
1044
1074
|
this.files[this.files.indexOf(fileInfo)].isUploading = false;
|
|
1045
|
-
this.
|
|
1075
|
+
this.uploadFileInfoList = this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1076
|
+
this.uploadedFileInfoList = this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1077
|
+
this.uploadedFileTotal++;
|
|
1046
1078
|
}
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
if (this.uploadedChunk[docInfo.metadataId] == this.fileTotalChunk[docInfo.metadataId]) {
|
|
1051
|
-
this.files[this.files.indexOf(fileInfo)].uploadResult = true;
|
|
1052
|
-
this.files[this.files.indexOf(fileInfo)].isUploading = false;
|
|
1053
|
-
this.uploadFileInfoList = this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1054
|
-
this.uploadedFileInfoList = this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1055
|
-
this.uploadedFileTotal++;
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
}));
|
|
1059
|
-
});
|
|
1079
|
+
}
|
|
1080
|
+
}));
|
|
1081
|
+
// }
|
|
1060
1082
|
//console.log(chunkIndex + 1);
|
|
1061
1083
|
chunkIndex = chunkIndex + 1;
|
|
1062
1084
|
}
|