@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
|
@@ -147,8 +147,9 @@
|
|
|
147
147
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
148
148
|
*/
|
|
149
149
|
var UploadService = /** @class */ (function () {
|
|
150
|
-
function UploadService(http$$1) {
|
|
150
|
+
function UploadService(http$$1, httpclient) {
|
|
151
151
|
this.http = http$$1;
|
|
152
|
+
this.httpclient = httpclient;
|
|
152
153
|
}
|
|
153
154
|
/**
|
|
154
155
|
* @param {?} docListInfo
|
|
@@ -290,6 +291,28 @@
|
|
|
290
291
|
return of.of(error);
|
|
291
292
|
})));
|
|
292
293
|
};
|
|
294
|
+
/**
|
|
295
|
+
* @param {?} formdata
|
|
296
|
+
* @return {?}
|
|
297
|
+
*/
|
|
298
|
+
UploadService.prototype.uploadSliceFile = /**
|
|
299
|
+
* @param {?} formdata
|
|
300
|
+
* @return {?}
|
|
301
|
+
*/
|
|
302
|
+
function (formdata) {
|
|
303
|
+
/** @type {?} */
|
|
304
|
+
var url = "/api/runtime/dfs/v1.0/formdoc/slice";
|
|
305
|
+
//url = "/api/runtime/dfs/v1.0/formdoc/list";
|
|
306
|
+
return this.httpclient.post(url, formdata).pipe(operators.tap(( /**
|
|
307
|
+
* @param {?} res
|
|
308
|
+
* @return {?}
|
|
309
|
+
*/function (res) { })), operators.catchError(( /**
|
|
310
|
+
* @param {?} error
|
|
311
|
+
* @return {?}
|
|
312
|
+
*/function (error) {
|
|
313
|
+
return of.of(error);
|
|
314
|
+
})));
|
|
315
|
+
};
|
|
293
316
|
/**
|
|
294
317
|
* @return {?}
|
|
295
318
|
*/
|
|
@@ -464,7 +487,8 @@
|
|
|
464
487
|
/** @nocollapse */
|
|
465
488
|
UploadService.ctorParameters = function () {
|
|
466
489
|
return [
|
|
467
|
-
{ type: cafCommon.HttpService }
|
|
490
|
+
{ type: cafCommon.HttpService },
|
|
491
|
+
{ type: http.HttpClient }
|
|
468
492
|
];
|
|
469
493
|
};
|
|
470
494
|
return UploadService;
|
|
@@ -850,9 +874,11 @@
|
|
|
850
874
|
this_1.nullFileList.push(selectedFile.name);
|
|
851
875
|
return "continue";
|
|
852
876
|
}
|
|
853
|
-
if (
|
|
854
|
-
|
|
855
|
-
|
|
877
|
+
if (this_1.maxFileSize != null && this_1.maxFileSize > 0) {
|
|
878
|
+
if (selectedFile.size > this_1.maxFileSize * 1000) {
|
|
879
|
+
this_1.beyondFileList.push(selectedFile.name);
|
|
880
|
+
return "continue";
|
|
881
|
+
}
|
|
856
882
|
}
|
|
857
883
|
if (!this_1.sameNameAllowed) {
|
|
858
884
|
if (this_1.uploadedFileInfoList.find(( /**
|
|
@@ -937,12 +963,6 @@
|
|
|
937
963
|
return "continue";
|
|
938
964
|
}
|
|
939
965
|
}
|
|
940
|
-
// if (this.files.find(x => x.name == selectedFile.name) != null) {
|
|
941
|
-
// this.errFileList.push(selectedFile.name);
|
|
942
|
-
// continue;
|
|
943
|
-
// }
|
|
944
|
-
//this.flag += Math.ceil(selectedFile.size / this.bufferSize);
|
|
945
|
-
//let reader = new FileReader();
|
|
946
966
|
this_1.uploadFile(uuid, selectedFile, selectedFile.name);
|
|
947
967
|
};
|
|
948
968
|
var this_1 = this;
|
|
@@ -1072,47 +1092,51 @@
|
|
|
1072
1092
|
var nextSize = Math.min((chunkIndex + 1) * this_2.bufferSize, selectedFile.size);
|
|
1073
1093
|
/** @type {?} */
|
|
1074
1094
|
var fileData = selectedFile.slice(chunkIndex * this_2.bufferSize, nextSize);
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
reader.readAsBinaryString(fileData);
|
|
1095
|
+
// let reader = new FileReader();
|
|
1096
|
+
// reader.readAsBinaryString(fileData);
|
|
1078
1097
|
/** @type {?} */
|
|
1079
1098
|
var innerIndex = chunkIndex;
|
|
1080
|
-
reader.onload = (
|
|
1099
|
+
// reader.onload = () => {
|
|
1100
|
+
// docInfo.fileContent = btoa(reader.result.toString());
|
|
1101
|
+
docInfo.size = selectedFile.size;
|
|
1102
|
+
docInfo.index = innerIndex;
|
|
1103
|
+
docInfo.fileContent = "";
|
|
1104
|
+
//chunkIndex++;
|
|
1105
|
+
if (this_2.haveExtensionProperty)
|
|
1106
|
+
docInfo.exPropertyName = this_2.defaultPropertyName;
|
|
1107
|
+
//docInfo.isLast = true;
|
|
1108
|
+
uploadInfo.docInfo = docInfo;
|
|
1109
|
+
// let info = uploadInfo;
|
|
1110
|
+
// this.requestArray.push(this.uploadService.uploadFile(uploadInfo));
|
|
1111
|
+
// this.requestBodyArray.push(info);
|
|
1112
|
+
//封装请求formdata
|
|
1113
|
+
/** @type {?} */
|
|
1114
|
+
var formData = new FormData();
|
|
1115
|
+
formData.append('uploadInfo', JSON.stringify(uploadInfo));
|
|
1116
|
+
formData.append('docInfo', JSON.stringify(docInfo));
|
|
1117
|
+
formData.append('file', fileData);
|
|
1118
|
+
this_2.uploadService.uploadSliceFile(formData).subscribe(( /**
|
|
1119
|
+
* @param {?} res
|
|
1081
1120
|
* @return {?}
|
|
1082
|
-
*/function () {
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
_this.requestBodyArray.push(info);
|
|
1094
|
-
_this.uploadService.uploadFile(info).subscribe(( /**
|
|
1095
|
-
* @param {?} res
|
|
1096
|
-
* @return {?}
|
|
1097
|
-
*/function (res) {
|
|
1098
|
-
if (res != null) {
|
|
1099
|
-
_this.files[_this.files.indexOf(fileInfo)].uploadResult = false;
|
|
1121
|
+
*/function (res) {
|
|
1122
|
+
if (res != null) {
|
|
1123
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadResult = false;
|
|
1124
|
+
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1125
|
+
_this.files[_this.files.indexOf(fileInfo)].errorMessage = res.error.Message;
|
|
1126
|
+
}
|
|
1127
|
+
else {
|
|
1128
|
+
_this.uploadedChunk[docInfo.metadataId]++;
|
|
1129
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadProcess = Number.parseInt((_this.uploadedChunk[docInfo.metadataId] / _this.fileTotalChunk[docInfo.metadataId] * 100).toFixed(0));
|
|
1130
|
+
if (_this.uploadedChunk[docInfo.metadataId] == _this.fileTotalChunk[docInfo.metadataId]) {
|
|
1131
|
+
_this.files[_this.files.indexOf(fileInfo)].uploadResult = true;
|
|
1100
1132
|
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1101
|
-
_this.
|
|
1133
|
+
_this.uploadFileInfoList = _this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1134
|
+
_this.uploadedFileInfoList = _this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1135
|
+
_this.uploadedFileTotal++;
|
|
1102
1136
|
}
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
if (_this.uploadedChunk[docInfo.metadataId] == _this.fileTotalChunk[docInfo.metadataId]) {
|
|
1107
|
-
_this.files[_this.files.indexOf(fileInfo)].uploadResult = true;
|
|
1108
|
-
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1109
|
-
_this.uploadFileInfoList = _this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1110
|
-
_this.uploadedFileInfoList = _this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1111
|
-
_this.uploadedFileTotal++;
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
}));
|
|
1115
|
-
});
|
|
1137
|
+
}
|
|
1138
|
+
}));
|
|
1139
|
+
// }
|
|
1116
1140
|
//console.log(chunkIndex + 1);
|
|
1117
1141
|
chunkIndex = chunkIndex + 1;
|
|
1118
1142
|
};
|