tnx-shared 5.3.193 → 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.
@@ -37777,703 +37777,6 @@
37777
37777
  cancelButton: [{ type: i0.ViewChild, args: ['cancelButton',] }]
37778
37778
  };
37779
37779
 
37780
- var HighPerformanceService = /** @class */ (function () {
37781
- function HighPerformanceService(_signalrService, _commonService, _httpClient, _moduleConfigService) {
37782
- this._signalrService = _signalrService;
37783
- this._commonService = _commonService;
37784
- this._httpClient = _httpClient;
37785
- this._moduleConfigService = _moduleConfigService;
37786
- }
37787
- HighPerformanceService.prototype.createProcess = function (queueName, callBackOnMessage, data, returnSequenceNumber) {
37788
- var _this = this;
37789
- if (callBackOnMessage === void 0) { callBackOnMessage = null; }
37790
- if (data === void 0) { data = null; }
37791
- if (returnSequenceNumber === void 0) { returnSequenceNumber = false; }
37792
- var internalClientKey = this._commonService.guid();
37793
- var model = {
37794
- queueName: queueName,
37795
- data: data,
37796
- clientKey: internalClientKey
37797
- };
37798
- this._signalrService.start(null, internalClientKey, function (data) {
37799
- if (callBackOnMessage) {
37800
- callBackOnMessage(data);
37801
- }
37802
- _this._signalrService.unSubscribeViewCode(null, internalClientKey);
37803
- });
37804
- return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
37805
- var highPerformanceEndpoint, rs, _a_1;
37806
- return __generator(this, function (_b) {
37807
- switch (_b.label) {
37808
- case 0:
37809
- this.env = this._moduleConfigService.getConfig().environment;
37810
- highPerformanceEndpoint = this.env.apiDomain.highPerformanceEndpoint + "/HighPerformance/DoWork?returnSequenceNumber=" + returnSequenceNumber;
37811
- _b.label = 1;
37812
- case 1:
37813
- _b.trys.push([1, 3, , 4]);
37814
- return [4 /*yield*/, this._httpClient.post(highPerformanceEndpoint, model).toPromise()];
37815
- case 2:
37816
- rs = _b.sent();
37817
- if (rs.success) {
37818
- resolve(rs.data);
37819
- }
37820
- return [3 /*break*/, 4];
37821
- case 3:
37822
- _a_1 = _b.sent();
37823
- return [3 /*break*/, 4];
37824
- case 4:
37825
- resolve(null);
37826
- return [2 /*return*/];
37827
- }
37828
- });
37829
- }); });
37830
- };
37831
- HighPerformanceService.prototype.cancelProcess = function (queueName, uniqueKey) {
37832
- return __awaiter(this, void 0, void 0, function () {
37833
- var highPerformanceEndpoint, rs, _a_2;
37834
- return __generator(this, function (_b) {
37835
- switch (_b.label) {
37836
- case 0:
37837
- _b.trys.push([0, 2, , 3]);
37838
- highPerformanceEndpoint = this.env.apiDomain.highPerformanceEndpoint + "/HighPerformance/CancelWork?queueName=" + queueName + "&uniqueKey=" + uniqueKey;
37839
- return [4 /*yield*/, this._httpClient.post(highPerformanceEndpoint, {}).toPromise()];
37840
- case 1:
37841
- rs = _b.sent();
37842
- if (rs.success) {
37843
- return [2 /*return*/, rs.data];
37844
- }
37845
- return [3 /*break*/, 3];
37846
- case 2:
37847
- _a_2 = _b.sent();
37848
- return [3 /*break*/, 3];
37849
- case 3: return [2 /*return*/, false];
37850
- }
37851
- });
37852
- });
37853
- };
37854
- return HighPerformanceService;
37855
- }());
37856
- 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" });
37857
- HighPerformanceService.decorators = [
37858
- { type: i0.Injectable, args: [{
37859
- providedIn: 'root'
37860
- },] }
37861
- ];
37862
- HighPerformanceService.ctorParameters = function () { return [
37863
- { type: SignalRService },
37864
- { type: CommonService },
37865
- { type: i1$1.HttpClient },
37866
- { type: ModuleConfigService }
37867
- ]; };
37868
-
37869
- var TemplateService = /** @class */ (function () {
37870
- function TemplateService(_moduleConfigService, _httpClient, _printService, _fileService, _notifierService, _crudService, _commonService) {
37871
- this._httpClient = _httpClient;
37872
- this._printService = _printService;
37873
- this._fileService = _fileService;
37874
- this._notifierService = _notifierService;
37875
- this._crudService = _crudService;
37876
- this._commonService = _commonService;
37877
- this._moduleConfig = _moduleConfigService.getConfig();
37878
- this.environment = this._moduleConfig.environment;
37879
- this.serviceUri = this.environment.apiDomain.templateEndpoint + "/template";
37880
- }
37881
- TemplateService.prototype.laTexToBase64Image = function (laTex, font) {
37882
- if (font === void 0) { font = 54; }
37883
- var api = this.serviceUri + "/LatexToBase64";
37884
- return this._httpClient.post(api, { laTex: laTex, font: font }).toPromise();
37885
- };
37886
- /**
37887
- * Description: Xuất file sử dụng thư viện CX, xuất xong tự động mở popup để lưu file.
37888
- */
37889
- TemplateService.prototype.exportCxExcelByCode = function (model) {
37890
- var _this = this;
37891
- var url = this.serviceUri + "/ExportCxExcelByCode";
37892
- this.setFileInfo(model);
37893
- return this._httpClient
37894
- .post(url, model, { responseType: 'blob' })
37895
- .toPromise()
37896
- .then(function (res) {
37897
- FileSaver__namespace.saveAs(res, _this.getFullFileName(model.fileName || model.code));
37898
- }).catch(function (err) { return __awaiter(_this, void 0, void 0, function () {
37899
- var errorText;
37900
- return __generator(this, function (_a) {
37901
- switch (_a.label) {
37902
- case 0: return [4 /*yield*/, err.error.text()];
37903
- case 1:
37904
- errorText = _a.sent();
37905
- this._crudService.processErrorResponse(JSON.parse(errorText || ''));
37906
- return [2 /*return*/];
37907
- }
37908
- });
37909
- }); });
37910
- };
37911
- TemplateService.prototype.exportManyCxExcelByCode = function (model) {
37912
- var _this = this;
37913
- var url = this.serviceUri + "/ExportManyCxExcelByCode";
37914
- this.setManyFileInfo(model);
37915
- return this._httpClient
37916
- .post(url, model)
37917
- .toPromise()
37918
- .then(function (res) {
37919
- if (res.success) {
37920
- _this._fileService.downloadFolder(res.data.folderId);
37921
- }
37922
- else {
37923
- _this._crudService.processErrorResponse(res);
37924
- }
37925
- }).catch(function (err) { return __awaiter(_this, void 0, void 0, function () {
37926
- var errorText;
37927
- return __generator(this, function (_a) {
37928
- switch (_a.label) {
37929
- case 0: return [4 /*yield*/, err.error.text()];
37930
- case 1:
37931
- errorText = _a.sent();
37932
- this._crudService.processErrorResponse(JSON.parse(errorText || ''));
37933
- return [2 /*return*/];
37934
- }
37935
- });
37936
- }); });
37937
- };
37938
- TemplateService.prototype.getFullFileName = function (fileName, extension) {
37939
- if (extension === void 0) { extension = TemplateConstant.EXCEL_EXTENSION; }
37940
- return "" + fileName + extension;
37941
- };
37942
- /**
37943
- * Description: Export sử dung ClosedXml.Report (Cx) với signalR, sử dụng cho file dữ liệu lớn.
37944
- * Param: model chứa
37945
- * - code : code của template cấu hình bên Quản trị > Biểu mẫu > Biểu mẫu excel.
37946
- * - data : object chứa dữ liệu đã chuyền thành dạng json.
37947
- * - fileName: tên file sau khi export.
37948
- * - topic: guid dùng để subscribe.
37949
- */
37950
- TemplateService.prototype.ExportCxExcelByCodeWithSignalR = function (model) {
37951
- return __awaiter(this, void 0, void 0, function () {
37952
- var url;
37953
- return __generator(this, function (_a) {
37954
- url = this.serviceUri + "/ExportCxExcelByCodeWithSignalR";
37955
- return [2 /*return*/, this._httpClient.post(url, model)
37956
- .toPromise()];
37957
- });
37958
- });
37959
- };
37960
- /**
37961
- * Description: Export sử dung ClosedXml.Report (Cx) với HighPerformanceService, sử dụng cho file dữ liệu lớn.
37962
- * Param: model chứa
37963
- * - code : code của template cấu hình bên Quản trị > Biểu mẫu > Biểu mẫu excel.
37964
- * - data : object chứa dữ liệu đã chuyền thành dạng json.
37965
- * - fileName: tên file sau khi export.
37966
- * - queueName: queue của topic.
37967
- * - uniqueKey: unique key cho task.
37968
- */
37969
- TemplateService.prototype.ExportCxExcelByCodeWithHPS = function (model) {
37970
- return __awaiter(this, void 0, void 0, function () {
37971
- var url;
37972
- return __generator(this, function (_a) {
37973
- url = this.serviceUri + "/ExportWithHighPerformanceService";
37974
- return [2 /*return*/, this._httpClient.post(url, model)
37975
- .toPromise()];
37976
- });
37977
- });
37978
- };
37979
- TemplateService.prototype.exportCxExcelByCodePromise = function (model) {
37980
- return __awaiter(this, void 0, void 0, function () {
37981
- var url;
37982
- return __generator(this, function (_a) {
37983
- url = this.serviceUri + "/ExportCxExcelByCode";
37984
- return [2 /*return*/, this._httpClient
37985
- .post(url, model, { responseType: 'blob' })
37986
- .toPromise()];
37987
- });
37988
- });
37989
- };
37990
- TemplateService.prototype.fillTemplateByCodeAndGetPdf = function (templateCode, data, onLoadingDataPdf, onEndLoadingDataPdf) {
37991
- var _this = this;
37992
- if (onLoadingDataPdf === void 0) { onLoadingDataPdf = null; }
37993
- if (onEndLoadingDataPdf === void 0) { onEndLoadingDataPdf = null; }
37994
- var url = this.serviceUri + "/fillWordByTemplateCode/" + templateCode + "?isPrint=true";
37995
- return this._httpClient
37996
- .post(url, data)
37997
- .toPromise().then(function (res) {
37998
- if (res.data) {
37999
- _this._printService.printBase64Pdf(res.data, onLoadingDataPdf, onEndLoadingDataPdf);
38000
- }
38001
- });
38002
- };
38003
- TemplateService.prototype.fillWordByTemplateCodeMultiData = function (templateCode, data, onLoadingDataPdf, onEndLoadingDataPdf) {
38004
- var _this = this;
38005
- if (onLoadingDataPdf === void 0) { onLoadingDataPdf = null; }
38006
- if (onEndLoadingDataPdf === void 0) { onEndLoadingDataPdf = null; }
38007
- var url = this.serviceUri + "/fillWordByTemplateCodeMultiData/" + templateCode + "?isPrint=true";
38008
- return this._httpClient
38009
- .post(url, data)
38010
- .toPromise().then(function (res) {
38011
- if (res.data) {
38012
- _this._printService.printBase64Pdf(res.data, onLoadingDataPdf, onEndLoadingDataPdf);
38013
- }
38014
- });
38015
- };
38016
- TemplateService.prototype.setFileInfo = function (model) {
38017
- model.data = model.data ? model.data : JSON.stringify(model.dataObject);
38018
- delete model.dataObject;
38019
- };
38020
- TemplateService.prototype.setManyFileInfo = function (manyModel) {
38021
- var _this = this;
38022
- var hasModel = manyModel && manyModel.lstFileInfo && manyModel.lstFileInfo.length;
38023
- if (!hasModel) {
38024
- return;
38025
- }
38026
- manyModel.lstFileInfo.forEach(function (fileInfo) {
38027
- _this.setFileInfo(fileInfo);
38028
- fileInfo.fileName = fileInfo.fileName + "_" + _this._commonService.guid() + "." + TemplateConstant.EXCEL_EXTENSION;
38029
- });
38030
- };
38031
- /**
38032
- * Export dữ liệu không dùng template.
38033
- */
38034
- TemplateService.prototype.exportCxExcel = function (model) {
38035
- var _this = this;
38036
- var url = this.serviceUri + "/ExportCxExcel";
38037
- return this._httpClient
38038
- .post(url, model, { responseType: 'blob' })
38039
- .toPromise()
38040
- .then(function (res) {
38041
- FileSaver__namespace.saveAs(res, _this.getFullFileName(model.fileName || 'Export'));
38042
- }).catch(function (err) { return __awaiter(_this, void 0, void 0, function () {
38043
- var errorText;
38044
- return __generator(this, function (_a) {
38045
- switch (_a.label) {
38046
- case 0: return [4 /*yield*/, err.error.text()];
38047
- case 1:
38048
- errorText = _a.sent();
38049
- this._crudService.processErrorResponse(JSON.parse(errorText || ''));
38050
- return [2 /*return*/];
38051
- }
38052
- });
38053
- }); });
38054
- };
38055
- TemplateService.prototype.exportCxExcelPromise = function (model) {
38056
- return __awaiter(this, void 0, void 0, function () {
38057
- var url;
38058
- return __generator(this, function (_a) {
38059
- url = this.serviceUri + "/ExportCxExcel";
38060
- return [2 /*return*/, this._httpClient
38061
- .post(url, model, { responseType: 'blob' })
38062
- .toPromise()];
38063
- });
38064
- });
38065
- };
38066
- return TemplateService;
38067
- }());
38068
- 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" });
38069
- TemplateService.decorators = [
38070
- { type: i0.Injectable, args: [{
38071
- providedIn: 'root'
38072
- },] }
38073
- ];
38074
- TemplateService.ctorParameters = function () { return [
38075
- { type: ModuleConfigService },
38076
- { type: i1$1.HttpClient },
38077
- { type: PrintService },
38078
- { type: FileExplorerService },
38079
- { type: NotifierService },
38080
- { type: CrudService },
38081
- { type: CommonService }
38082
- ]; };
38083
-
38084
- var JobItem = /** @class */ (function () {
38085
- function JobItem(code, data, fileName, status) {
38086
- if (fileName === void 0) { fileName = 'BaoCao'; }
38087
- if (status === void 0) { status = REPORT_QUEUE_CONSTANT.statuses.Waiting; }
38088
- // Loại export.
38089
- this._type = JobTypes.SingnalR;
38090
- this._code = code;
38091
- var datepipe = new i3.DatePipe('en-US');
38092
- var formattedDate = datepipe.transform(new Date(), 'ddMMyyyy_hhmmss');
38093
- this._fileName = fileName + "_" + formattedDate + TemplateConstant.EXCEL_EXTENSION;
38094
- this._data = data || {};
38095
- this._status = status;
38096
- }
38097
- return JobItem;
38098
- }());
38099
- var REPORT_QUEUE_CONSTANT = /** @class */ (function () {
38100
- function REPORT_QUEUE_CONSTANT() {
38101
- }
38102
- return REPORT_QUEUE_CONSTANT;
38103
- }());
38104
- REPORT_QUEUE_CONSTANT.statuses = {
38105
- Waiting: 1,
38106
- Exporting: 2,
38107
- Success: 3,
38108
- Error: 4,
38109
- Downloaded: 5
38110
- };
38111
- REPORT_QUEUE_CONSTANT.dicStatus = new SimpleDictionary([
38112
- new SimpleDicItem(REPORT_QUEUE_CONSTANT.statuses.Waiting, 'Chờ để xử lý'),
38113
- new SimpleDicItem(REPORT_QUEUE_CONSTANT.statuses.Exporting, 'Đang xử lý'),
38114
- new SimpleDicItem(REPORT_QUEUE_CONSTANT.statuses.Success, 'Tải xuống'),
38115
- new SimpleDicItem(REPORT_QUEUE_CONSTANT.statuses.Error, 'Xuất file chưa thành công'),
38116
- new SimpleDicItem(REPORT_QUEUE_CONSTANT.statuses.Downloaded, 'Đã tải'),
38117
- ]);
38118
- var JobTypes;
38119
- (function (JobTypes) {
38120
- JobTypes[JobTypes["Normal"] = 1] = "Normal";
38121
- JobTypes[JobTypes["SingnalR"] = 2] = "SingnalR";
38122
- 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.
38123
- })(JobTypes || (JobTypes = {}));
38124
- var ExportJob = /** @class */ (function () {
38125
- function ExportJob(templateCode, // code template cấu hình bên quản trị
38126
- dataPromise, // promise dùng để lấy dữ liệu, trả về dạng ResponseResult
38127
- fileName, // tên của file được lưu
38128
- rootName, // tên thuộc tính của lst dữ liệu ngoài cùng
38129
- cb, // dùng để xử lý dữ liệu sau khi lấy xong
38130
- type // Loại export.
38131
- ) {
38132
- if (rootName === void 0) { rootName = ''; }
38133
- if (cb === void 0) { cb = null; }
38134
- if (type === void 0) { type = JobTypes.Normal; }
38135
- this.templateCode = templateCode;
38136
- this.dataPromise = dataPromise;
38137
- this.fileName = fileName;
38138
- this.rootName = rootName;
38139
- this.cb = cb;
38140
- this.type = type;
38141
- }
38142
- return ExportJob;
38143
- }());
38144
-
38145
- var ReportQueueComponent = /** @class */ (function () {
38146
- function ReportQueueComponent(_notifierService, _commonService, _fileService, _tempateService, _signalRService, _highPerformanceService, _crudService) {
38147
- this._notifierService = _notifierService;
38148
- this._commonService = _commonService;
38149
- this._fileService = _fileService;
38150
- this._tempateService = _tempateService;
38151
- this._signalRService = _signalRService;
38152
- this._highPerformanceService = _highPerformanceService;
38153
- this._crudService = _crudService;
38154
- this.name = 'reportQueue';
38155
- this.header = 'Xuất báo cáo';
38156
- this.autoDownload = false;
38157
- this.maxNameLength = 40;
38158
- this.expand = true;
38159
- this.queueName = 'REPORT_QUEUE';
38160
- this.hub = 'CommonHub';
38161
- this.dicStatus = REPORT_QUEUE_CONSTANT.dicStatus;
38162
- this.statuses = REPORT_QUEUE_CONSTANT.statuses;
38163
- this._queue = [];
38164
- this.maxHeight = 200;
38165
- this.itemHeight = 50;
38166
- this.popupHeight = this.itemHeight;
38167
- }
38168
- ReportQueueComponent.prototype.ngOnInit = function () {
38169
- if (this.parentDataModel && this.name) {
38170
- this.parentDataModel[this.name] = this;
38171
- }
38172
- };
38173
- ReportQueueComponent.prototype.toggleExpand = function () {
38174
- this.expand = !this.expand;
38175
- };
38176
- /**
38177
- * Thêm job vào để thực hiện
38178
- */
38179
- ReportQueueComponent.prototype.addJob = function (exportJob) {
38180
- return __awaiter(this, void 0, void 0, function () {
38181
- var foundIndex, job, rsData;
38182
- var _this = this;
38183
- return __generator(this, function (_a) {
38184
- switch (_a.label) {
38185
- case 0:
38186
- foundIndex = this._queue.findIndex(function (job) { return job._code == exportJob.templateCode && job._status == _this.statuses.Exporting; });
38187
- if (foundIndex !== -1) {
38188
- this._notifierService.showWarning("File cùng loại đang được xử lý, thử lại sau khi xử lý xong!");
38189
- return [2 /*return*/];
38190
- }
38191
- job = new JobItem(exportJob.templateCode, {}, exportJob.fileName || exportJob.templateCode, this.statuses.Exporting);
38192
- this._queue.push(job);
38193
- this.updatePopupHeight();
38194
- setTimeout(function () {
38195
- _this.scrollbar.scrollToBottom();
38196
- }, 100);
38197
- return [4 /*yield*/, exportJob.dataPromise];
38198
- case 1:
38199
- rsData = _a.sent();
38200
- if (rsData.data == null) {
38201
- job._status = this.statuses.Error;
38202
- return [2 /*return*/, this._crudService.processErrorResponse(rsData)];
38203
- }
38204
- if (exportJob.cb) {
38205
- job._data = exportJob.cb(rsData.data);
38206
- }
38207
- else if (exportJob.rootName) {
38208
- job._data[exportJob.rootName] = rsData.data;
38209
- }
38210
- else {
38211
- job._data = rsData.data;
38212
- }
38213
- switch (exportJob.type) {
38214
- case JobTypes.Normal:
38215
- this.Export(job);
38216
- break;
38217
- case JobTypes.SingnalR:
38218
- this.ExportWithSignalR(job);
38219
- break;
38220
- case JobTypes.Many:
38221
- break;
38222
- }
38223
- return [2 /*return*/];
38224
- }
38225
- });
38226
- });
38227
- };
38228
- /**
38229
- * Thêm job vào để thực hiện
38230
- * - templateCode: code template cấu hình bên quản trị
38231
- * - data: dữ liệu export
38232
- * - fileName: tên của file được lưu
38233
- * - useSignalR: thay vì gọi request và chờ đến khi thực hiện xong
38234
- * trả về binaryFile thì tạo tiến trình riêng để export, và dùng signalR thông
38235
- * báo kết quả export, trả về fileId để tải.
38236
- */
38237
- ReportQueueComponent.prototype.addJobWithData = function (templateCode, data, fileName, useSignalR) {
38238
- if (useSignalR === void 0) { useSignalR = false; }
38239
- return __awaiter(this, void 0, void 0, function () {
38240
- var foundIndex, job;
38241
- var _this = this;
38242
- return __generator(this, function (_a) {
38243
- foundIndex = this._queue.findIndex(function (job) { return job._code == templateCode && job._status == _this.statuses.Exporting; });
38244
- if (foundIndex !== -1) {
38245
- this._notifierService.showWarning("File cùng loại đang được xử lý, thử lại sau khi xử lý xong!");
38246
- return [2 /*return*/];
38247
- }
38248
- job = new JobItem(templateCode, data, fileName || templateCode, this.statuses.Exporting);
38249
- this._queue.push(job);
38250
- if (useSignalR) {
38251
- this.ExportWithSignalR(job);
38252
- }
38253
- else {
38254
- this.Export(job);
38255
- }
38256
- return [2 /*return*/];
38257
- });
38258
- });
38259
- };
38260
- ReportQueueComponent.prototype.Export = function (job) {
38261
- return __awaiter(this, void 0, void 0, function () {
38262
- var _this = this;
38263
- return __generator(this, function (_a) {
38264
- this._tempateService.exportCxExcelByCodePromise({ code: job._code, data: JSON.stringify(job._data), fileName: job._fileName })
38265
- .then(function (file) {
38266
- job._status = _this.statuses.Success;
38267
- job._binaryFile = file;
38268
- if (_this.autoDownload) {
38269
- _this.download(job);
38270
- }
38271
- }).catch(function (err) { return __awaiter(_this, void 0, void 0, function () {
38272
- var errorText;
38273
- return __generator(this, function (_a) {
38274
- switch (_a.label) {
38275
- case 0:
38276
- job._status = this.statuses.Error;
38277
- return [4 /*yield*/, err.error.text()];
38278
- case 1:
38279
- errorText = _a.sent();
38280
- this._crudService.processErrorResponse(JSON.parse(errorText || ''));
38281
- return [2 /*return*/];
38282
- }
38283
- });
38284
- }); });
38285
- return [2 /*return*/];
38286
- });
38287
- });
38288
- };
38289
- ReportQueueComponent.prototype.ExportWithSignalR = function (job) {
38290
- return __awaiter(this, void 0, void 0, function () {
38291
- var topic;
38292
- var _this = this;
38293
- return __generator(this, function (_a) {
38294
- topic = this._commonService.guid();
38295
- job._uniqueKey = topic;
38296
- this._signalRService.start(this.hub, topic, function (message) {
38297
- var rs = JSON.parse(message);
38298
- if (rs.success) {
38299
- job._status = _this.statuses.Success;
38300
- job._fileId = rs.data;
38301
- if (_this.autoDownload) {
38302
- _this.download(job);
38303
- }
38304
- }
38305
- else {
38306
- job._status = _this.statuses.Error;
38307
- _this._crudService.processErrorResponse(rs);
38308
- }
38309
- });
38310
- this._tempateService.ExportCxExcelByCodeWithSignalR({ code: job._code, data: JSON.stringify(job._data), fileName: job._fileName, topic: topic })
38311
- .then(function (rs) {
38312
- if (!rs.success) {
38313
- job._status = _this.statuses.Error;
38314
- _this._crudService.processErrorResponse(rs);
38315
- }
38316
- }).catch(function (err) { return __awaiter(_this, void 0, void 0, function () {
38317
- return __generator(this, function (_a) {
38318
- job._status = this.statuses.Error;
38319
- this._crudService.processErrorResponse(err.error);
38320
- return [2 /*return*/];
38321
- });
38322
- }); });
38323
- ;
38324
- return [2 /*return*/];
38325
- });
38326
- });
38327
- };
38328
- ReportQueueComponent.prototype.ExportCxExcelByCodeWithHPS = function (job) {
38329
- return __awaiter(this, void 0, void 0, function () {
38330
- var _this = this;
38331
- return __generator(this, function (_a) {
38332
- this._highPerformanceService.createProcess(this.queueName, function (arrMessage) {
38333
- var message = arrMessage.pop();
38334
- var rs = JSON.parse(message);
38335
- if (rs.success) {
38336
- job._status = _this.statuses.Success;
38337
- job._fileId = rs.data;
38338
- if (_this.autoDownload) {
38339
- _this._fileService.downloadFile(job._fileId);
38340
- job._status = _this.statuses.Downloaded;
38341
- job._fileId = null;
38342
- }
38343
- }
38344
- else {
38345
- job._status = _this.statuses.Error;
38346
- _this._crudService.processErrorResponse(rs);
38347
- }
38348
- }).then(function (rs) {
38349
- job._uniqueKey = rs;
38350
- _this._tempateService.ExportCxExcelByCodeWithHPS({
38351
- code: job._code,
38352
- data: JSON.stringify(job._data),
38353
- fileName: job._fileName,
38354
- topic: _this.queueName,
38355
- uniqueKey: job._uniqueKey
38356
- }).then(function (rs) {
38357
- if (!rs.success) {
38358
- job._status = _this.statuses.Error;
38359
- _this._crudService.processErrorResponse(rs);
38360
- }
38361
- }, function (err) {
38362
- job._status = _this.statuses.Error;
38363
- console.log("Lỗi gọi api server export");
38364
- });
38365
- }, function (err) {
38366
- job._status = _this.statuses.Error;
38367
- console.log("Lỗi gọi HPS service :(");
38368
- });
38369
- return [2 /*return*/];
38370
- });
38371
- });
38372
- };
38373
- ReportQueueComponent.prototype.download = function (job) {
38374
- if (job._status == this.statuses.Downloaded) {
38375
- return;
38376
- }
38377
- if (job._fileId) {
38378
- this._fileService.downloadFile(job._fileId, false, job._fileName);
38379
- }
38380
- else if (job._binaryFile) {
38381
- FileSaver__namespace.saveAs(job._binaryFile, job._fileName);
38382
- }
38383
- job._status = this.statuses.Downloaded;
38384
- job._binaryFile = null;
38385
- job._fileId = null;
38386
- };
38387
- ReportQueueComponent.prototype.showQueue = function () {
38388
- var show = this._queue && this._queue.length > 0;
38389
- return show;
38390
- };
38391
- ReportQueueComponent.prototype.getName = function (job) {
38392
- var name = job._fileName.length > this.maxNameLength ? job._fileName.substr(0, this.maxNameLength - 10) + "[...]" + TemplateConstant.EXCEL_EXTENSION : job._fileName;
38393
- return name;
38394
- };
38395
- ReportQueueComponent.prototype.cancelJob = function (job) {
38396
- var _this = this;
38397
- var foundIndex = this._queue.findIndex(function (j) { return j._code == job._code; });
38398
- if (foundIndex == -1) {
38399
- return;
38400
- }
38401
- var foundJob = this._queue[foundIndex];
38402
- if (foundJob._status == this.statuses.Exporting) {
38403
- this._notifierService
38404
- .showConfirm('File này đang được xử lý. Bạn có muốn dừng lại?', 'Hủy xuất file')
38405
- .then(function (rs) {
38406
- if (!rs) {
38407
- return;
38408
- }
38409
- var needUnsubscribe = foundJob._type == JobTypes.SingnalR && foundJob._uniqueKey;
38410
- if (needUnsubscribe) {
38411
- _this._signalRService.unSubscribeViewCode(foundJob._uniqueKey, _this.hub);
38412
- }
38413
- _this._queue.splice(foundIndex, 1);
38414
- _this.updatePopupHeight();
38415
- });
38416
- }
38417
- else if (foundJob._status != this.statuses.Exporting) {
38418
- this._queue.splice(foundIndex, 1);
38419
- this.updatePopupHeight();
38420
- }
38421
- };
38422
- ReportQueueComponent.prototype.close = function () {
38423
- var _this = this;
38424
- var hasExporting = this._queue && this._queue.filter(function (item) { return item._status == _this.statuses.Exporting; }).length > 0;
38425
- if (hasExporting) {
38426
- this._notifierService
38427
- .showConfirm('Có file đang được xử lý. Bạn có muốn dừng lại?', 'Hủy xuất file')
38428
- .then(function (rs) {
38429
- if (!rs) {
38430
- return;
38431
- }
38432
- var needUnsubscribe = false;
38433
- _this._queue.forEach(function (job) {
38434
- needUnsubscribe = job._type == JobTypes.SingnalR && job._uniqueKey;
38435
- if (needUnsubscribe) {
38436
- _this._signalRService.unSubscribeViewCode(job._uniqueKey, _this.hub);
38437
- }
38438
- });
38439
- _this._queue = [];
38440
- _this.updatePopupHeight();
38441
- });
38442
- }
38443
- else {
38444
- this._queue = [];
38445
- }
38446
- };
38447
- ReportQueueComponent.prototype.updatePopupHeight = function () {
38448
- var height = (this._queue || []).length * this.itemHeight;
38449
- this.popupHeight = height > this.maxHeight ? this.maxHeight : height;
38450
- };
38451
- return ReportQueueComponent;
38452
- }());
38453
- ReportQueueComponent.decorators = [
38454
- { type: i0.Component, args: [{
38455
- selector: 'report-queue',
38456
- 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",
38457
- 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}"]
38458
- },] }
38459
- ];
38460
- ReportQueueComponent.ctorParameters = function () { return [
38461
- { type: NotifierService },
38462
- { type: CommonService },
38463
- { type: FileExplorerService },
38464
- { type: TemplateService },
38465
- { type: SignalRService },
38466
- { type: HighPerformanceService },
38467
- { type: CrudService }
38468
- ]; };
38469
- ReportQueueComponent.propDecorators = {
38470
- parentDataModel: [{ type: i0.Input }],
38471
- name: [{ type: i0.Input }],
38472
- header: [{ type: i0.Input }],
38473
- autoDownload: [{ type: i0.Input }],
38474
- scrollbar: [{ type: i0.ViewChild, args: ['scrollbar',] }]
38475
- };
38476
-
38477
37780
  var AfterViewCheckedComponent = /** @class */ (function (_super) {
38478
37781
  __extends(AfterViewCheckedComponent, _super);
38479
37782
  function AfterViewCheckedComponent(injector, ref) {
@@ -40837,19 +40140,108 @@
40837
40140
  });
40838
40141
  }); });
