@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
|
@@ -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;
|
|
@@ -939,12 +963,6 @@
|
|
|
939
963
|
return "continue";
|
|
940
964
|
}
|
|
941
965
|
}
|
|
942
|
-
// if (this.files.find(x => x.name == selectedFile.name) != null) {
|
|
943
|
-
// this.errFileList.push(selectedFile.name);
|
|
944
|
-
// continue;
|
|
945
|
-
// }
|
|
946
|
-
//this.flag += Math.ceil(selectedFile.size / this.bufferSize);
|
|
947
|
-
//let reader = new FileReader();
|
|
948
966
|
this_1.uploadFile(uuid, selectedFile, selectedFile.name);
|
|
949
967
|
};
|
|
950
968
|
var this_1 = this;
|
|
@@ -1074,47 +1092,51 @@
|
|
|
1074
1092
|
var nextSize = Math.min((chunkIndex + 1) * this_2.bufferSize, selectedFile.size);
|
|
1075
1093
|
/** @type {?} */
|
|
1076
1094
|
var fileData = selectedFile.slice(chunkIndex * this_2.bufferSize, nextSize);
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
reader.readAsBinaryString(fileData);
|
|
1095
|
+
// let reader = new FileReader();
|
|
1096
|
+
// reader.readAsBinaryString(fileData);
|
|
1080
1097
|
/** @type {?} */
|
|
1081
1098
|
var innerIndex = chunkIndex;
|
|
1082
|
-
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
|
|
1083
1120
|
* @return {?}
|
|
1084
|
-
*/function () {
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
_this.requestBodyArray.push(info);
|
|
1096
|
-
_this.uploadService.uploadFile(info).subscribe(( /**
|
|
1097
|
-
* @param {?} res
|
|
1098
|
-
* @return {?}
|
|
1099
|
-
*/function (res) {
|
|
1100
|
-
if (res != null) {
|
|
1101
|
-
_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;
|
|
1102
1132
|
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1103
|
-
_this.
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
_this.uploadedChunk[docInfo.metadataId]++;
|
|
1107
|
-
_this.files[_this.files.indexOf(fileInfo)].uploadProcess = Number.parseInt((_this.uploadedChunk[docInfo.metadataId] / _this.fileTotalChunk[docInfo.metadataId] * 100).toFixed(0));
|
|
1108
|
-
if (_this.uploadedChunk[docInfo.metadataId] == _this.fileTotalChunk[docInfo.metadataId]) {
|
|
1109
|
-
_this.files[_this.files.indexOf(fileInfo)].uploadResult = true;
|
|
1110
|
-
_this.files[_this.files.indexOf(fileInfo)].isUploading = false;
|
|
1111
|
-
_this.uploadFileInfoList = _this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1112
|
-
_this.uploadedFileInfoList = _this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1113
|
-
_this.uploadedFileTotal++;
|
|
1114
|
-
}
|
|
1133
|
+
_this.uploadFileInfoList = _this.uploadFileInfoList.concat(uploadFileInfo);
|
|
1134
|
+
_this.uploadedFileInfoList = _this.uploadedFileInfoList.concat(uploadFileInfo);
|
|
1135
|
+
_this.uploadedFileTotal++;
|
|
1115
1136
|
}
|
|
1116
|
-
}
|
|
1117
|
-
});
|
|
1137
|
+
}
|
|
1138
|
+
}));
|
|
1139
|
+
// }
|
|
1118
1140
|
//console.log(chunkIndex + 1);
|
|
1119
1141
|
chunkIndex = chunkIndex + 1;
|
|
1120
1142
|
};
|