tnx-shared 5.3.192 → 5.3.194
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/tnx-shared.umd.js +309 -702
- package/bundles/tnx-shared.umd.js.map +1 -1
- package/bundles/tnx-shared.umd.min.js +1 -1
- package/bundles/tnx-shared.umd.min.js.map +1 -1
- package/classes/form-schema.d.ts +1 -0
- package/classes/form-schema.d.ts.map +1 -1
- package/components/file-upload/file-upload.component.d.ts.map +1 -1
- package/esm2015/classes/form-schema.js +2 -1
- package/esm2015/components/dropdown/dropdown.component.js +2 -2
- package/esm2015/components/file-upload/file-upload.component.js +2 -2
- package/esm2015/models/file-type.js +2 -2
- package/esm2015/public-api.js +2 -2
- package/esm2015/tnx-shared.module.js +3 -3
- package/fesm2015/tnx-shared.js +234 -572
- package/fesm2015/tnx-shared.js.map +1 -1
- package/models/file-type.d.ts +1 -1
- package/models/file-type.d.ts.map +1 -1
- package/package.json +2 -2
- package/public-api.d.ts +0 -1
- package/public-api.d.ts.map +1 -1
- package/tnx-shared.metadata.json +1 -1
- package/tnx-shared.module.d.ts +1 -2
- package/tnx-shared.module.d.ts.map +1 -1
- package/tnx-shared.module.ngfactory.d.ts.map +1 -1
- package/components/report-queue/base-job/job-item.d.ts +0 -44
- package/components/report-queue/base-job/job-item.d.ts.map +0 -1
- package/components/report-queue/report-queue.component.d.ts +0 -67
- package/components/report-queue/report-queue.component.d.ts.map +0 -1
- package/components/report-queue/report-queue.component.ngfactory.d.ts.map +0 -1
- package/components/report-queue/report-queue.component.scss.shim.ngstyle.d.ts.map +0 -1
- package/esm2015/components/report-queue/base-job/job-item.js +0 -54
- package/esm2015/components/report-queue/report-queue.component.js +0 -301
|
@@ -789,7 +789,7 @@
|
|
|
789
789
|
(function (FileExtensions) {
|
|
790
790
|
FileExtensions["VIDEO"] = ".MP4,.MOV,.AVI,.FLV,.WMV";
|
|
791
791
|
FileExtensions["IMAGE"] = ".JPG,.JPEG,.PNG,.TIF,.GIF";
|
|
792
|
-
FileExtensions["DOC"] = ".DOC,.DOCX,.PDF,.XLS,.XLSX,.TXT,.CSV,.XML,.HTML";
|
|
792
|
+
FileExtensions["DOC"] = ".DOC,.DOCX,.PDF,.XLS,.XLSX,.TXT,.CSV,.XML,.HTML,.PPTX,.PPTM,.PPT";
|
|
793
793
|
FileExtensions["AUDIO"] = ".MP3,.WAV,.M4A";
|
|
794
794
|
FileExtensions["COMPRESSED"] = ".ZIP,.SITX,.RAR,.7Z,.GZ,.TAR";
|
|
795
795
|
})(exports.FileExtensions || (exports.FileExtensions = {}));
|
|
@@ -2028,6 +2028,7 @@
|
|
|
2028
2028
|
_this.selectedItemsLabel = 'Đã chọn {0} mục';
|
|
2029
2029
|
_this.selectedAllItemLabel = 'Đã chọn tất cả';
|
|
2030
2030
|
_this.filterPlaceholder = 'Nhập tìm kiếm';
|
|
2031
|
+
_this.serverLoadMessage = 'Dữ liệu sẽ được làm mới khi tìm kiếm';
|
|
2031
2032
|
_this.showClear = true;
|
|
2032
2033
|
_this.filter = true;
|
|
2033
2034
|
_this.multiple = false;
|
|
@@ -33116,7 +33117,7 @@
|
|
|
33116
33117
|
DropdownComponent.decorators = [
|
|
33117
33118
|
{ type: i0.Component, args: [{
|
|
33118
33119
|
selector: 'dropdown',
|
|
33119
|
-
template: "<div #el class=\"tn-dropdown\" [pTooltip]=\"tooltip\" tooltipPosition=\"top\" tooltipStyleClass=\"wrap\"\n [class.server-load]=\"control.isServerLoad\">\n <span class=\"server-load-info\" pTooltip=\"
|
|
33120
|
+
template: "<div #el class=\"tn-dropdown\" [pTooltip]=\"tooltip\" tooltipPosition=\"top\" tooltipStyleClass=\"wrap\"\n [class.server-load]=\"control.isServerLoad\">\n <span class=\"server-load-info\" [pTooltip]=\"control.serverLoadMessage\" tooltipPosition=\"top\"></span>\n <p-dropdown *ngIf=\"!control.multiple\" optionDisabled=\"inactive\" [options]=\"dataSourceInternal\"\n [filterPlaceholder]=\"!control.isServerLoad ? control.filterPlaceholder : ''\" [placeholder]=\"control.placeholder\"\n [filter]=\"control.filter\" [panelStyleClass]=\"getPanelClass()\" [appendTo]=\"control.appendTo\"\n [styleClass]=\"'tn-dropdown'\" [emptyFilterMessage]=\"'Kh\u00F4ng t\u00ECm th\u1EA5y k\u1EBFt qu\u1EA3' | translate\"\n [disabled]=\"checkDisabled(control)\" [autoZIndex]=\"true\" [showClear]=\"control.showClear\"\n [showTransitionOptions]=\"showTransitionOptions\" [autoDisplayFirst]=\"control.autoDisplayFirst\"\n [virtualScroll]=\"control.virtualScroll\" itemSize=\"30\" [maxItemDisplay]=\"control.maxItemDisplay\"\n [autofocusSelectedItem]=\"autofocusSelectedItem\" [hideTransitionOptions]=\"hideTransitionOptions\"\n [modifyOptionsWhenFilter]=\"modifyOptionWhenFilter\" [delayFilter]=\"delayFilter\" [(ngModel)]=\"_value\"\n (onFocus)=\"handleFocus($event)\" (onBlur)=\"handleBlur($event)\" (onChange)=\"onChangeSelected($event)\"\n (onClick)=\"onDropdownClickHandler($event)\" (onShow)=\"onShowHandler($event)\" (onHide)=\"onHideHandler($event)\">\n <ng-template *ngIf=\"control.templateSelectedItem\" let-item pTemplate=\"selectedItem\">\n <ng-container\n *ngTemplateOutlet=\"control.templateSelectedItem; context: {$implicit: item, selectedValue: _value}\">\n </ng-container>\n </ng-template>\n <ng-template *ngIf=\"control.templateItem\" let-item pTemplate=\"item\">\n <ng-container *ngTemplateOutlet=\"control.templateItem; context: {$implicit: item}\"></ng-container>\n </ng-template>\n </p-dropdown>\n <p-multiSelect *ngIf=\"control.multiple\" optionDisabled=\"inactive\" [options]=\"dataSourceInternal\"\n [filter]=\"control.filter\" [defaultLabel]=\"control.placeholder\" [placeholder]=\"control.placeholder\"\n [filterPlaceHolder]=\"!control.isServerLoad ? control.filterPlaceholder : ''\" [panelStyleClass]=\"getPanelClass()\"\n [appendTo]=\"control.appendTo\" [styleClass]=\"'tn-dropdown'\"\n [emptyFilterMessage]=\"'Kh\u00F4ng t\u00ECm th\u1EA5y k\u1EBFt qu\u1EA3' | translate\" [disabled]=\"checkDisabled(control)\"\n [autoZIndex]=\"true\" [showTransitionOptions]=\"showTransitionOptions\"\n [hideTransitionOptions]=\"hideTransitionOptions\" [virtualScroll]=\"control.virtualScroll\"\n [maxItemDisplay]=\"control.maxItemDisplay\" [selectedItemsLabel]=\"control.selectedItemsLabel\"\n [maxSelectedLabels]=\"control.maxSelectedLabels\" [modifyOptionsWhenFilter]=\"modifyOptionWhenFilterMultiple\"\n [delayFilter]=\"delayFilter\" [(ngModel)]=\"_value\" (onChange)=\"onChangeSelected($event)\"\n (onClick)=\"onDropdownClickHandler($event)\" (onPanelShow)=\"onPanelShowHandler($event)\"\n (onPanelHide)=\"onHideHandler($event)\">\n <ng-template pTemplate=\"selectedItems\" let-value>\n <ng-container *ngIf=\"!value || value.length == 0\">{{control.placeholder}}</ng-container>\n <ng-container *ngIf=\"value && value.length > 0\">\n <span *ngFor=\"let selectedItem of value\" [class]=\"_itemSelectedStyleClass\">\n {{getItemSelectedLabel(selectedItem)}}<span class=\"remove-item\"\n (click)=\"removeItem($event, selectedItem)\"><i class=\"fas fa-times\"></i></span>\n </span>\n </ng-container>\n </ng-template>\n </p-multiSelect>\n <input #inputMask class=\"input-mask hide p-inputtext\" type=\"text\" [disabled]=\"loading\"\n [(ngModel)]=\"valueSearchServer\" (keyup)=\"keyUp.next($event)\" />\n <span #buttonSetting class=\"button-setting hide pi pi-cog\" (click)=\"showFormSetting()\"></span>\n <after-view-checked *ngIf=\"!loading\" (loaded)=\"handleLoaded()\"></after-view-checked>\n <button *ngIf=\"control.quickAdd && (control.cols || control.quickAddTemplate)\" type=\"button\" pButton\n icon=\"pi pi-plus\" class=\"p-button-text p-button-rounded button-quick-add\" pTooltip=\"Th\u00EAm nhanh\"\n tooltipPosition=\"top\" (click)=\"showFormQuickAdd()\"></button>\n</div>\n<tn-dialog *ngIf=\"quickAddDialogModel.showEditForm\" #dialog [header]=\"quickAddDialogModel.header | translate\"\n [popupSize]=\"control.popupSize\" (onHide)=\"quickAddDialogModel.showEditForm = false\">\n <quick-add-form *ngIf=\"control.cols\" #formBase [parentModel]=\"model\" [parentContext]=\"context\"\n [model]=\"quickAddDialogModel.data.formModel\" [control]=\"control\" [baseService]=\"control.baseService\"\n (onSaved)=\"handleSaved()\" (onCancel)=\"handleCancel()\">\n </quick-add-form>\n</tn-dialog>\n<tn-dialog *ngIf=\"settingDialogModel.showEditForm\" #dialog [header]=\"settingDialogModel.header | translate\"\n [popupSize]=\"control.popupSize\" (onHide)=\"settingDialogModel.showEditForm = false\">\n <dropdown-setting-form #formBase [model]=\"settingDialogModel.data.formModel\" (onSaved)=\"handleSavedSetting()\"\n (onCancel)=\"settingDialogModel.showEditForm = false\">\n </dropdown-setting-form>\n</tn-dialog>\n<ng-container *ngTemplateOutlet=\"control.quickAddTemplate; context: {\n handleSaved: handleSaved,\n handleCancel: handleCancel,\n dialogModel: quickAddDialogModel\n}\"></ng-container>",
|
|
33120
33121
|
providers: [ComponentContextService],
|
|
33121
33122
|
styles: [".tn-dropdown{display:flex}.tn-dropdown p-dropdown,.tn-dropdown p-multiSelect{flex:1 1;width:100%}.tn-dropdown>.button-quick-add{flex:0 0 auto}.tn-dropdown .server-load-info{display:none}.tn-dropdown.server-load{position:relative}.tn-dropdown.server-load .server-load-info{display:block;position:absolute;top:0;left:0;width:6px;height:6px}.tn-dropdown.server-load .server-load-info:before{content:\"\";display:block;position:absolute;top:-6px;left:-6px;z-index:1;transform:rotate(45deg);border:6px solid transparent;border-right-color:green}.input-mask{position:absolute;z-index:1;width:100%;padding-left:12px;padding-right:32px;box-sizing:border-box;border:1px solid transparent;outline:none;background:transparent;border-radius:3px}.input-mask.hide{display:none}.input-mask:focus{box-shadow:0 0 0 .2rem #a6d5fa;border-color:#2196f3}.button-setting{position:absolute;width:30px;height:30px;top:1px;right:1px;display:flex;align-items:center;justify-content:center;z-index:1;cursor:pointer;background:#fff;border-radius:3px}.button-setting.hide{display:none}.custom-select-item{display:inline-flex;align-items:center;background:#d2eefb;border-radius:3px;padding:3px 5px;margin:0 0 0 3px;border:1px solid #a9d8ff}.custom-select-item>span{font-size:12px;color:#555;margin-left:3px}.custom-select-item>span i{font-size:10px}.custom-select-item.min{padding:1px 5px;margin-left:2px}.custom-select-item:first-child{margin-left:0}::ng-deep .tn-dropdown.ui-state-disabled .custom-select-item{background:#e1e1e1;border-color:#d4d4d4}::ng-deep .tn-dropdown.ui-state-disabled .custom-select-item>span{display:none}::ng-deep .ui-multiselect-filter-container .input-mask{padding:.2em;height:22px;width:calc(100% - 2px);box-sizing:border-box;text-indent:1.5em;left:1px;top:1px}::ng-deep .ui-multiselect-filter-container .input-mask:focus{left:1px;width:calc(100% - 2px)}"]
|
|
33122
33123
|
},] }
|
|
@@ -35666,7 +35667,7 @@
|
|
|
35666
35667
|
_this.chooseLabel = 'Chọn';
|
|
35667
35668
|
_this.readonly = true;
|
|
35668
35669
|
_this.showDeleteFile = true;
|
|
35669
|
-
_this.accept = 'image/*,.xlsx,.xls,.pdf,.doc,.docx,.zip,.rar';
|
|
35670
|
+
_this.accept = 'image/*,.xlsx,.xls,.pdf,.doc,.docx,.zip,.rar,.ppt, .pptx)';
|
|
35670
35671
|
_this.maxFileSize = 100000000; // Size in byte
|
|
35671
35672
|
_this.invalidFileSizeMessageSummary = '{0}: Quá dung lượng file cho phép, ';
|
|
35672
35673
|
_this.invalidFileSizeMessageDetail = 'dung lượng tối đa là {0}.';
|
|
@@ -37776,703 +37777,6 @@
|
|
|
37776
37777
|
cancelButton: [{ type: i0.ViewChild, args: ['cancelButton',] }]
|
|
37777
37778
|
};
|
|
37778
37779
|
|
|
37779
|
-
var HighPerformanceService = /** @class */ (function () {
|
|
37780
|
-
function HighPerformanceService(_signalrService, _commonService, _httpClient, _moduleConfigService) {
|
|
37781
|
-
this._signalrService = _signalrService;
|
|
37782
|
-
this._commonService = _commonService;
|
|
37783
|
-
this._httpClient = _httpClient;
|
|
37784
|
-
this._moduleConfigService = _moduleConfigService;
|
|
37785
|
-
}
|
|
37786
|
-
HighPerformanceService.prototype.createProcess = function (queueName, callBackOnMessage, data, returnSequenceNumber) {
|
|
37787
|
-
var _this = this;
|
|
37788
|
-
if (callBackOnMessage === void 0) { callBackOnMessage = null; }
|
|
37789
|
-
if (data === void 0) { data = null; }
|
|
37790
|
-
if (returnSequenceNumber === void 0) { returnSequenceNumber = false; }
|
|
37791
|
-
var internalClientKey = this._commonService.guid();
|
|
37792
|
-
var model = {
|
|
37793
|
-
queueName: queueName,
|
|
37794
|
-
data: data,
|
|
37795
|
-
clientKey: internalClientKey
|
|
37796
|
-
};
|
|
37797
|
-
this._signalrService.start(null, internalClientKey, function (data) {
|
|
37798
|
-
if (callBackOnMessage) {
|
|
37799
|
-
callBackOnMessage(data);
|
|
37800
|
-
}
|
|
37801
|
-
_this._signalrService.unSubscribeViewCode(null, internalClientKey);
|
|
37802
|
-
});
|
|
37803
|
-
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
|
|
37804
|
-
var highPerformanceEndpoint, rs, _a_1;
|
|
37805
|
-
return __generator(this, function (_b) {
|
|
37806
|
-
switch (_b.label) {
|
|
37807
|
-
case 0:
|
|
37808
|
-
this.env = this._moduleConfigService.getConfig().environment;
|
|
37809
|
-
highPerformanceEndpoint = this.env.apiDomain.highPerformanceEndpoint + "/HighPerformance/DoWork?returnSequenceNumber=" + returnSequenceNumber;
|
|
37810
|
-
_b.label = 1;
|
|
37811
|
-
case 1:
|
|
37812
|
-
_b.trys.push([1, 3, , 4]);
|
|
37813
|
-
return [4 /*yield*/, this._httpClient.post(highPerformanceEndpoint, model).toPromise()];
|
|
37814
|
-
case 2:
|
|
37815
|
-
rs = _b.sent();
|
|
37816
|
-
if (rs.success) {
|
|
37817
|
-
resolve(rs.data);
|
|
37818
|
-
}
|
|
37819
|
-
return [3 /*break*/, 4];
|
|
37820
|
-
case 3:
|
|
37821
|
-
_a_1 = _b.sent();
|
|
37822
|
-
return [3 /*break*/, 4];
|
|
37823
|
-
case 4:
|
|
37824
|
-
resolve(null);
|
|
37825
|
-
return [2 /*return*/];
|
|
37826
|
-
}
|
|
37827
|
-
});
|
|
37828
|
-
}); });
|
|
37829
|
-
};
|
|
37830
|
-
HighPerformanceService.prototype.cancelProcess = function (queueName, uniqueKey) {
|
|
37831
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
37832
|
-
var highPerformanceEndpoint, rs, _a_2;
|
|
37833
|
-
return __generator(this, function (_b) {
|
|
37834
|
-
switch (_b.label) {
|
|
37835
|
-
case 0:
|
|
37836
|
-
_b.trys.push([0, 2, , 3]);
|
|
37837
|
-
highPerformanceEndpoint = this.env.apiDomain.highPerformanceEndpoint + "/HighPerformance/CancelWork?queueName=" + queueName + "&uniqueKey=" + uniqueKey;
|
|
37838
|
-
return [4 /*yield*/, this._httpClient.post(highPerformanceEndpoint, {}).toPromise()];
|
|
37839
|
-
case 1:
|
|
37840
|
-
rs = _b.sent();
|
|
37841
|
-
if (rs.success) {
|
|
37842
|
-
return [2 /*return*/, rs.data];
|
|
37843
|
-
}
|
|
37844
|
-
return [3 /*break*/, 3];
|
|
37845
|
-
case 2:
|
|
37846
|
-
_a_2 = _b.sent();
|
|
37847
|
-
return [3 /*break*/, 3];
|
|
37848
|
-
case 3: return [2 /*return*/, false];
|
|
37849
|
-
}
|
|
37850
|
-
});
|
|
37851
|
-
});
|
|
37852
|
-
};
|
|
37853
|
-
return HighPerformanceService;
|
|
37854
|
-
}());
|
|
37855
|
-
HighPerformanceService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function HighPerformanceService_Factory() { return new HighPerformanceService(i0__namespace.ɵɵinject(SignalRService), i0__namespace.ɵɵinject(CommonService), i0__namespace.ɵɵinject(i1__namespace$1.HttpClient), i0__namespace.ɵɵinject(ModuleConfigService)); }, token: HighPerformanceService, providedIn: "root" });
|
|
37856
|
-
HighPerformanceService.decorators = [
|
|
37857
|
-
{ type: i0.Injectable, args: [{
|
|
37858
|
-
providedIn: 'root'
|
|
37859
|
-
},] }
|
|
37860
|
-
];
|
|
37861
|
-
HighPerformanceService.ctorParameters = function () { return [
|
|
37862
|
-
{ type: SignalRService },
|
|
37863
|
-
{ type: CommonService },
|
|
37864
|
-
{ type: i1$1.HttpClient },
|
|
37865
|
-
{ type: ModuleConfigService }
|
|
37866
|
-
]; };
|
|
37867
|
-
|
|
37868
|
-
var TemplateService = /** @class */ (function () {
|
|
37869
|
-
function TemplateService(_moduleConfigService, _httpClient, _printService, _fileService, _notifierService, _crudService, _commonService) {
|
|
37870
|
-
this._httpClient = _httpClient;
|
|
37871
|
-
this._printService = _printService;
|
|
37872
|
-
this._fileService = _fileService;
|
|
37873
|
-
this._notifierService = _notifierService;
|
|
37874
|
-
this._crudService = _crudService;
|
|
37875
|
-
this._commonService = _commonService;
|
|
37876
|
-
this._moduleConfig = _moduleConfigService.getConfig();
|
|
37877
|
-
this.environment = this._moduleConfig.environment;
|
|
37878
|
-
this.serviceUri = this.environment.apiDomain.templateEndpoint + "/template";
|
|
37879
|
-
}
|
|
37880
|
-
TemplateService.prototype.laTexToBase64Image = function (laTex, font) {
|
|
37881
|
-
if (font === void 0) { font = 54; }
|
|
37882
|
-
var api = this.serviceUri + "/LatexToBase64";
|
|
37883
|
-
return this._httpClient.post(api, { laTex: laTex, font: font }).toPromise();
|
|
37884
|
-
};
|
|
37885
|
-
/**
|
|
37886
|
-
* Description: Xuất file sử dụng thư viện CX, xuất xong tự động mở popup để lưu file.
|
|
37887
|
-
*/
|
|
37888
|
-
TemplateService.prototype.exportCxExcelByCode = function (model) {
|
|
37889
|
-
var _this = this;
|
|
37890
|
-
var url = this.serviceUri + "/ExportCxExcelByCode";
|
|
37891
|
-
this.setFileInfo(model);
|
|
37892
|
-
return this._httpClient
|
|
37893
|
-
.post(url, model, { responseType: 'blob' })
|
|
37894
|
-
.toPromise()
|
|
37895
|
-
.then(function (res) {
|
|
37896
|
-
FileSaver__namespace.saveAs(res, _this.getFullFileName(model.fileName || model.code));
|
|
37897
|
-
}).catch(function (err) { return __awaiter(_this, void 0, void 0, function () {
|
|
37898
|
-
var errorText;
|
|
37899
|
-
return __generator(this, function (_a) {
|
|
37900
|
-
switch (_a.label) {
|
|
37901
|
-
case 0: return [4 /*yield*/, err.error.text()];
|
|
37902
|
-
case 1:
|
|
37903
|
-
errorText = _a.sent();
|
|
37904
|
-
this._crudService.processErrorResponse(JSON.parse(errorText || ''));
|
|
37905
|
-
return [2 /*return*/];
|
|
37906
|
-
}
|
|
37907
|
-
});
|
|
37908
|
-
}); });
|
|
37909
|
-
};
|
|
37910
|
-
TemplateService.prototype.exportManyCxExcelByCode = function (model) {
|
|
37911
|
-
var _this = this;
|
|
37912
|
-
var url = this.serviceUri + "/ExportManyCxExcelByCode";
|
|
37913
|
-
this.setManyFileInfo(model);
|
|
37914
|
-
return this._httpClient
|
|
37915
|
-
.post(url, model)
|
|
37916
|
-
.toPromise()
|
|
37917
|
-
.then(function (res) {
|
|
37918
|
-
if (res.success) {
|
|
37919
|
-
_this._fileService.downloadFolder(res.data.folderId);
|
|
37920
|
-
}
|
|
37921
|
-
else {
|
|
37922
|
-
_this._crudService.processErrorResponse(res);
|
|
37923
|
-
}
|
|
37924
|
-
}).catch(function (err) { return __awaiter(_this, void 0, void 0, function () {
|
|
37925
|
-
var errorText;
|
|
37926
|
-
return __generator(this, function (_a) {
|
|
37927
|
-
switch (_a.label) {
|
|
37928
|
-
case 0: return [4 /*yield*/, err.error.text()];
|
|
37929
|
-
case 1:
|
|
37930
|
-
errorText = _a.sent();
|
|
37931
|
-
this._crudService.processErrorResponse(JSON.parse(errorText || ''));
|
|
37932
|
-
return [2 /*return*/];
|
|
37933
|
-
}
|
|
37934
|
-
});
|
|
37935
|
-
}); });
|
|
37936
|
-
};
|
|
37937
|
-
TemplateService.prototype.getFullFileName = function (fileName, extension) {
|
|
37938
|
-
if (extension === void 0) { extension = TemplateConstant.EXCEL_EXTENSION; }
|
|
37939
|
-
return "" + fileName + extension;
|
|
37940
|
-
};
|
|
37941
|
-
/**
|
|
37942
|
-
* Description: Export sử dung ClosedXml.Report (Cx) với signalR, sử dụng cho file dữ liệu lớn.
|
|
37943
|
-
* Param: model chứa
|
|
37944
|
-
* - code : code của template cấu hình bên Quản trị > Biểu mẫu > Biểu mẫu excel.
|
|
37945
|
-
* - data : object chứa dữ liệu đã chuyền thành dạng json.
|
|
37946
|
-
* - fileName: tên file sau khi export.
|
|
37947
|
-
* - topic: guid dùng để subscribe.
|
|
37948
|
-
*/
|
|
37949
|
-
TemplateService.prototype.ExportCxExcelByCodeWithSignalR = function (model) {
|
|
37950
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
37951
|
-
var url;
|
|
37952
|
-
return __generator(this, function (_a) {
|
|
37953
|
-
url = this.serviceUri + "/ExportCxExcelByCodeWithSignalR";
|
|
37954
|
-
return [2 /*return*/, this._httpClient.post(url, model)
|
|
37955
|
-
.toPromise()];
|
|
37956
|
-
});
|
|
37957
|
-
});
|
|
37958
|
-
};
|
|
37959
|
-
/**
|
|
37960
|
-
* Description: Export sử dung ClosedXml.Report (Cx) với HighPerformanceService, sử dụng cho file dữ liệu lớn.
|
|
37961
|
-
* Param: model chứa
|
|
37962
|
-
* - code : code của template cấu hình bên Quản trị > Biểu mẫu > Biểu mẫu excel.
|
|
37963
|
-
* - data : object chứa dữ liệu đã chuyền thành dạng json.
|
|
37964
|
-
* - fileName: tên file sau khi export.
|
|
37965
|
-
* - queueName: queue của topic.
|
|
37966
|
-
* - uniqueKey: unique key cho task.
|
|
37967
|
-
*/
|
|
37968
|
-
TemplateService.prototype.ExportCxExcelByCodeWithHPS = function (model) {
|
|
37969
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
37970
|
-
var url;
|
|
37971
|
-
return __generator(this, function (_a) {
|
|
37972
|
-
url = this.serviceUri + "/ExportWithHighPerformanceService";
|
|
37973
|
-
return [2 /*return*/, this._httpClient.post(url, model)
|
|
37974
|
-
.toPromise()];
|
|
37975
|
-
});
|
|
37976
|
-
});
|
|
37977
|
-
};
|
|
37978
|
-
TemplateService.prototype.exportCxExcelByCodePromise = function (model) {
|
|
37979
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
37980
|
-
var url;
|
|
37981
|
-
return __generator(this, function (_a) {
|
|
37982
|
-
url = this.serviceUri + "/ExportCxExcelByCode";
|
|
37983
|
-
return [2 /*return*/, this._httpClient
|
|
37984
|
-
.post(url, model, { responseType: 'blob' })
|
|
37985
|
-
.toPromise()];
|
|
37986
|
-
});
|
|
37987
|
-
});
|
|
37988
|
-
};
|
|
37989
|
-
TemplateService.prototype.fillTemplateByCodeAndGetPdf = function (templateCode, data, onLoadingDataPdf, onEndLoadingDataPdf) {
|
|
37990
|
-
var _this = this;
|
|
37991
|
-
if (onLoadingDataPdf === void 0) { onLoadingDataPdf = null; }
|
|
37992
|
-
if (onEndLoadingDataPdf === void 0) { onEndLoadingDataPdf = null; }
|
|
37993
|
-
var url = this.serviceUri + "/fillWordByTemplateCode/" + templateCode + "?isPrint=true";
|
|
37994
|
-
return this._httpClient
|
|
37995
|
-
.post(url, data)
|
|
37996
|
-
.toPromise().then(function (res) {
|
|
37997
|
-
if (res.data) {
|
|
37998
|
-
_this._printService.printBase64Pdf(res.data, onLoadingDataPdf, onEndLoadingDataPdf);
|
|
37999
|
-
}
|
|
38000
|
-
});
|
|
38001
|
-
};
|
|
38002
|
-
TemplateService.prototype.fillWordByTemplateCodeMultiData = function (templateCode, data, onLoadingDataPdf, onEndLoadingDataPdf) {
|
|
38003
|
-
var _this = this;
|
|
38004
|
-
if (onLoadingDataPdf === void 0) { onLoadingDataPdf = null; }
|
|
38005
|
-
if (onEndLoadingDataPdf === void 0) { onEndLoadingDataPdf = null; }
|
|
38006
|
-
var url = this.serviceUri + "/fillWordByTemplateCodeMultiData/" + templateCode + "?isPrint=true";
|
|
38007
|
-
return this._httpClient
|
|
38008
|
-
.post(url, data)
|
|
38009
|
-
.toPromise().then(function (res) {
|
|
38010
|
-
if (res.data) {
|
|
38011
|
-
_this._printService.printBase64Pdf(res.data, onLoadingDataPdf, onEndLoadingDataPdf);
|
|
38012
|
-
}
|
|
38013
|
-
});
|
|
38014
|
-
};
|
|
38015
|
-
TemplateService.prototype.setFileInfo = function (model) {
|
|
38016
|
-
model.data = model.data ? model.data : JSON.stringify(model.dataObject);
|
|
38017
|
-
delete model.dataObject;
|
|
38018
|
-
};
|
|
38019
|
-
TemplateService.prototype.setManyFileInfo = function (manyModel) {
|
|
38020
|
-
var _this = this;
|
|
38021
|
-
var hasModel = manyModel && manyModel.lstFileInfo && manyModel.lstFileInfo.length;
|
|
38022
|
-
if (!hasModel) {
|
|
38023
|
-
return;
|
|
38024
|
-
}
|
|
38025
|
-
manyModel.lstFileInfo.forEach(function (fileInfo) {
|
|
38026
|
-
_this.setFileInfo(fileInfo);
|
|
38027
|
-
fileInfo.fileName = fileInfo.fileName + "_" + _this._commonService.guid() + "." + TemplateConstant.EXCEL_EXTENSION;
|
|
38028
|
-
});
|
|
38029
|
-
};
|
|
38030
|
-
/**
|
|
38031
|
-
* Export dữ liệu không dùng template.
|
|
38032
|
-
*/
|
|
38033
|
-
TemplateService.prototype.exportCxExcel = function (model) {
|
|
38034
|
-
var _this = this;
|
|
38035
|
-
var url = this.serviceUri + "/ExportCxExcel";
|
|
38036
|
-
return this._httpClient
|
|
38037
|
-
.post(url, model, { responseType: 'blob' })
|
|
38038
|
-
.toPromise()
|
|
38039
|
-
.then(function (res) {
|
|
38040
|
-
FileSaver__namespace.saveAs(res, _this.getFullFileName(model.fileName || 'Export'));
|
|
38041
|
-
}).catch(function (err) { return __awaiter(_this, void 0, void 0, function () {
|
|
38042
|
-
var errorText;
|
|
38043
|
-
return __generator(this, function (_a) {
|
|
38044
|
-
switch (_a.label) {
|
|
38045
|
-
case 0: return [4 /*yield*/, err.error.text()];
|
|
38046
|
-
case 1:
|
|
38047
|
-
errorText = _a.sent();
|
|
38048
|
-
this._crudService.processErrorResponse(JSON.parse(errorText || ''));
|
|
38049
|
-
return [2 /*return*/];
|
|
38050
|
-
}
|
|
38051
|
-
});
|
|
38052
|
-
}); });
|
|
38053
|
-
};
|
|
38054
|
-
TemplateService.prototype.exportCxExcelPromise = function (model) {
|
|
38055
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
38056
|
-
var url;
|
|
38057
|
-
return __generator(this, function (_a) {
|
|
38058
|
-
url = this.serviceUri + "/ExportCxExcel";
|
|
38059
|
-
return [2 /*return*/, this._httpClient
|
|
38060
|
-
.post(url, model, { responseType: 'blob' })
|
|
38061
|
-
.toPromise()];
|
|
38062
|
-
});
|
|
38063
|
-
});
|
|
38064
|
-
};
|
|
38065
|
-
return TemplateService;
|
|
38066
|
-
}());
|
|
38067
|
-
TemplateService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function TemplateService_Factory() { return new TemplateService(i0__namespace.ɵɵinject(ModuleConfigService), i0__namespace.ɵɵinject(i1__namespace$1.HttpClient), i0__namespace.ɵɵinject(PrintService), i0__namespace.ɵɵinject(FileExplorerService), i0__namespace.ɵɵinject(NotifierService), i0__namespace.ɵɵinject(CrudService), i0__namespace.ɵɵinject(CommonService)); }, token: TemplateService, providedIn: "root" });
|
|
38068
|
-
TemplateService.decorators = [
|
|
38069
|
-
{ type: i0.Injectable, args: [{
|
|
38070
|
-
providedIn: 'root'
|
|
38071
|
-
},] }
|
|
38072
|
-
];
|
|
38073
|
-
TemplateService.ctorParameters = function () { return [
|
|
38074
|
-
{ type: ModuleConfigService },
|
|
38075
|
-
{ type: i1$1.HttpClient },
|
|
38076
|
-
{ type: PrintService },
|
|
38077
|
-
{ type: FileExplorerService },
|
|
38078
|
-
{ type: NotifierService },
|
|
38079
|
-
{ type: CrudService },
|
|
38080
|
-
{ type: CommonService }
|
|
38081
|
-
]; };
|
|
38082
|
-
|
|
38083
|
-
var JobItem = /** @class */ (function () {
|
|
38084
|
-
function JobItem(code, data, fileName, status) {
|
|
38085
|
-
if (fileName === void 0) { fileName = 'BaoCao'; }
|
|
38086
|
-
if (status === void 0) { status = REPORT_QUEUE_CONSTANT.statuses.Waiting; }
|
|
38087
|
-
// Loại export.
|
|
38088
|
-
this._type = JobTypes.SingnalR;
|
|
38089
|
-
this._code = code;
|
|
38090
|
-
var datepipe = new i3.DatePipe('en-US');
|
|
38091
|
-
var formattedDate = datepipe.transform(new Date(), 'ddMMyyyy_hhmmss');
|
|
38092
|
-
this._fileName = fileName + "_" + formattedDate + TemplateConstant.EXCEL_EXTENSION;
|
|
38093
|
-
this._data = data || {};
|
|
38094
|
-
this._status = status;
|
|
38095
|
-
}
|
|
38096
|
-
return JobItem;
|
|
38097
|
-
}());
|
|
38098
|
-
var REPORT_QUEUE_CONSTANT = /** @class */ (function () {
|
|
38099
|
-
function REPORT_QUEUE_CONSTANT() {
|
|
38100
|
-
}
|
|
38101
|
-
return REPORT_QUEUE_CONSTANT;
|
|
38102
|
-
}());
|
|
38103
|
-
REPORT_QUEUE_CONSTANT.statuses = {
|
|
38104
|
-
Waiting: 1,
|
|
38105
|
-
Exporting: 2,
|
|
38106
|
-
Success: 3,
|
|
38107
|
-
Error: 4,
|
|
38108
|
-
Downloaded: 5
|
|
38109
|
-
};
|
|
38110
|
-
REPORT_QUEUE_CONSTANT.dicStatus = new SimpleDictionary([
|
|
38111
|
-
new SimpleDicItem(REPORT_QUEUE_CONSTANT.statuses.Waiting, 'Chờ để xử lý'),
|
|
38112
|
-
new SimpleDicItem(REPORT_QUEUE_CONSTANT.statuses.Exporting, 'Đang xử lý'),
|
|
38113
|
-
new SimpleDicItem(REPORT_QUEUE_CONSTANT.statuses.Success, 'Tải xuống'),
|
|
38114
|
-
new SimpleDicItem(REPORT_QUEUE_CONSTANT.statuses.Error, 'Xuất file chưa thành công'),
|
|
38115
|
-
new SimpleDicItem(REPORT_QUEUE_CONSTANT.statuses.Downloaded, 'Đã tải'),
|
|
38116
|
-
]);
|
|
38117
|
-
var JobTypes;
|
|
38118
|
-
(function (JobTypes) {
|
|
38119
|
-
JobTypes[JobTypes["Normal"] = 1] = "Normal";
|
|
38120
|
-
JobTypes[JobTypes["SingnalR"] = 2] = "SingnalR";
|
|
38121
|
-
JobTypes[JobTypes["Many"] = 3] = "Many"; // Export nhiều file cùng một lúc và nén vào file zip, mỗi file có thể là các loại biểu mẫu khác nhau.
|
|
38122
|
-
})(JobTypes || (JobTypes = {}));
|
|
38123
|
-
var ExportJob = /** @class */ (function () {
|
|
38124
|
-
function ExportJob(templateCode, // code template cấu hình bên quản trị
|
|
38125
|
-
dataPromise, // promise dùng để lấy dữ liệu, trả về dạng ResponseResult
|
|
38126
|
-
fileName, // tên của file được lưu
|
|
38127
|
-
rootName, // tên thuộc tính của lst dữ liệu ngoài cùng
|
|
38128
|
-
cb, // dùng để xử lý dữ liệu sau khi lấy xong
|
|
38129
|
-
type // Loại export.
|
|
38130
|
-
) {
|
|
38131
|
-
if (rootName === void 0) { rootName = ''; }
|
|
38132
|
-
if (cb === void 0) { cb = null; }
|
|
38133
|
-
if (type === void 0) { type = JobTypes.Normal; }
|
|
38134
|
-
this.templateCode = templateCode;
|
|
38135
|
-
this.dataPromise = dataPromise;
|
|
38136
|
-
this.fileName = fileName;
|
|
38137
|
-
this.rootName = rootName;
|
|
38138
|
-
this.cb = cb;
|
|
38139
|
-
this.type = type;
|
|
38140
|
-
}
|
|
38141
|
-
return ExportJob;
|
|
38142
|
-
}());
|
|
38143
|
-
|
|
38144
|
-
var ReportQueueComponent = /** @class */ (function () {
|
|
38145
|
-
function ReportQueueComponent(_notifierService, _commonService, _fileService, _tempateService, _signalRService, _highPerformanceService, _crudService) {
|
|
38146
|
-
this._notifierService = _notifierService;
|
|
38147
|
-
this._commonService = _commonService;
|
|
38148
|
-
this._fileService = _fileService;
|
|
38149
|
-
this._tempateService = _tempateService;
|
|
38150
|
-
this._signalRService = _signalRService;
|
|
38151
|
-
this._highPerformanceService = _highPerformanceService;
|
|
38152
|
-
this._crudService = _crudService;
|
|
38153
|
-
this.name = 'reportQueue';
|
|
38154
|
-
this.header = 'Xuất báo cáo';
|
|
38155
|
-
this.autoDownload = false;
|
|
38156
|
-
this.maxNameLength = 40;
|
|
38157
|
-
this.expand = true;
|
|
38158
|
-
this.queueName = 'REPORT_QUEUE';
|
|
38159
|
-
this.hub = 'CommonHub';
|
|
38160
|
-
this.dicStatus = REPORT_QUEUE_CONSTANT.dicStatus;
|
|
38161
|
-
this.statuses = REPORT_QUEUE_CONSTANT.statuses;
|
|
38162
|
-
this._queue = [];
|
|
38163
|
-
this.maxHeight = 200;
|
|
38164
|
-
this.itemHeight = 50;
|
|
38165
|
-
this.popupHeight = this.itemHeight;
|
|
38166
|
-
}
|
|
38167
|
-
ReportQueueComponent.prototype.ngOnInit = function () {
|
|
38168
|
-
if (this.parentDataModel && this.name) {
|
|
38169
|
-
this.parentDataModel[this.name] = this;
|
|
38170
|
-
}
|
|
38171
|
-
};
|
|
38172
|
-
ReportQueueComponent.prototype.toggleExpand = function () {
|
|
38173
|
-
this.expand = !this.expand;
|
|
38174
|
-
};
|
|
38175
|
-
/**
|
|
38176
|
-
* Thêm job vào để thực hiện
|
|
38177
|
-
*/
|
|
38178
|
-
ReportQueueComponent.prototype.addJob = function (exportJob) {
|
|
38179
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
38180
|
-
var foundIndex, job, rsData;
|
|
38181
|
-
var _this = this;
|
|
38182
|
-
return __generator(this, function (_a) {
|
|
38183
|
-
switch (_a.label) {
|
|
38184
|
-
case 0:
|
|
38185
|
-
foundIndex = this._queue.findIndex(function (job) { return job._code == exportJob.templateCode && job._status == _this.statuses.Exporting; });
|
|
38186
|
-
if (foundIndex !== -1) {
|
|
38187
|
-
this._notifierService.showWarning("File cùng loại đang được xử lý, thử lại sau khi xử lý xong!");
|
|
38188
|
-
return [2 /*return*/];
|
|
38189
|
-
}
|
|
38190
|
-
job = new JobItem(exportJob.templateCode, {}, exportJob.fileName || exportJob.templateCode, this.statuses.Exporting);
|
|
38191
|
-
this._queue.push(job);
|
|
38192
|
-
this.updatePopupHeight();
|
|
38193
|
-
setTimeout(function () {
|
|
38194
|
-
_this.scrollbar.scrollToBottom();
|
|
38195
|
-
}, 100);
|
|
38196
|
-
return [4 /*yield*/, exportJob.dataPromise];
|
|
38197
|
-
case 1:
|
|
38198
|
-
rsData = _a.sent();
|
|
38199
|
-
if (rsData.data == null) {
|
|
38200
|
-
job._status = this.statuses.Error;
|
|
38201
|
-
return [2 /*return*/, this._crudService.processErrorResponse(rsData)];
|
|
38202
|
-
}
|
|
38203
|
-
if (exportJob.cb) {
|
|
38204
|
-
job._data = exportJob.cb(rsData.data);
|
|
38205
|
-
}
|
|
38206
|
-
else if (exportJob.rootName) {
|
|
38207
|
-
job._data[exportJob.rootName] = rsData.data;
|
|
38208
|
-
}
|
|
38209
|
-
else {
|
|
38210
|
-
job._data = rsData.data;
|
|
38211
|
-
}
|
|
38212
|
-
switch (exportJob.type) {
|
|
38213
|
-
case JobTypes.Normal:
|
|
38214
|
-
this.Export(job);
|
|
38215
|
-
break;
|
|
38216
|
-
case JobTypes.SingnalR:
|
|
38217
|
-
this.ExportWithSignalR(job);
|
|
38218
|
-
break;
|
|
38219
|
-
case JobTypes.Many:
|
|
38220
|
-
break;
|
|
38221
|
-
}
|
|
38222
|
-
return [2 /*return*/];
|
|
38223
|
-
}
|
|
38224
|
-
});
|
|
38225
|
-
});
|
|
38226
|
-
};
|
|
38227
|
-
/**
|
|
38228
|
-
* Thêm job vào để thực hiện
|
|
38229
|
-
* - templateCode: code template cấu hình bên quản trị
|
|
38230
|
-
* - data: dữ liệu export
|
|
38231
|
-
* - fileName: tên của file được lưu
|
|
38232
|
-
* - useSignalR: thay vì gọi request và chờ đến khi thực hiện xong
|
|
38233
|
-
* trả về binaryFile thì tạo tiến trình riêng để export, và dùng signalR thông
|
|
38234
|
-
* báo kết quả export, trả về fileId để tải.
|
|
38235
|
-
*/
|
|
38236
|
-
ReportQueueComponent.prototype.addJobWithData = function (templateCode, data, fileName, useSignalR) {
|
|
38237
|
-
if (useSignalR === void 0) { useSignalR = false; }
|
|
38238
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
38239
|
-
var foundIndex, job;
|
|
38240
|
-
var _this = this;
|
|
38241
|
-
return __generator(this, function (_a) {
|
|
38242
|
-
foundIndex = this._queue.findIndex(function (job) { return job._code == templateCode && job._status == _this.statuses.Exporting; });
|
|
38243
|
-
if (foundIndex !== -1) {
|
|
38244
|
-
this._notifierService.showWarning("File cùng loại đang được xử lý, thử lại sau khi xử lý xong!");
|
|
38245
|
-
return [2 /*return*/];
|
|
38246
|
-
}
|
|
38247
|
-
job = new JobItem(templateCode, data, fileName || templateCode, this.statuses.Exporting);
|
|
38248
|
-
this._queue.push(job);
|
|
38249
|
-
if (useSignalR) {
|
|
38250
|
-
this.ExportWithSignalR(job);
|
|
38251
|
-
}
|
|
38252
|
-
else {
|
|
38253
|
-
this.Export(job);
|
|
38254
|
-
}
|
|
38255
|
-
return [2 /*return*/];
|
|
38256
|
-
});
|
|
38257
|
-
});
|
|
38258
|
-
};
|
|
38259
|
-
ReportQueueComponent.prototype.Export = function (job) {
|
|
38260
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
38261
|
-
var _this = this;
|
|
38262
|
-
return __generator(this, function (_a) {
|
|
38263
|
-
this._tempateService.exportCxExcelByCodePromise({ code: job._code, data: JSON.stringify(job._data), fileName: job._fileName })
|
|
38264
|
-
.then(function (file) {
|
|
38265
|
-
job._status = _this.statuses.Success;
|
|
38266
|
-
job._binaryFile = file;
|
|
38267
|
-
if (_this.autoDownload) {
|
|
38268
|
-
_this.download(job);
|
|
38269
|
-
}
|
|
38270
|
-
}).catch(function (err) { return __awaiter(_this, void 0, void 0, function () {
|
|
38271
|
-
var errorText;
|
|
38272
|
-
return __generator(this, function (_a) {
|
|
38273
|
-
switch (_a.label) {
|
|
38274
|
-
case 0:
|
|
38275
|
-
job._status = this.statuses.Error;
|
|
38276
|
-
return [4 /*yield*/, err.error.text()];
|
|
38277
|
-
case 1:
|
|
38278
|
-
errorText = _a.sent();
|
|
38279
|
-
this._crudService.processErrorResponse(JSON.parse(errorText || ''));
|
|
38280
|
-
return [2 /*return*/];
|
|
38281
|
-
}
|
|
38282
|
-
});
|
|
38283
|
-
}); });
|
|
38284
|
-
return [2 /*return*/];
|
|
38285
|
-
});
|
|
38286
|
-
});
|
|
38287
|
-
};
|
|
38288
|
-
ReportQueueComponent.prototype.ExportWithSignalR = function (job) {
|
|
38289
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
38290
|
-
var topic;
|
|
38291
|
-
var _this = this;
|
|
38292
|
-
return __generator(this, function (_a) {
|
|
38293
|
-
topic = this._commonService.guid();
|
|
38294
|
-
job._uniqueKey = topic;
|
|
38295
|
-
this._signalRService.start(this.hub, topic, function (message) {
|
|
38296
|
-
var rs = JSON.parse(message);
|
|
38297
|
-
if (rs.success) {
|
|
38298
|
-
job._status = _this.statuses.Success;
|
|
38299
|
-
job._fileId = rs.data;
|
|
38300
|
-
if (_this.autoDownload) {
|
|
38301
|
-
_this.download(job);
|
|
38302
|
-
}
|
|
38303
|
-
}
|
|
38304
|
-
else {
|
|
38305
|
-
job._status = _this.statuses.Error;
|
|
38306
|
-
_this._crudService.processErrorResponse(rs);
|
|
38307
|
-
}
|
|
38308
|
-
});
|
|
38309
|
-
this._tempateService.ExportCxExcelByCodeWithSignalR({ code: job._code, data: JSON.stringify(job._data), fileName: job._fileName, topic: topic })
|
|
38310
|
-
.then(function (rs) {
|
|
38311
|
-
if (!rs.success) {
|
|
38312
|
-
job._status = _this.statuses.Error;
|
|
38313
|
-
_this._crudService.processErrorResponse(rs);
|
|
38314
|
-
}
|
|
38315
|
-
}).catch(function (err) { return __awaiter(_this, void 0, void 0, function () {
|
|
38316
|
-
return __generator(this, function (_a) {
|
|
38317
|
-
job._status = this.statuses.Error;
|
|
38318
|
-
this._crudService.processErrorResponse(err.error);
|
|
38319
|
-
return [2 /*return*/];
|
|
38320
|
-
});
|
|
38321
|
-
}); });
|
|
38322
|
-
;
|
|
38323
|
-
return [2 /*return*/];
|
|
38324
|
-
});
|
|
38325
|
-
});
|
|
38326
|
-
};
|
|
38327
|
-
ReportQueueComponent.prototype.ExportCxExcelByCodeWithHPS = function (job) {
|
|
38328
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
38329
|
-
var _this = this;
|
|
38330
|
-
return __generator(this, function (_a) {
|
|
38331
|
-
this._highPerformanceService.createProcess(this.queueName, function (arrMessage) {
|
|
38332
|
-
var message = arrMessage.pop();
|
|
38333
|
-
var rs = JSON.parse(message);
|
|
38334
|
-
if (rs.success) {
|
|
38335
|
-
job._status = _this.statuses.Success;
|
|
38336
|
-
job._fileId = rs.data;
|
|
38337
|
-
if (_this.autoDownload) {
|
|
38338
|
-
_this._fileService.downloadFile(job._fileId);
|
|
38339
|
-
job._status = _this.statuses.Downloaded;
|
|
38340
|
-
job._fileId = null;
|
|
38341
|
-
}
|
|
38342
|
-
}
|
|
38343
|
-
else {
|
|
38344
|
-
job._status = _this.statuses.Error;
|
|
38345
|
-
_this._crudService.processErrorResponse(rs);
|
|
38346
|
-
}
|
|
38347
|
-
}).then(function (rs) {
|
|
38348
|
-
job._uniqueKey = rs;
|
|
38349
|
-
_this._tempateService.ExportCxExcelByCodeWithHPS({
|
|
38350
|
-
code: job._code,
|
|
38351
|
-
data: JSON.stringify(job._data),
|
|
38352
|
-
fileName: job._fileName,
|
|
38353
|
-
topic: _this.queueName,
|
|
38354
|
-
uniqueKey: job._uniqueKey
|
|
38355
|
-
}).then(function (rs) {
|
|
38356
|
-
if (!rs.success) {
|
|
38357
|
-
job._status = _this.statuses.Error;
|
|
38358
|
-
_this._crudService.processErrorResponse(rs);
|
|
38359
|
-
}
|
|
38360
|
-
}, function (err) {
|
|
38361
|
-
job._status = _this.statuses.Error;
|
|
38362
|
-
console.log("Lỗi gọi api server export");
|
|
38363
|
-
});
|
|
38364
|
-
}, function (err) {
|
|
38365
|
-
job._status = _this.statuses.Error;
|
|
38366
|
-
console.log("Lỗi gọi HPS service :(");
|
|
38367
|
-
});
|
|
38368
|
-
return [2 /*return*/];
|
|
38369
|
-
});
|
|
38370
|
-
});
|
|
38371
|
-
};
|
|
38372
|
-
ReportQueueComponent.prototype.download = function (job) {
|
|
38373
|
-
if (job._status == this.statuses.Downloaded) {
|
|
38374
|
-
return;
|
|
38375
|
-
}
|
|
38376
|
-
if (job._fileId) {
|
|
38377
|
-
this._fileService.downloadFile(job._fileId, false, job._fileName);
|
|
38378
|
-
}
|
|
38379
|
-
else if (job._binaryFile) {
|
|
38380
|
-
FileSaver__namespace.saveAs(job._binaryFile, job._fileName);
|
|
38381
|
-
}
|
|
38382
|
-
job._status = this.statuses.Downloaded;
|
|
38383
|
-
job._binaryFile = null;
|
|
38384
|
-
job._fileId = null;
|
|
38385
|
-
};
|
|
38386
|
-
ReportQueueComponent.prototype.showQueue = function () {
|
|
38387
|
-
var show = this._queue && this._queue.length > 0;
|
|
38388
|
-
return show;
|
|
38389
|
-
};
|
|
38390
|
-
ReportQueueComponent.prototype.getName = function (job) {
|
|
38391
|
-
var name = job._fileName.length > this.maxNameLength ? job._fileName.substr(0, this.maxNameLength - 10) + "[...]" + TemplateConstant.EXCEL_EXTENSION : job._fileName;
|
|
38392
|
-
return name;
|
|
38393
|
-
};
|
|
38394
|
-
ReportQueueComponent.prototype.cancelJob = function (job) {
|
|
38395
|
-
var _this = this;
|
|
38396
|
-
var foundIndex = this._queue.findIndex(function (j) { return j._code == job._code; });
|
|
38397
|
-
if (foundIndex == -1) {
|
|
38398
|
-
return;
|
|
38399
|
-
}
|
|
38400
|
-
var foundJob = this._queue[foundIndex];
|
|
38401
|
-
if (foundJob._status == this.statuses.Exporting) {
|
|
38402
|
-
this._notifierService
|
|
38403
|
-
.showConfirm('File này đang được xử lý. Bạn có muốn dừng lại?', 'Hủy xuất file')
|
|
38404
|
-
.then(function (rs) {
|
|
38405
|
-
if (!rs) {
|
|
38406
|
-
return;
|
|
38407
|
-
}
|
|
38408
|
-
var needUnsubscribe = foundJob._type == JobTypes.SingnalR && foundJob._uniqueKey;
|
|
38409
|
-
if (needUnsubscribe) {
|
|
38410
|
-
_this._signalRService.unSubscribeViewCode(foundJob._uniqueKey, _this.hub);
|
|
38411
|
-
}
|
|
38412
|
-
_this._queue.splice(foundIndex, 1);
|
|
38413
|
-
_this.updatePopupHeight();
|
|
38414
|
-
});
|
|
38415
|
-
}
|
|
38416
|
-
else if (foundJob._status != this.statuses.Exporting) {
|
|
38417
|
-
this._queue.splice(foundIndex, 1);
|
|
38418
|
-
this.updatePopupHeight();
|
|
38419
|
-
}
|
|
38420
|
-
};
|
|
38421
|
-
ReportQueueComponent.prototype.close = function () {
|
|
38422
|
-
var _this = this;
|
|
38423
|
-
var hasExporting = this._queue && this._queue.filter(function (item) { return item._status == _this.statuses.Exporting; }).length > 0;
|
|
38424
|
-
if (hasExporting) {
|
|
38425
|
-
this._notifierService
|
|
38426
|
-
.showConfirm('Có file đang được xử lý. Bạn có muốn dừng lại?', 'Hủy xuất file')
|
|
38427
|
-
.then(function (rs) {
|
|
38428
|
-
if (!rs) {
|
|
38429
|
-
return;
|
|
38430
|
-
}
|
|
38431
|
-
var needUnsubscribe = false;
|
|
38432
|
-
_this._queue.forEach(function (job) {
|
|
38433
|
-
needUnsubscribe = job._type == JobTypes.SingnalR && job._uniqueKey;
|
|
38434
|
-
if (needUnsubscribe) {
|
|
38435
|
-
_this._signalRService.unSubscribeViewCode(job._uniqueKey, _this.hub);
|
|
38436
|
-
}
|
|
38437
|
-
});
|
|
38438
|
-
_this._queue = [];
|
|
38439
|
-
_this.updatePopupHeight();
|
|
38440
|
-
});
|
|
38441
|
-
}
|
|
38442
|
-
else {
|
|
38443
|
-
this._queue = [];
|
|
38444
|
-
}
|
|
38445
|
-
};
|
|
38446
|
-
ReportQueueComponent.prototype.updatePopupHeight = function () {
|
|
38447
|
-
var height = (this._queue || []).length * this.itemHeight;
|
|
38448
|
-
this.popupHeight = height > this.maxHeight ? this.maxHeight : height;
|
|
38449
|
-
};
|
|
38450
|
-
return ReportQueueComponent;
|
|
38451
|
-
}());
|
|
38452
|
-
ReportQueueComponent.decorators = [
|
|
38453
|
-
{ type: i0.Component, args: [{
|
|
38454
|
-
selector: 'report-queue',
|
|
38455
|
-
template: "<div class=\"rq-container\" *ngIf=\"showQueue()\">\n <div class=\"rq-header\">\n <div>{{header | translate}}</div>\n <div>\n\n <p-checkbox [(ngModel)]=\"autoDownload\" binary=\"true\" pTooltip=\"T\u1EF1 \u0111\u1ED9ng t\u1EA3i\" tooltipPosition=\"left\">\n </p-checkbox>\n\n <a href=\"javascript:;\" (click)=\"toggleExpand()\" pTooltip=\"{{expand ? 'Thu g\u1ECDn' : 'M\u1EDF r\u1ED9ng'}}\"\n tooltipPosition=\"left\">\n <i class=\"fas\" [ngClass]=\"{'fa-compress' : expand, 'fa-expand': !expand}\"></i>\n </a>\n\n <a href=\"javascript:;\" (click)=\"close()\" pTooltip=\"\u0110\u00F3ng\">\n <i class=\"fas fa-times\"></i>\n </a>\n </div>\n </div>\n <div class=\"rq-body\" *ngIf=\"expand\">\n <tn-custom-scrollbar [style]=\"{'height.px': popupHeight}\" #scrollbar>\n <div class=\"re-job\" *ngFor=\"let job of _queue\">\n <div class=\"re-job-title\">\n <div>{{getName(job)}}</div>\n <div>\n <a href=\"javascript:;\" (click)=\"cancelJob(job)\">\n <i class=\"fas fa-times\"></i>\n </a>\n </div>\n </div>\n <div class=\"re-job-result\"\n [ngClass]=\"{'job-success': job._status == statuses.Success, 'job-error': job._status == statuses.Error, 'job-exporting' : job._status == statuses.Exporting, 'job-downloaded': job._status == statuses.Downloaded}\">\n <span *ngIf=\"job._status != statuses.Success && job._status != statuses.Exporting\">\n {{dicStatus.get(job._status) | translate}}\n </span>\n\n <span *ngIf=\"job._status == statuses.Exporting\">\n <div class=\"loader\"></div>\n {{dicStatus.get(job._status) | translate}}\n </span>\n\n <a href=\"javascript:;\" (click)=\"download(job)\" class=\"job-success\"\n *ngIf=\"job._status == statuses.Success\">\n <i class=\"fas fa-download\"></i> {{dicStatus.get(job._status) | translate}}\n </a>\n </div>\n </div>\n </tn-custom-scrollbar>\n </div>\n</div>\n",
|
|
38456
|
-
styles: ["::ng-deep .rq-container{width:350px;border:1px solid #3192e1;border-radius:3px;background-color:#fff}::ng-deep .rq-container .rq-header{background-color:#3192e1;padding:5px 10px;display:flex;border-radius:3px 3px 0 0;color:#fff;font-weight:400;font-size:15px}::ng-deep .rq-container .rq-header>div:first-child{flex-grow:1}::ng-deep .rq-container .rq-header>div:last-child>a{font-weight:200;margin-left:10px;color:#fff}::ng-deep .rq-container .rq-header>div:last-child>a>i{font-size:13px}::ng-deep .rq-container .rq-header>div:last-child .ui-chkbox-box{width:14px;height:14px;margin-top:-2px}::ng-deep .rq-container .rq-header>div:last-child .ui-chkbox-icon{font-size:13px;line-height:13px}::ng-deep .rq-container .rq-body .re-job{padding:6px 10px;display:flex;flex-direction:column}::ng-deep .rq-container .rq-body .re-job:first-child{padding-top:6px}::ng-deep .rq-container .rq-body .re-job .re-job-title{display:flex;font-size:13px}::ng-deep .rq-container .rq-body .re-job .re-job-title>div:first-child{flex-grow:1;padding-bottom:3px}::ng-deep .rq-container .rq-body .re-job .re-job-title>div a{color:#3192e1}::ng-deep .rq-container .rq-body .re-job .re-job-result{font-size:11px}::ng-deep .rq-container .rq-body .re-job .re-job-result>span{display:flex;align-items:center;height:20px}::ng-deep .rq-container .rq-body .re-job .re-job-result.job-exporting{color:#3192e1}::ng-deep .rq-container .rq-body .re-job .re-job-result.job-exporting>span>div{margin-right:5px}::ng-deep .rq-container .rq-body .re-job .re-job-result.job-success{color:#1ab91a}::ng-deep .rq-container .rq-body .re-job .re-job-result.job-success>a>i{margin-right:2px}::ng-deep .rq-container .rq-body .re-job .re-job-result.job-error{color:#e95353}::ng-deep .rq-container .rq-body .re-job .re-job-result.job-downloaded{color:#b2b2b2}::ng-deep .loader{border-radius:50%;border:2px solid #bcdbf5;border-top-color:#3192e1;width:12px;height:12px;animation:spin 1s linear infinite;display:inline-block}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}:host{position:absolute;bottom:1px;right:2px;z-index:1000}"]
|
|
38457
|
-
},] }
|
|
38458
|
-
];
|
|
38459
|
-
ReportQueueComponent.ctorParameters = function () { return [
|
|
38460
|
-
{ type: NotifierService },
|
|
38461
|
-
{ type: CommonService },
|
|
38462
|
-
{ type: FileExplorerService },
|
|
38463
|
-
{ type: TemplateService },
|
|
38464
|
-
{ type: SignalRService },
|
|
38465
|
-
{ type: HighPerformanceService },
|
|
38466
|
-
{ type: CrudService }
|
|
38467
|
-
]; };
|
|
38468
|
-
ReportQueueComponent.propDecorators = {
|
|
38469
|
-
parentDataModel: [{ type: i0.Input }],
|
|
38470
|
-
name: [{ type: i0.Input }],
|
|
38471
|
-
header: [{ type: i0.Input }],
|
|
38472
|
-
autoDownload: [{ type: i0.Input }],
|
|
38473
|
-
scrollbar: [{ type: i0.ViewChild, args: ['scrollbar',] }]
|
|
38474
|
-
};
|
|
38475
|
-
|
|
38476
37780
|
var AfterViewCheckedComponent = /** @class */ (function (_super) {
|
|
38477
37781
|
__extends(AfterViewCheckedComponent, _super);
|
|
38478
37782
|
function AfterViewCheckedComponent(injector, ref) {
|
|
@@ -40851,6 +40155,95 @@
|
|
|
40851
40155
|
{ type: NotifierService }
|
|
40852
40156
|
]; };
|
|
40853
40157
|
|
|
40158
|
+
var HighPerformanceService = /** @class */ (function () {
|
|
40159
|
+
function HighPerformanceService(_signalrService, _commonService, _httpClient, _moduleConfigService) {
|
|
40160
|
+
this._signalrService = _signalrService;
|
|
40161
|
+
this._commonService = _commonService;
|
|
40162
|
+
this._httpClient = _httpClient;
|
|
40163
|
+
this._moduleConfigService = _moduleConfigService;
|
|
40164
|
+
}
|
|
40165
|
+
HighPerformanceService.prototype.createProcess = function (queueName, callBackOnMessage, data, returnSequenceNumber) {
|
|
40166
|
+
var _this = this;
|
|
40167
|
+
if (callBackOnMessage === void 0) { callBackOnMessage = null; }
|
|
40168
|
+
if (data === void 0) { data = null; }
|
|
40169
|
+
if (returnSequenceNumber === void 0) { returnSequenceNumber = false; }
|
|
40170
|
+
var internalClientKey = this._commonService.guid();
|
|
40171
|
+
var model = {
|
|
40172
|
+
queueName: queueName,
|
|
40173
|
+
data: data,
|
|
40174
|
+
clientKey: internalClientKey
|
|
40175
|
+
};
|
|
40176
|
+
this._signalrService.start(null, internalClientKey, function (data) {
|
|
40177
|
+
if (callBackOnMessage) {
|
|
40178
|
+
callBackOnMessage(data);
|
|
40179
|
+
}
|
|
40180
|
+
_this._signalrService.unSubscribeViewCode(null, internalClientKey);
|
|
40181
|
+
});
|
|
40182
|
+
return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
|
|
40183
|
+
var highPerformanceEndpoint, rs, _a_1;
|
|
40184
|
+
return __generator(this, function (_b) {
|
|
40185
|
+
switch (_b.label) {
|
|
40186
|
+
case 0:
|
|
40187
|
+
this.env = this._moduleConfigService.getConfig().environment;
|
|
40188
|
+
highPerformanceEndpoint = this.env.apiDomain.highPerformanceEndpoint + "/HighPerformance/DoWork?returnSequenceNumber=" + returnSequenceNumber;
|
|
40189
|
+
_b.label = 1;
|
|
40190
|
+
case 1:
|
|
40191
|
+
_b.trys.push([1, 3, , 4]);
|
|
40192
|
+
return [4 /*yield*/, this._httpClient.post(highPerformanceEndpoint, model).toPromise()];
|
|
40193
|
+
case 2:
|
|
40194
|
+
rs = _b.sent();
|
|
40195
|
+
if (rs.success) {
|
|
40196
|
+
resolve(rs.data);
|
|
40197
|
+
}
|
|
40198
|
+
return [3 /*break*/, 4];
|
|
40199
|
+
case 3:
|
|
40200
|
+
_a_1 = _b.sent();
|
|
40201
|
+
return [3 /*break*/, 4];
|
|
40202
|
+
case 4:
|
|
40203
|
+
resolve(null);
|
|
40204
|
+
return [2 /*return*/];
|
|
40205
|
+
}
|
|
40206
|
+
});
|
|
40207
|
+
}); });
|
|
40208
|
+
};
|
|
40209
|
+
HighPerformanceService.prototype.cancelProcess = function (queueName, uniqueKey) {
|
|
40210
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
40211
|
+
var highPerformanceEndpoint, rs, _a_2;
|
|
40212
|
+
return __generator(this, function (_b) {
|
|
40213
|
+
switch (_b.label) {
|
|
40214
|
+
case 0:
|
|
40215
|
+
_b.trys.push([0, 2, , 3]);
|
|
40216
|
+
highPerformanceEndpoint = this.env.apiDomain.highPerformanceEndpoint + "/HighPerformance/CancelWork?queueName=" + queueName + "&uniqueKey=" + uniqueKey;
|
|
40217
|
+
return [4 /*yield*/, this._httpClient.post(highPerformanceEndpoint, {}).toPromise()];
|
|
40218
|
+
case 1:
|
|
40219
|
+
rs = _b.sent();
|
|
40220
|
+
if (rs.success) {
|
|
40221
|
+
return [2 /*return*/, rs.data];
|
|
40222
|
+
}
|
|
40223
|
+
return [3 /*break*/, 3];
|
|
40224
|
+
case 2:
|
|
40225
|
+
_a_2 = _b.sent();
|
|
40226
|
+
return [3 /*break*/, 3];
|
|
40227
|
+
case 3: return [2 /*return*/, false];
|
|
40228
|
+
}
|
|
40229
|
+
});
|
|
40230
|
+
});
|
|
40231
|
+
};
|
|
40232
|
+
return HighPerformanceService;
|
|
40233
|
+
}());
|
|
40234
|
+
HighPerformanceService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function HighPerformanceService_Factory() { return new HighPerformanceService(i0__namespace.ɵɵinject(SignalRService), i0__namespace.ɵɵinject(CommonService), i0__namespace.ɵɵinject(i1__namespace$1.HttpClient), i0__namespace.ɵɵinject(ModuleConfigService)); }, token: HighPerformanceService, providedIn: "root" });
|
|
40235
|
+
HighPerformanceService.decorators = [
|
|
40236
|
+
{ type: i0.Injectable, args: [{
|
|
40237
|
+
providedIn: 'root'
|
|
40238
|
+
},] }
|
|
40239
|
+
];
|
|
40240
|
+
HighPerformanceService.ctorParameters = function () { return [
|
|
40241
|
+
{ type: SignalRService },
|
|
40242
|
+
{ type: CommonService },
|
|
40243
|
+
{ type: i1$1.HttpClient },
|
|
40244
|
+
{ type: ModuleConfigService }
|
|
40245
|
+
]; };
|
|
40246
|
+
|
|
40854
40247
|
var ImageService = /** @class */ (function () {
|
|
40855
40248
|
function ImageService(_moduleConfigService) {
|
|
40856
40249
|
this._moduleConfigService = _moduleConfigService;
|
|
@@ -41517,6 +40910,221 @@
|
|
|
41517
40910
|
{ type: i0.Injector }
|
|
41518
40911
|
]; };
|
|
41519
40912
|
|
|
40913
|
+
var TemplateService = /** @class */ (function () {
|
|
40914
|
+
function TemplateService(_moduleConfigService, _httpClient, _printService, _fileService, _notifierService, _crudService, _commonService) {
|
|
40915
|
+
this._httpClient = _httpClient;
|
|
40916
|
+
this._printService = _printService;
|
|
40917
|
+
this._fileService = _fileService;
|
|
40918
|
+
this._notifierService = _notifierService;
|
|
40919
|
+
this._crudService = _crudService;
|
|
40920
|
+
this._commonService = _commonService;
|
|
40921
|
+
this._moduleConfig = _moduleConfigService.getConfig();
|
|
40922
|
+
this.environment = this._moduleConfig.environment;
|
|
40923
|
+
this.serviceUri = this.environment.apiDomain.templateEndpoint + "/template";
|
|
40924
|
+
}
|
|
40925
|
+
TemplateService.prototype.laTexToBase64Image = function (laTex, font) {
|
|
40926
|
+
if (font === void 0) { font = 54; }
|
|
40927
|
+
var api = this.serviceUri + "/LatexToBase64";
|
|
40928
|
+
return this._httpClient.post(api, { laTex: laTex, font: font }).toPromise();
|
|
40929
|
+
};
|
|
40930
|
+
/**
|
|
40931
|
+
* Description: Xuất file sử dụng thư viện CX, xuất xong tự động mở popup để lưu file.
|
|
40932
|
+
*/
|
|
40933
|
+
TemplateService.prototype.exportCxExcelByCode = function (model) {
|
|
40934
|
+
var _this = this;
|
|
40935
|
+
var url = this.serviceUri + "/ExportCxExcelByCode";
|
|
40936
|
+
this.setFileInfo(model);
|
|
40937
|
+
return this._httpClient
|
|
40938
|
+
.post(url, model, { responseType: 'blob' })
|
|
40939
|
+
.toPromise()
|
|
40940
|
+
.then(function (res) {
|
|
40941
|
+
FileSaver__namespace.saveAs(res, _this.getFullFileName(model.fileName || model.code));
|
|
40942
|
+
}).catch(function (err) { return __awaiter(_this, void 0, void 0, function () {
|
|
40943
|
+
var errorText;
|
|
40944
|
+
return __generator(this, function (_a) {
|
|
40945
|
+
switch (_a.label) {
|
|
40946
|
+
case 0: return [4 /*yield*/, err.error.text()];
|
|
40947
|
+
case 1:
|
|
40948
|
+
errorText = _a.sent();
|
|
40949
|
+
this._crudService.processErrorResponse(JSON.parse(errorText || ''));
|
|
40950
|
+
return [2 /*return*/];
|
|
40951
|
+
}
|
|
40952
|
+
});
|
|
40953
|
+
}); });
|
|
40954
|
+
};
|
|
40955
|
+
TemplateService.prototype.exportManyCxExcelByCode = function (model) {
|
|
40956
|
+
var _this = this;
|
|
40957
|
+
var url = this.serviceUri + "/ExportManyCxExcelByCode";
|
|
40958
|
+
this.setManyFileInfo(model);
|
|
40959
|
+
return this._httpClient
|
|
40960
|
+
.post(url, model)
|
|
40961
|
+
.toPromise()
|
|
40962
|
+
.then(function (res) {
|
|
40963
|
+
if (res.success) {
|
|
40964
|
+
_this._fileService.downloadFolder(res.data.folderId);
|
|
40965
|
+
}
|
|
40966
|
+
else {
|
|
40967
|
+
_this._crudService.processErrorResponse(res);
|
|
40968
|
+
}
|
|
40969
|
+
}).catch(function (err) { return __awaiter(_this, void 0, void 0, function () {
|
|
40970
|
+
var errorText;
|
|
40971
|
+
return __generator(this, function (_a) {
|
|
40972
|
+
switch (_a.label) {
|
|
40973
|
+
case 0: return [4 /*yield*/, err.error.text()];
|
|
40974
|
+
case 1:
|
|
40975
|
+
errorText = _a.sent();
|
|
40976
|
+
this._crudService.processErrorResponse(JSON.parse(errorText || ''));
|
|
40977
|
+
return [2 /*return*/];
|
|
40978
|
+
}
|
|
40979
|
+
});
|
|
40980
|
+
}); });
|
|
40981
|
+
};
|
|
40982
|
+
TemplateService.prototype.getFullFileName = function (fileName, extension) {
|
|
40983
|
+
if (extension === void 0) { extension = TemplateConstant.EXCEL_EXTENSION; }
|
|
40984
|
+
return "" + fileName + extension;
|
|
40985
|
+
};
|
|
40986
|
+
/**
|
|
40987
|
+
* Description: Export sử dung ClosedXml.Report (Cx) với signalR, sử dụng cho file dữ liệu lớn.
|
|
40988
|
+
* Param: model chứa
|
|
40989
|
+
* - code : code của template cấu hình bên Quản trị > Biểu mẫu > Biểu mẫu excel.
|
|
40990
|
+
* - data : object chứa dữ liệu đã chuyền thành dạng json.
|
|
40991
|
+
* - fileName: tên file sau khi export.
|
|
40992
|
+
* - topic: guid dùng để subscribe.
|
|
40993
|
+
*/
|
|
40994
|
+
TemplateService.prototype.ExportCxExcelByCodeWithSignalR = function (model) {
|
|
40995
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
40996
|
+
var url;
|
|
40997
|
+
return __generator(this, function (_a) {
|
|
40998
|
+
url = this.serviceUri + "/ExportCxExcelByCodeWithSignalR";
|
|
40999
|
+
return [2 /*return*/, this._httpClient.post(url, model)
|
|
41000
|
+
.toPromise()];
|
|
41001
|
+
});
|
|
41002
|
+
});
|
|
41003
|
+
};
|
|
41004
|
+
/**
|
|
41005
|
+
* Description: Export sử dung ClosedXml.Report (Cx) với HighPerformanceService, sử dụng cho file dữ liệu lớn.
|
|
41006
|
+
* Param: model chứa
|
|
41007
|
+
* - code : code của template cấu hình bên Quản trị > Biểu mẫu > Biểu mẫu excel.
|
|
41008
|
+
* - data : object chứa dữ liệu đã chuyền thành dạng json.
|
|
41009
|
+
* - fileName: tên file sau khi export.
|
|
41010
|
+
* - queueName: queue của topic.
|
|
41011
|
+
* - uniqueKey: unique key cho task.
|
|
41012
|
+
*/
|
|
41013
|
+
TemplateService.prototype.ExportCxExcelByCodeWithHPS = function (model) {
|
|
41014
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
41015
|
+
var url;
|
|
41016
|
+
return __generator(this, function (_a) {
|
|
41017
|
+
url = this.serviceUri + "/ExportWithHighPerformanceService";
|
|
41018
|
+
return [2 /*return*/, this._httpClient.post(url, model)
|
|
41019
|
+
.toPromise()];
|
|
41020
|
+
});
|
|
41021
|
+
});
|
|
41022
|
+
};
|
|
41023
|
+
TemplateService.prototype.exportCxExcelByCodePromise = function (model) {
|
|
41024
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
41025
|
+
var url;
|
|
41026
|
+
return __generator(this, function (_a) {
|
|
41027
|
+
url = this.serviceUri + "/ExportCxExcelByCode";
|
|
41028
|
+
return [2 /*return*/, this._httpClient
|
|
41029
|
+
.post(url, model, { responseType: 'blob' })
|
|
41030
|
+
.toPromise()];
|
|
41031
|
+
});
|
|
41032
|
+
});
|
|
41033
|
+
};
|
|
41034
|
+
TemplateService.prototype.fillTemplateByCodeAndGetPdf = function (templateCode, data, onLoadingDataPdf, onEndLoadingDataPdf) {
|
|
41035
|
+
var _this = this;
|
|
41036
|
+
if (onLoadingDataPdf === void 0) { onLoadingDataPdf = null; }
|
|
41037
|
+
if (onEndLoadingDataPdf === void 0) { onEndLoadingDataPdf = null; }
|
|
41038
|
+
var url = this.serviceUri + "/fillWordByTemplateCode/" + templateCode + "?isPrint=true";
|
|
41039
|
+
return this._httpClient
|
|
41040
|
+
.post(url, data)
|
|
41041
|
+
.toPromise().then(function (res) {
|
|
41042
|
+
if (res.data) {
|
|
41043
|
+
_this._printService.printBase64Pdf(res.data, onLoadingDataPdf, onEndLoadingDataPdf);
|
|
41044
|
+
}
|
|
41045
|
+
});
|
|
41046
|
+
};
|
|
41047
|
+
TemplateService.prototype.fillWordByTemplateCodeMultiData = function (templateCode, data, onLoadingDataPdf, onEndLoadingDataPdf) {
|
|
41048
|
+
var _this = this;
|
|
41049
|
+
if (onLoadingDataPdf === void 0) { onLoadingDataPdf = null; }
|
|
41050
|
+
if (onEndLoadingDataPdf === void 0) { onEndLoadingDataPdf = null; }
|
|
41051
|
+
var url = this.serviceUri + "/fillWordByTemplateCodeMultiData/" + templateCode + "?isPrint=true";
|
|
41052
|
+
return this._httpClient
|
|
41053
|
+
.post(url, data)
|
|
41054
|
+
.toPromise().then(function (res) {
|
|
41055
|
+
if (res.data) {
|
|
41056
|
+
_this._printService.printBase64Pdf(res.data, onLoadingDataPdf, onEndLoadingDataPdf);
|
|
41057
|
+
}
|
|
41058
|
+
});
|
|
41059
|
+
};
|
|
41060
|
+
TemplateService.prototype.setFileInfo = function (model) {
|
|
41061
|
+
model.data = model.data ? model.data : JSON.stringify(model.dataObject);
|
|
41062
|
+
delete model.dataObject;
|
|
41063
|
+
};
|
|
41064
|
+
TemplateService.prototype.setManyFileInfo = function (manyModel) {
|
|
41065
|
+
var _this = this;
|
|
41066
|
+
var hasModel = manyModel && manyModel.lstFileInfo && manyModel.lstFileInfo.length;
|
|
41067
|
+
if (!hasModel) {
|
|
41068
|
+
return;
|
|
41069
|
+
}
|
|
41070
|
+
manyModel.lstFileInfo.forEach(function (fileInfo) {
|
|
41071
|
+
_this.setFileInfo(fileInfo);
|
|
41072
|
+
fileInfo.fileName = fileInfo.fileName + "_" + _this._commonService.guid() + "." + TemplateConstant.EXCEL_EXTENSION;
|
|
41073
|
+
});
|
|
41074
|
+
};
|
|
41075
|
+
/**
|
|
41076
|
+
* Export dữ liệu không dùng template.
|
|
41077
|
+
*/
|
|
41078
|
+
TemplateService.prototype.exportCxExcel = function (model) {
|
|
41079
|
+
var _this = this;
|
|
41080
|
+
var url = this.serviceUri + "/ExportCxExcel";
|
|
41081
|
+
return this._httpClient
|
|
41082
|
+
.post(url, model, { responseType: 'blob' })
|
|
41083
|
+
.toPromise()
|
|
41084
|
+
.then(function (res) {
|
|
41085
|
+
FileSaver__namespace.saveAs(res, _this.getFullFileName(model.fileName || 'Export'));
|
|
41086
|
+
}).catch(function (err) { return __awaiter(_this, void 0, void 0, function () {
|
|
41087
|
+
var errorText;
|
|
41088
|
+
return __generator(this, function (_a) {
|
|
41089
|
+
switch (_a.label) {
|
|
41090
|
+
case 0: return [4 /*yield*/, err.error.text()];
|
|
41091
|
+
case 1:
|
|
41092
|
+
errorText = _a.sent();
|
|
41093
|
+
this._crudService.processErrorResponse(JSON.parse(errorText || ''));
|
|
41094
|
+
return [2 /*return*/];
|
|
41095
|
+
}
|
|
41096
|
+
});
|
|
41097
|
+
}); });
|
|
41098
|
+
};
|
|
41099
|
+
TemplateService.prototype.exportCxExcelPromise = function (model) {
|
|
41100
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
41101
|
+
var url;
|
|
41102
|
+
return __generator(this, function (_a) {
|
|
41103
|
+
url = this.serviceUri + "/ExportCxExcel";
|
|
41104
|
+
return [2 /*return*/, this._httpClient
|
|
41105
|
+
.post(url, model, { responseType: 'blob' })
|
|
41106
|
+
.toPromise()];
|
|
41107
|
+
});
|
|
41108
|
+
});
|
|
41109
|
+
};
|
|
41110
|
+
return TemplateService;
|
|
41111
|
+
}());
|
|
41112
|
+
TemplateService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function TemplateService_Factory() { return new TemplateService(i0__namespace.ɵɵinject(ModuleConfigService), i0__namespace.ɵɵinject(i1__namespace$1.HttpClient), i0__namespace.ɵɵinject(PrintService), i0__namespace.ɵɵinject(FileExplorerService), i0__namespace.ɵɵinject(NotifierService), i0__namespace.ɵɵinject(CrudService), i0__namespace.ɵɵinject(CommonService)); }, token: TemplateService, providedIn: "root" });
|
|
41113
|
+
TemplateService.decorators = [
|
|
41114
|
+
{ type: i0.Injectable, args: [{
|
|
41115
|
+
providedIn: 'root'
|
|
41116
|
+
},] }
|
|
41117
|
+
];
|
|
41118
|
+
TemplateService.ctorParameters = function () { return [
|
|
41119
|
+
{ type: ModuleConfigService },
|
|
41120
|
+
{ type: i1$1.HttpClient },
|
|
41121
|
+
{ type: PrintService },
|
|
41122
|
+
{ type: FileExplorerService },
|
|
41123
|
+
{ type: NotifierService },
|
|
41124
|
+
{ type: CrudService },
|
|
41125
|
+
{ type: CommonService }
|
|
41126
|
+
]; };
|
|
41127
|
+
|
|
41520
41128
|
var UniqueNumberService = /** @class */ (function () {
|
|
41521
41129
|
function UniqueNumberService(_http, _moduleConfigService) {
|
|
41522
41130
|
this._http = _http;
|
|
@@ -54323,7 +53931,7 @@
|
|
|
54323
53931
|
VanbanDiPickerComponent,
|
|
54324
53932
|
VanbanDenPickerComponent,
|
|
54325
53933
|
CongViecPickerComponent,
|
|
54326
|
-
ReportQueueComponent,
|
|
53934
|
+
// ReportQueueComponent,
|
|
54327
53935
|
SettingsComponent,
|
|
54328
53936
|
SettingsRowComponent,
|
|
54329
53937
|
ShareLinkByPermissionComponent,
|
|
@@ -54846,7 +54454,6 @@
|
|
|
54846
54454
|
exports.ReferenceTextControlSchema = ReferenceTextControlSchema;
|
|
54847
54455
|
exports.RegexSplitFieldByItem = RegexSplitFieldByItem;
|
|
54848
54456
|
exports.ReponseResult = ReponseResult;
|
|
54849
|
-
exports.ReportQueueComponent = ReportQueueComponent;
|
|
54850
54457
|
exports.RequiredFieldsValidator = RequiredFieldsValidator;
|
|
54851
54458
|
exports.RequiredValidator = RequiredValidator;
|
|
54852
54459
|
exports.RowColorOption = RowColorOption;
|