@gsp-svc/formdoc-upload 0.1.35 → 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 +66 -44
- 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 +41 -44
- 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 +41 -44
- package/esm5/lib/upload/upload.service.js +35 -3
- package/fesm2015/gsp-svc-formdoc-upload.js +67 -47
- package/fesm2015/gsp-svc-formdoc-upload.js.map +1 -1
- package/fesm5/gsp-svc-formdoc-upload.js +70 -47
- 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,
|
|
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
|
/**
|
|
@@ -901,12 +924,6 @@ class FileUploadComponent {
|
|
|
901
924
|
continue;
|
|
902
925
|
}
|
|
903
926
|
}
|
|
904
|
-
// if (this.files.find(x => x.name == selectedFile.name) != null) {
|
|
905
|
-
// this.errFileList.push(selectedFile.name);
|
|
906
|
-
// continue;
|
|
907
|
-
// }
|
|
908
|
-
//this.flag += Math.ceil(selectedFile.size / this.bufferSize);
|
|
909
|
-
//let reader = new FileReader();
|
|
910
927
|
this.uploadFile(uuid, selectedFile, selectedFile.name);
|
|
911
928
|
}
|
|
912
929
|
// if (this.uploadedNameList.length > 0) {
|
|
@@ -1016,49 +1033,52 @@ class FileUploadComponent {
|
|
|
1016
1033
|
let nextSize = Math.min((chunkIndex + 1) * this.bufferSize, selectedFile.size);
|
|
1017
1034
|
/** @type {?} */
|
|
1018
1035
|
let fileData = selectedFile.slice(chunkIndex * this.bufferSize, nextSize);
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
reader.readAsBinaryString(fileData);
|
|
1036
|
+
// let reader = new FileReader();
|
|
1037
|
+
// reader.readAsBinaryString(fileData);
|
|
1022
1038
|
/** @type {?} */
|
|
1023
1039
|
let innerIndex = chunkIndex;
|
|
1024
|
-
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
|
|
1025
1061
|
* @return {?}
|
|
1026
1062
|
*/
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
this.requestBodyArray.push(info);
|
|
1039
|
-
this.uploadService.uploadFile(info).subscribe((/**
|
|
1040
|
-
* @param {?} res
|
|
1041
|
-
* @return {?}
|
|
1042
|
-
*/
|
|
1043
|
-
res => {
|
|
1044
|
-
if (res != null) {
|
|
1045
|
-
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;
|
|
1046
1074
|
this.files[this.files.indexOf(fileInfo)].isUploading = false;
|
|
1047
|
-
this.
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
this.uploadedChunk[docInfo.metadataId]++;
|
|
1051
|
-
this.files[this.files.indexOf(fileInfo)].uploadProcess = Number.parseInt((this.uploadedChunk[docInfo.metadataId] / this.fileTotalChunk[docInfo.metadataId] * 100).toFixed(0));
|
|
1052
|
-
if (this.uploadedChunk[docInfo.metadataId] == this.fileTotalChunk[docInfo.metadataId]) {
|
|
1053
|
-
this.files[this.files.indexOf(fileInfo)].uploadResult = true;
|
|
1054
|
-
this.files[this.files.indexOf(fileInfo)].isUploading = false;
|
|
1055
|
-
this.uploadFileInfoList = this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1056
|
-
this.uploadedFileInfoList = this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1057
|
-
this.uploadedFileTotal++;
|
|
1058
|
-
}
|
|
1075
|
+
this.uploadFileInfoList = this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1076
|
+
this.uploadedFileInfoList = this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1077
|
+
this.uploadedFileTotal++;
|
|
1059
1078
|
}
|
|
1060
|
-
}
|
|
1061
|
-
});
|
|
1079
|
+
}
|
|
1080
|
+
}));
|
|
1081
|
+
// }
|
|
1062
1082
|
//console.log(chunkIndex + 1);
|
|
1063
1083
|
chunkIndex = chunkIndex + 1;
|
|
1064
1084
|
}
|