40839
40142
  };
40840
- return GuardService;
40143
+ return GuardService;
40144
+ }());
40145
+ GuardService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function GuardService_Factory() { return new GuardService(i0__namespace.ɵɵinject(UserService), i0__namespace.ɵɵinject(PermissionService), i0__namespace.ɵɵinject(i3__namespace$1.Router), i0__namespace.ɵɵinject(NotifierService)); }, token: GuardService, providedIn: "root" });
40146
+ GuardService.decorators = [
40147
+ { type: i0.Injectable, args: [{
40148
+ providedIn: 'root'
40149
+ },] }
40150
+ ];
40151
+ GuardService.ctorParameters = function () { return [
40152
+ { type: UserService },
40153
+ { type: PermissionService },
40154
+ { type: i3$1.Router },
40155
+ { type: NotifierService }
40156
+ ]; };
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;
40841
40233
  }());
40842
- GuardService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function GuardService_Factory() { return new GuardService(i0__namespace.ɵɵinject(UserService), i0__namespace.ɵɵinject(PermissionService), i0__namespace.ɵɵinject(i3__namespace$1.Router), i0__namespace.ɵɵinject(NotifierService)); }, token: GuardService, providedIn: "root" });
40843
- GuardService.decorators = [
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 = [
40844
40236
  { type: i0.Injectable, args: [{
40845
40237
  providedIn: 'root'
40846
40238
  },] }
40847
40239
  ];
40848
- GuardService.ctorParameters = function () { return [
40849
- { type: UserService },
40850
- { type: PermissionService },
40851
- { type: i3$1.Router },
40852
- { type: NotifierService }
40240
+ HighPerformanceService.ctorParameters = function () { return [
40241
+ { type: SignalRService },
40242
+ { type: CommonService },
40243
+ { type: i1$1.HttpClient },
40244
+ { type: ModuleConfigService }
40853
40245
  ]; };
40854
40246
 
40855
40247
  var ImageService = /** @class */ (function () {
@@ -41518,6 +40910,221 @@
41518
40910
  { type: i0.Injector }
41519
40911
  ]; };
41520
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
+
41521
41128
  var UniqueNumberService = /** @class */ (function () {
41522
41129
  function UniqueNumberService(_http, _moduleConfigService) {
41523
41130
  this._http = _http;
@@ -54324,7 +53931,7 @@
54324
53931
  VanbanDiPickerComponent,
54325
53932
  VanbanDenPickerComponent,
54326
53933
  CongViecPickerComponent,
54327
- ReportQueueComponent,
53934
+ // ReportQueueComponent,
54328
53935
  SettingsComponent,
54329
53936
  SettingsRowComponent,
54330
53937
  ShareLinkByPermissionComponent,
@@ -54847,7 +54454,6 @@
54847
54454
  exports.ReferenceTextControlSchema = ReferenceTextControlSchema;
54848
54455
  exports.RegexSplitFieldByItem = RegexSplitFieldByItem;
54849
54456
  exports.ReponseResult = ReponseResult;
54850
- exports.ReportQueueComponent = ReportQueueComponent;
54851
54457
  exports.RequiredFieldsValidator = RequiredFieldsValidator;
54852
54458
  exports.RequiredValidator = RequiredValidator;
54853
54459
  exports.RowColorOption = RowColorOption;