tnx-shared 5.3.254 → 5.3.255
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 +1142 -1138
- 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/base/list-component-base.d.ts +5 -5
- package/classes/base/list-component-base.d.ts.map +1 -1
- package/esm2015/classes/base/list-component-base.js +18 -14
- package/fesm2015/tnx-shared.js +1040 -1036
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
package/fesm2015/tnx-shared.js
CHANGED
|
@@ -16179,6 +16179,253 @@ DataFormBase.propDecorators = {
|
|
|
16179
16179
|
onDataBinded: [{ type: Output }]
|
|
16180
16180
|
};
|
|
16181
16181
|
|
|
16182
|
+
class CauHinhWorkflowService extends BaseService {
|
|
16183
|
+
constructor(http, injector, _moduleConfigService) {
|
|
16184
|
+
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.congviecEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/CauHinhWorkflow`);
|
|
16185
|
+
this._moduleConfigService = _moduleConfigService;
|
|
16186
|
+
this.serviceCode = 'congviec';
|
|
16187
|
+
this.entityName = 'CauHinhWorkflow';
|
|
16188
|
+
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.congviecEndpoint;
|
|
16189
|
+
}
|
|
16190
|
+
}
|
|
16191
|
+
CauHinhWorkflowService.ɵprov = i0.ɵɵdefineInjectable({ factory: function CauHinhWorkflowService_Factory() { return new CauHinhWorkflowService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService)); }, token: CauHinhWorkflowService, providedIn: "root" });
|
|
16192
|
+
CauHinhWorkflowService.decorators = [
|
|
16193
|
+
{ type: Injectable, args: [{
|
|
16194
|
+
providedIn: 'root'
|
|
16195
|
+
},] }
|
|
16196
|
+
];
|
|
16197
|
+
CauHinhWorkflowService.ctorParameters = () => [
|
|
16198
|
+
{ type: HttpClient },
|
|
16199
|
+
{ type: Injector },
|
|
16200
|
+
{ type: ModuleConfigService }
|
|
16201
|
+
];
|
|
16202
|
+
|
|
16203
|
+
class StateMachinesService extends BaseService {
|
|
16204
|
+
constructor(http, injector, _moduleConfigService) {
|
|
16205
|
+
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.workflowEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/StateMachines`);
|
|
16206
|
+
this._moduleConfigService = _moduleConfigService;
|
|
16207
|
+
this.entityName = 'StateMachines';
|
|
16208
|
+
this.serviceCode = 'workflow';
|
|
16209
|
+
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.workflowEndpoint;
|
|
16210
|
+
}
|
|
16211
|
+
changeState(itemWorkflowHistory) {
|
|
16212
|
+
return this.defaultPost(`${this.serviceUri}/ChangeState`, itemWorkflowHistory);
|
|
16213
|
+
}
|
|
16214
|
+
rollback(rowData) {
|
|
16215
|
+
return this.defaultPost(`${this.serviceUri}/Rollback/${rowData.__workflowCode}/${rowData.id}`, {});
|
|
16216
|
+
}
|
|
16217
|
+
getUserInProcessForm(workflowCode, stateCode, actionCode, itemId) {
|
|
16218
|
+
return this.defaultPost(`${this.serviceUri}/GetUserInProcessForm/${workflowCode}/${stateCode}/${actionCode}/${itemId}`, {});
|
|
16219
|
+
}
|
|
16220
|
+
}
|
|
16221
|
+
StateMachinesService.ɵprov = i0.ɵɵdefineInjectable({ factory: function StateMachinesService_Factory() { return new StateMachinesService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService)); }, token: StateMachinesService, providedIn: "root" });
|
|
16222
|
+
StateMachinesService.decorators = [
|
|
16223
|
+
{ type: Injectable, args: [{
|
|
16224
|
+
providedIn: 'root'
|
|
16225
|
+
},] }
|
|
16226
|
+
];
|
|
16227
|
+
StateMachinesService.ctorParameters = () => [
|
|
16228
|
+
{ type: HttpClient },
|
|
16229
|
+
{ type: Injector },
|
|
16230
|
+
{ type: ModuleConfigService }
|
|
16231
|
+
];
|
|
16232
|
+
|
|
16233
|
+
class DmLoaiCongViecService extends BaseService {
|
|
16234
|
+
constructor(http, injector, _moduleConfigService) {
|
|
16235
|
+
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.congviecEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/DM_LoaiCongViec`);
|
|
16236
|
+
this._moduleConfigService = _moduleConfigService;
|
|
16237
|
+
this.serviceCode = 'congviec';
|
|
16238
|
+
this.entityName = 'DM_LoaiCongViec';
|
|
16239
|
+
this.dicLoaiCongViec = {};
|
|
16240
|
+
this.keyIdLoaiCongViecRoot = 'root';
|
|
16241
|
+
this.getWorkflowSettingByIdLoaiCongViec = (idLoaiCongViec) => __awaiter(this, void 0, void 0, function* () {
|
|
16242
|
+
if (!this.dicWorkflowByLoaiCongViec) {
|
|
16243
|
+
yield this.getDatasourceWorkflowCongViec();
|
|
16244
|
+
}
|
|
16245
|
+
if (!idLoaiCongViec) {
|
|
16246
|
+
return this.dicWorkflowByLoaiCongViec[this.keyIdLoaiCongViecRoot];
|
|
16247
|
+
}
|
|
16248
|
+
let result = this.dicWorkflowByLoaiCongViec[idLoaiCongViec];
|
|
16249
|
+
if (result)
|
|
16250
|
+
return result;
|
|
16251
|
+
const idLoaiCongViecs = yield this.getIdLoaiCongViecs(idLoaiCongViec);
|
|
16252
|
+
if (!Array.isArray(idLoaiCongViecs))
|
|
16253
|
+
return null;
|
|
16254
|
+
if (idLoaiCongViecs.length > 1) {
|
|
16255
|
+
for (let i = idLoaiCongViecs.length - 2; i >= 0; i--) {
|
|
16256
|
+
result = this.dicWorkflowByLoaiCongViec[idLoaiCongViecs[i]];
|
|
16257
|
+
if (result)
|
|
16258
|
+
return result;
|
|
16259
|
+
}
|
|
16260
|
+
}
|
|
16261
|
+
if (!result) {
|
|
16262
|
+
result = this.dicWorkflowByLoaiCongViec[this.keyIdLoaiCongViecRoot];
|
|
16263
|
+
}
|
|
16264
|
+
return result;
|
|
16265
|
+
});
|
|
16266
|
+
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.congviecEndpoint;
|
|
16267
|
+
}
|
|
16268
|
+
getDatasourceWorkflowCongViec() {
|
|
16269
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16270
|
+
if (!this.dicWorkflowByLoaiCongViec) {
|
|
16271
|
+
this.dicWorkflowByLoaiCongViec = {};
|
|
16272
|
+
}
|
|
16273
|
+
const cauHinhWorkflowService = this._injector.get(CauHinhWorkflowService);
|
|
16274
|
+
const cauHinhWorkflows = (yield cauHinhWorkflowService.getAll([], 'idLoaiCongViec,workflowCodes,workflowCode')).data;
|
|
16275
|
+
const notifierService = this._injector.get(NotifierService);
|
|
16276
|
+
if (cauHinhWorkflows == null) {
|
|
16277
|
+
notifierService.showWarning('Dịch vụ workflow không phản hồi');
|
|
16278
|
+
return [];
|
|
16279
|
+
}
|
|
16280
|
+
const workflowCodes = [];
|
|
16281
|
+
cauHinhWorkflows.forEach(itemWorkflowSetting => {
|
|
16282
|
+
if (itemWorkflowSetting.workflowCodes && !Array.isArray(itemWorkflowSetting.workflowCodes)) {
|
|
16283
|
+
itemWorkflowSetting.workflowCodes = itemWorkflowSetting.workflowCodes.split(',');
|
|
16284
|
+
}
|
|
16285
|
+
else {
|
|
16286
|
+
itemWorkflowSetting.workflowCodes = [];
|
|
16287
|
+
}
|
|
16288
|
+
itemWorkflowSetting.workflowCodes.forEach(workflowCode => {
|
|
16289
|
+
if (workflowCodes.indexOf(workflowCode) == -1) {
|
|
16290
|
+
workflowCodes.push(workflowCode);
|
|
16291
|
+
}
|
|
16292
|
+
});
|
|
16293
|
+
});
|
|
16294
|
+
const stateMachinesService = this._injector.get(StateMachinesService);
|
|
16295
|
+
const workflows = (yield stateMachinesService.getDataDropdownByFilter([
|
|
16296
|
+
this.newFilter('code', Operator.in, workflowCodes)
|
|
16297
|
+
], new DropdownOptions({
|
|
16298
|
+
valueField: 'code',
|
|
16299
|
+
displayField: 'title',
|
|
16300
|
+
fieldPlus: 'data'
|
|
16301
|
+
})));
|
|
16302
|
+
workflows.forEach(item => {
|
|
16303
|
+
item.data = JSON.parse(item.data);
|
|
16304
|
+
const stateMachineData = item.data;
|
|
16305
|
+
stateMachineData.actions = {};
|
|
16306
|
+
stateMachineData.machines.forEach(machine => {
|
|
16307
|
+
stateMachineData.actions[machine.code] = [];
|
|
16308
|
+
stateMachineData.connections.forEach(conn => {
|
|
16309
|
+
if (conn.source == machine.id) {
|
|
16310
|
+
stateMachineData.actions[machine.code].push(conn);
|
|
16311
|
+
}
|
|
16312
|
+
});
|
|
16313
|
+
});
|
|
16314
|
+
});
|
|
16315
|
+
cauHinhWorkflows.forEach(itemWorkflowSetting => {
|
|
16316
|
+
itemWorkflowSetting.workflows = workflows.filter(q => itemWorkflowSetting.workflowCodes.indexOf(q.code) > -1);
|
|
16317
|
+
if (!itemWorkflowSetting.idLoaiCongViec) {
|
|
16318
|
+
this.dicWorkflowByLoaiCongViec[this.keyIdLoaiCongViecRoot] = itemWorkflowSetting;
|
|
16319
|
+
}
|
|
16320
|
+
else {
|
|
16321
|
+
this.dicWorkflowByLoaiCongViec[itemWorkflowSetting.idLoaiCongViec] = itemWorkflowSetting;
|
|
16322
|
+
}
|
|
16323
|
+
});
|
|
16324
|
+
return workflows;
|
|
16325
|
+
});
|
|
16326
|
+
}
|
|
16327
|
+
getIdLoaiCongViecs(idLoaiCongViec) {
|
|
16328
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16329
|
+
const notifierService = this._injector.get(NotifierService);
|
|
16330
|
+
const itemLoaiCongViec = yield this.getItemLoaiCongViec(idLoaiCongViec);
|
|
16331
|
+
if (itemLoaiCongViec == null) {
|
|
16332
|
+
notifierService.showWarning('Loại công việc không tồn tại');
|
|
16333
|
+
return null;
|
|
16334
|
+
}
|
|
16335
|
+
const idLoaiCongViecs = itemLoaiCongViec.idDuongDan.split(';').filter(q => !!q);
|
|
16336
|
+
return idLoaiCongViecs;
|
|
16337
|
+
});
|
|
16338
|
+
}
|
|
16339
|
+
getItemLoaiCongViec(idLoaiCongViec) {
|
|
16340
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16341
|
+
if (!this.dicLoaiCongViec[idLoaiCongViec]) {
|
|
16342
|
+
this.dicLoaiCongViec[idLoaiCongViec] = (yield this.getDetail(idLoaiCongViec)).data;
|
|
16343
|
+
}
|
|
16344
|
+
return this.dicLoaiCongViec[idLoaiCongViec];
|
|
16345
|
+
});
|
|
16346
|
+
}
|
|
16347
|
+
}
|
|
16348
|
+
DmLoaiCongViecService.ɵprov = i0.ɵɵdefineInjectable({ factory: function DmLoaiCongViecService_Factory() { return new DmLoaiCongViecService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService)); }, token: DmLoaiCongViecService, providedIn: "root" });
|
|
16349
|
+
DmLoaiCongViecService.decorators = [
|
|
16350
|
+
{ type: Injectable, args: [{
|
|
16351
|
+
providedIn: 'root'
|
|
16352
|
+
},] }
|
|
16353
|
+
];
|
|
16354
|
+
DmLoaiCongViecService.ctorParameters = () => [
|
|
16355
|
+
{ type: HttpClient },
|
|
16356
|
+
{ type: Injector },
|
|
16357
|
+
{ type: ModuleConfigService }
|
|
16358
|
+
];
|
|
16359
|
+
|
|
16360
|
+
class CongViecService extends BaseService {
|
|
16361
|
+
constructor(http, injector, _moduleConfigService, _dmLoaiCongViecService) {
|
|
16362
|
+
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.congviecEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/CongViec_Chinh`);
|
|
16363
|
+
this._dmLoaiCongViecService = _dmLoaiCongViecService;
|
|
16364
|
+
this.serviceCode = 'congviec';
|
|
16365
|
+
this.entityName = 'CongViec_Chinh';
|
|
16366
|
+
this.objectName = 'công việc';
|
|
16367
|
+
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.congviecEndpoint;
|
|
16368
|
+
this._moduleConfig = _moduleConfigService.getConfig();
|
|
16369
|
+
}
|
|
16370
|
+
adjustSettingWorkflowForCrudList(setting) {
|
|
16371
|
+
this.useWorkflow = true;
|
|
16372
|
+
setting.isWorkflowTree = true;
|
|
16373
|
+
setting.baseService = this;
|
|
16374
|
+
setting.displayField = (item) => item.ten;
|
|
16375
|
+
setting.baseService.useWorkflow = true;
|
|
16376
|
+
setting.workflowConfigAdvance = {
|
|
16377
|
+
getWorkflowSetting: this.getWorkflowConfig.bind(this)
|
|
16378
|
+
};
|
|
16379
|
+
}
|
|
16380
|
+
getWorkflowConfig(rowData) {
|
|
16381
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16382
|
+
return yield this._dmLoaiCongViecService.getWorkflowSettingByIdLoaiCongViec(rowData.idLoaiCongViec);
|
|
16383
|
+
});
|
|
16384
|
+
}
|
|
16385
|
+
countByMenuState(data) {
|
|
16386
|
+
return this.defaultPost(`${this.serviceUri}/CountByMenuState`, data);
|
|
16387
|
+
}
|
|
16388
|
+
getDicIdByMenuState(data, tuNgay, denNgay) {
|
|
16389
|
+
return this.defaultPost(`${this.serviceUri}/GetDicIdByMenuState`, {
|
|
16390
|
+
lstTrangThai: data,
|
|
16391
|
+
tuNgay,
|
|
16392
|
+
denNgay
|
|
16393
|
+
});
|
|
16394
|
+
}
|
|
16395
|
+
updateBulkIdCha(model) {
|
|
16396
|
+
const url = `${this.serviceUri}/UpdateBulkIdCha`;
|
|
16397
|
+
return this.defaultPost(url, model);
|
|
16398
|
+
}
|
|
16399
|
+
deleteBulkCongViecCon(ids) {
|
|
16400
|
+
const url = `${this.serviceUri}/DeleteBulkCongViecCon`;
|
|
16401
|
+
return this.defaultPost(url, ids);
|
|
16402
|
+
}
|
|
16403
|
+
getDataDashboardCaNhan(inputData) {
|
|
16404
|
+
const url = `${this.serviceUri}/GetDataDashboardCaNhan`;
|
|
16405
|
+
return this.defaultPost(url, inputData);
|
|
16406
|
+
}
|
|
16407
|
+
getDataDashboardByDonVi(inputData) {
|
|
16408
|
+
const url = `${this.serviceUri}/GetDataDashboardByDonVi`;
|
|
16409
|
+
return this.defaultPost(url, inputData);
|
|
16410
|
+
}
|
|
16411
|
+
getListTasksDashboard(dataFilter) {
|
|
16412
|
+
const url = `${this.serviceUri}/getListTasksDashboard`;
|
|
16413
|
+
return this.defaultPost(url, dataFilter);
|
|
16414
|
+
}
|
|
16415
|
+
}
|
|
16416
|
+
CongViecService.ɵprov = i0.ɵɵdefineInjectable({ factory: function CongViecService_Factory() { return new CongViecService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService), i0.ɵɵinject(DmLoaiCongViecService)); }, token: CongViecService, providedIn: "root" });
|
|
16417
|
+
CongViecService.decorators = [
|
|
16418
|
+
{ type: Injectable, args: [{
|
|
16419
|
+
providedIn: 'root'
|
|
16420
|
+
},] }
|
|
16421
|
+
];
|
|
16422
|
+
CongViecService.ctorParameters = () => [
|
|
16423
|
+
{ type: HttpClient },
|
|
16424
|
+
{ type: Injector },
|
|
16425
|
+
{ type: ModuleConfigService },
|
|
16426
|
+
{ type: DmLoaiCongViecService }
|
|
16427
|
+
];
|
|
16428
|
+
|
|
16182
16429
|
class SearchInfo {
|
|
16183
16430
|
constructor(init) {
|
|
16184
16431
|
this.fieldSearchText = [];
|
|
@@ -16446,752 +16693,160 @@ TnCustomScrollbarComponent.propDecorators = {
|
|
|
16446
16693
|
scrollXReachStart: [{ type: Output }]
|
|
16447
16694
|
};
|
|
16448
16695
|
|
|
16449
|
-
|
|
16450
|
-
|
|
16451
|
-
|
|
16452
|
-
|
|
16453
|
-
this.
|
|
16454
|
-
this.
|
|
16455
|
-
this.
|
|
16456
|
-
this._moduleConfig = _moduleConfigService.getConfig();
|
|
16457
|
-
this.environment = this._moduleConfig.environment;
|
|
16458
|
-
this.serviceUri = `${this._moduleConfig.environment.apiDomain.templateEndpoint}/Export`;
|
|
16459
|
-
}
|
|
16460
|
-
objectToExcel(data, fileName, numOfHeaderRow) {
|
|
16461
|
-
return this._http
|
|
16462
|
-
.post(`${this.serviceUri}/ObjectToExcel?numOfHeaderRow=${numOfHeaderRow}`, data, { responseType: 'blob' })
|
|
16463
|
-
.pipe(catchError((err) => this._commonService.handleError(err, this._injector)))
|
|
16464
|
-
.subscribe(res => {
|
|
16465
|
-
this.saveAsExcelFile(res, fileName);
|
|
16466
|
-
});
|
|
16467
|
-
}
|
|
16468
|
-
saveAsExcelFile(buffer, fileName) {
|
|
16469
|
-
const data = new Blob([buffer], {
|
|
16470
|
-
type: EXCEL_TYPE
|
|
16471
|
-
});
|
|
16472
|
-
FileSaver__default.saveAs(data, fileName + '_' + new Date().getTime() + EXCEL_EXTENSION);
|
|
16696
|
+
class BasePermissionService extends BaseService {
|
|
16697
|
+
constructor(http, injector, _moduleConfigService) {
|
|
16698
|
+
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.authorizationEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/BasePermission`);
|
|
16699
|
+
this._moduleConfigService = _moduleConfigService;
|
|
16700
|
+
this.entityName = 'BasePermission';
|
|
16701
|
+
this.serviceCode = 'Authorization';
|
|
16702
|
+
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.authorizationEndpoint;
|
|
16473
16703
|
}
|
|
16474
|
-
|
|
16475
|
-
|
|
16476
|
-
type: EXCEL_TYPE
|
|
16477
|
-
});
|
|
16478
|
-
FileSaver__default.saveAs(data, new Date().getTime() + '_' + fileName);
|
|
16704
|
+
getPermissionByCode(code) {
|
|
16705
|
+
return this.defaultGet(`${this.serviceUri}/GetPermissionByCode?code=${code}`);
|
|
16479
16706
|
}
|
|
16480
16707
|
}
|
|
16481
|
-
|
|
16482
|
-
|
|
16708
|
+
BasePermissionService.ɵprov = i0.ɵɵdefineInjectable({ factory: function BasePermissionService_Factory() { return new BasePermissionService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService)); }, token: BasePermissionService, providedIn: "root" });
|
|
16709
|
+
BasePermissionService.decorators = [
|
|
16483
16710
|
{ type: Injectable, args: [{
|
|
16484
16711
|
providedIn: 'root'
|
|
16485
16712
|
},] }
|
|
16486
16713
|
];
|
|
16487
|
-
|
|
16714
|
+
BasePermissionService.ctorParameters = () => [
|
|
16488
16715
|
{ type: HttpClient },
|
|
16489
16716
|
{ type: Injector },
|
|
16490
|
-
{ type: CommonService },
|
|
16491
16717
|
{ type: ModuleConfigService }
|
|
16492
16718
|
];
|
|
16493
16719
|
|
|
16494
|
-
class
|
|
16495
|
-
constructor(
|
|
16496
|
-
|
|
16497
|
-
this.
|
|
16498
|
-
this.
|
|
16499
|
-
this.
|
|
16500
|
-
|
|
16501
|
-
|
|
16720
|
+
class CoCauToChucService extends BaseService {
|
|
16721
|
+
constructor(http, injector, _moduleConfigService) {
|
|
16722
|
+
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.userOrgEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/organization`);
|
|
16723
|
+
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.userOrgEndpoint;
|
|
16724
|
+
this.environment = _moduleConfigService.getConfig().environment;
|
|
16725
|
+
if (this.isUseOldOrganization()) {
|
|
16726
|
+
this.serviceUri = `${this.environment.apiDomain.organizationEndpoint}/organization`;
|
|
16727
|
+
}
|
|
16728
|
+
}
|
|
16729
|
+
createDropdownTree(field = 'idDonViQuanLy') {
|
|
16730
|
+
return new DropdownControlSchema({
|
|
16731
|
+
field,
|
|
16732
|
+
placeholder: 'Chọn đơn vị',
|
|
16733
|
+
baseService: this,
|
|
16734
|
+
sortField: 'idDuongDan',
|
|
16735
|
+
fieldPlus: 'idDuongDan',
|
|
16736
|
+
isTree: true,
|
|
16737
|
+
fieldTree: 'idCha',
|
|
16738
|
+
valueParentRoot: this._commonService.guidEmpty(),
|
|
16739
|
+
// isServerLoad: true, Option này đang không chạy được trong case này
|
|
16740
|
+
loadOnInit: true,
|
|
16741
|
+
maxItemDisplay: 9999
|
|
16742
|
+
// funcGetLabel: (item) => {
|
|
16743
|
+
// let level = item.idDuongDan.split(';').length - 2;
|
|
16744
|
+
// let prefix = '';
|
|
16745
|
+
// if (level < 2)
|
|
16746
|
+
// level = 1;
|
|
16747
|
+
// else
|
|
16748
|
+
// prefix = '|';
|
|
16749
|
+
// return `${prefix}${'---'.repeat(level - 1)} ${item.ten}`;
|
|
16750
|
+
// }
|
|
16751
|
+
});
|
|
16752
|
+
}
|
|
16753
|
+
isUseOldOrganization() {
|
|
16754
|
+
const useOldOrganization = this.environment.useOldOrganization;
|
|
16755
|
+
if (useOldOrganization) {
|
|
16756
|
+
return true;
|
|
16757
|
+
}
|
|
16758
|
+
return false;
|
|
16759
|
+
}
|
|
16760
|
+
getByParentCode(organizationCode) {
|
|
16761
|
+
let apiUrl = `${this.serviceUri}/GetByParentCode`;
|
|
16762
|
+
if (organizationCode) {
|
|
16763
|
+
apiUrl = `${apiUrl}?parentCode=${organizationCode}`;
|
|
16764
|
+
}
|
|
16765
|
+
return this.defaultGet(apiUrl);
|
|
16766
|
+
}
|
|
16767
|
+
getByCanBoId(canBoId) {
|
|
16768
|
+
const apiUrl = `${this.serviceUri}/GetByCanBoId/${canBoId}`;
|
|
16769
|
+
return this.defaultGet(apiUrl);
|
|
16770
|
+
}
|
|
16771
|
+
getCoCauToChucTreeTable(isIgnoreClientCache = false) {
|
|
16772
|
+
const apiUrl = `${this.serviceUri}/GetTreeTable`;
|
|
16773
|
+
if (isIgnoreClientCache) {
|
|
16774
|
+
return this.getIgnoreClientCache(apiUrl);
|
|
16502
16775
|
}
|
|
16776
|
+
return this.defaultGet(apiUrl);
|
|
16777
|
+
}
|
|
16778
|
+
updateMaPhanCap(idCha) {
|
|
16779
|
+
return this.defaultPost(`${this.serviceUri}/UpdateMaPhanCap/${idCha}`, {});
|
|
16503
16780
|
}
|
|
16504
16781
|
}
|
|
16505
|
-
|
|
16506
|
-
|
|
16507
|
-
|
|
16782
|
+
CoCauToChucService.ɵprov = i0.ɵɵdefineInjectable({ factory: function CoCauToChucService_Factory() { return new CoCauToChucService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService)); }, token: CoCauToChucService, providedIn: "root" });
|
|
16783
|
+
CoCauToChucService.decorators = [
|
|
16784
|
+
{ type: Injectable, args: [{
|
|
16785
|
+
providedIn: 'root'
|
|
16786
|
+
},] }
|
|
16787
|
+
];
|
|
16788
|
+
CoCauToChucService.ctorParameters = () => [
|
|
16789
|
+
{ type: HttpClient },
|
|
16790
|
+
{ type: Injector },
|
|
16791
|
+
{ type: ModuleConfigService }
|
|
16792
|
+
];
|
|
16793
|
+
|
|
16794
|
+
class CanBo_HoSo_CoCauToChucService extends BaseService {
|
|
16795
|
+
constructor(http, injector, _moduleConfigService) {
|
|
16796
|
+
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.canboEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/CanBo_HoSo_CoCauToChuc`);
|
|
16508
16797
|
this._moduleConfigService = _moduleConfigService;
|
|
16509
|
-
this.
|
|
16510
|
-
this.
|
|
16511
|
-
this._appContext = _appContext;
|
|
16512
|
-
this.storage = sessionStorage;
|
|
16513
|
-
this.ignoreAdmin = false;
|
|
16514
|
-
this.delayCheckPermissions = [];
|
|
16515
|
-
this.appCode = null;
|
|
16516
|
-
this._config = this._moduleConfigService.getConfig();
|
|
16517
|
-
this.endPoint = this._config.environment.apiDomain.authorizationEndpoint;
|
|
16518
|
-
this.ignoreAdmin = this._config.environment.isIgnoreAdmin;
|
|
16519
|
-
this.appCode = this._config.appCode;
|
|
16798
|
+
this.entityName = 'CanBo_HoSo_CoCauToChuc';
|
|
16799
|
+
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.canboEndpoint;
|
|
16520
16800
|
}
|
|
16521
|
-
|
|
16522
|
-
|
|
16523
|
-
const lstAppCodes = (_c = (_b = (_a = this._config.environment.appMetadata) === null || _a === void 0 ? void 0 : _a.appSwitcher) === null || _b === void 0 ? void 0 : _b.map(app => app.code)) !== null && _c !== void 0 ? _c : [];
|
|
16524
|
-
const lstApiEndpoint = [];
|
|
16525
|
-
const apiDomain = this._config.environment.apiDomain;
|
|
16526
|
-
for (const domainName in apiDomain) {
|
|
16527
|
-
if (domainName.startsWith('-') || domainName.startsWith('1') || domainName == 'gateway')
|
|
16528
|
-
continue;
|
|
16529
|
-
const realDomainName = domainName.split('Endpoint') ? domainName.split('Endpoint')[0] : domainName;
|
|
16530
|
-
lstApiEndpoint.push(realDomainName.toUpperCase());
|
|
16531
|
-
}
|
|
16532
|
-
return this.clearPermissionCache([...lstAppCodes, ...lstApiEndpoint]);
|
|
16801
|
+
sapNhapCoCauToChuc(model) {
|
|
16802
|
+
return this.defaultPost(`${this.serviceUri}/SapNhapCoCauToChuc`, model);
|
|
16533
16803
|
}
|
|
16534
|
-
|
|
16535
|
-
|
|
16536
|
-
return this.defaultPost(url, lstModule);
|
|
16804
|
+
getIdsDonViByCanBoLogin() {
|
|
16805
|
+
return this.defaultGet(`${this.serviceUri}/GetIdsDonViByCanBoLogin`);
|
|
16537
16806
|
}
|
|
16538
|
-
|
|
16539
|
-
|
|
16540
|
-
return this.defaultGet(url);
|
|
16807
|
+
getDonViChucVuCapCaoNhatByIdsCanBo(idsCanBo = []) {
|
|
16808
|
+
return this.defaultPost(`${this.serviceUri}/GetDonViChucVuCapCaoNhatByIdsCanBo`, idsCanBo);
|
|
16541
16809
|
}
|
|
16542
|
-
|
|
16543
|
-
|
|
16810
|
+
unshiftColumnKhoaVienBoMon(modelSchemas, cols) {
|
|
16811
|
+
modelSchemas.unshift(...[new ModelSchema({
|
|
16812
|
+
field: 'donVi',
|
|
16813
|
+
name: 'Khoa viện/ đơn vị',
|
|
16814
|
+
fullName: 'Khoa viện/ đơn vị',
|
|
16815
|
+
description: 'Khoa viện/ đơn vị'
|
|
16816
|
+
}),
|
|
16817
|
+
new ModelSchema({
|
|
16818
|
+
field: 'boMon',
|
|
16819
|
+
name: 'Bộ môn/ văn phòng khoa',
|
|
16820
|
+
fullName: 'Bộ môn/ văn phòng khoa',
|
|
16821
|
+
description: 'Bộ môn/ văn phòng khoa'
|
|
16822
|
+
})]);
|
|
16823
|
+
cols.unshift(...[new ColumnSchemaBase({
|
|
16824
|
+
field: 'donVi',
|
|
16825
|
+
dataType: 'html',
|
|
16826
|
+
width: '200px',
|
|
16827
|
+
allowFilter: false,
|
|
16828
|
+
sort: false
|
|
16829
|
+
}),
|
|
16830
|
+
new ColumnSchemaBase({
|
|
16831
|
+
field: 'boMon',
|
|
16832
|
+
dataType: 'html',
|
|
16833
|
+
width: '200px',
|
|
16834
|
+
allowFilter: false,
|
|
16835
|
+
sort: false
|
|
16836
|
+
})]);
|
|
16837
|
+
}
|
|
16838
|
+
getsDonViTheoCap(dataSource = []) {
|
|
16839
|
+
return this.defaultPost(`${this.serviceUri}/GetsDonViTheoCap`, dataSource);
|
|
16840
|
+
}
|
|
16841
|
+
getKhoaVienBoMonAfterGetData(dataSource) {
|
|
16544
16842
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16545
|
-
const
|
|
16546
|
-
|
|
16547
|
-
|
|
16548
|
-
|
|
16549
|
-
|
|
16550
|
-
|
|
16551
|
-
|
|
16552
|
-
return;
|
|
16553
|
-
}
|
|
16554
|
-
const user = this._userService.getCurrentUser();
|
|
16555
|
-
if (user
|
|
16556
|
-
&& (user.issuperuser && user.issuperuser.toLowerCase() == 'true')
|
|
16557
|
-
|| (user.isadmin && user.isadmin.toLowerCase() == 'true' && !this.ignoreAdmin)) {
|
|
16558
|
-
return;
|
|
16559
|
-
}
|
|
16560
|
-
const res = yield this.defaultGet(url);
|
|
16561
|
-
const lstAppCodes = (_c = (_b = (_a = this._config.environment.appMetadata) === null || _a === void 0 ? void 0 : _a.appSwitcher) === null || _b === void 0 ? void 0 : _b.map(app => app.code)) !== null && _c !== void 0 ? _c : [];
|
|
16562
|
-
// Nếu Có error lấy dữ liệu quyền tổng hợp thì quay về lấy dữ liệu quyền dựa vào từng module
|
|
16563
|
-
if (!res || !res.success || res.data == null) {
|
|
16564
|
-
const promiseArr = [];
|
|
16565
|
-
for (const code of lstAppCodes) {
|
|
16566
|
-
promiseArr.push(this.getServicePermission(code, true));
|
|
16567
|
-
}
|
|
16568
|
-
yield Promise.all(promiseArr);
|
|
16569
|
-
return;
|
|
16570
|
-
}
|
|
16571
|
-
// Set local storage cho permission của người dùng
|
|
16572
|
-
for (const service of lstAppCodes) {
|
|
16573
|
-
let permissions = [];
|
|
16574
|
-
const serviceCode = service.toUpperCase();
|
|
16575
|
-
for (const key in res.data) {
|
|
16576
|
-
if (key.toUpperCase() != serviceCode) {
|
|
16577
|
-
continue;
|
|
16578
|
-
}
|
|
16579
|
-
permissions = res.data[key];
|
|
16580
|
-
break;
|
|
16581
|
-
}
|
|
16582
|
-
const key = `AUTHORIZATION.${serviceCode}`;
|
|
16583
|
-
const storageItem = this.storage.getItem(key);
|
|
16584
|
-
if (storageItem != null) {
|
|
16585
|
-
this.storage.removeItem(key);
|
|
16586
|
-
}
|
|
16587
|
-
this.storage.setItem(key, JSON.stringify(permissions));
|
|
16588
|
-
}
|
|
16589
|
-
});
|
|
16590
|
-
}
|
|
16591
|
-
/**
|
|
16592
|
-
* Truyền vào danh sách permision cần check
|
|
16593
|
-
* @param lstPermissionCode những perrmision code cần check => nên dùng trong trường hợp check các button trong code
|
|
16594
|
-
* @returns trả ra các perrmisionCode có quyền
|
|
16595
|
-
*/
|
|
16596
|
-
getPermissionAuthorized(lstPermissionCode) {
|
|
16597
|
-
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
16598
|
-
const user = (yield this._userService.getCurrentUser());
|
|
16599
|
-
if (user && user.issuperuser.toLowerCase() == 'true') {
|
|
16600
|
-
resolve(lstPermissionCode);
|
|
16601
|
-
return;
|
|
16602
|
-
}
|
|
16603
|
-
if (user && user.isadmin.toLowerCase() == 'true' && !this.ignoreAdmin) {
|
|
16604
|
-
resolve(lstPermissionCode);
|
|
16605
|
-
return;
|
|
16606
|
-
}
|
|
16607
|
-
const result = [];
|
|
16608
|
-
for (const item of lstPermissionCode) {
|
|
16609
|
-
if (yield this.isAuthorizedPermission(item)) {
|
|
16610
|
-
result.push(item);
|
|
16611
|
-
}
|
|
16612
|
-
}
|
|
16613
|
-
resolve(result);
|
|
16614
|
-
}));
|
|
16615
|
-
}
|
|
16616
|
-
isAuthorizedPermission(permission) {
|
|
16617
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16618
|
-
let retryCount = 0;
|
|
16619
|
-
while (!this._oauthService.hasValidAccessToken()) {
|
|
16620
|
-
yield this._commonService.delay(100);
|
|
16621
|
-
retryCount++;
|
|
16622
|
-
if (retryCount > 50) {
|
|
16623
|
-
break;
|
|
16624
|
-
}
|
|
16625
|
-
}
|
|
16626
|
-
return yield this.checkPermission(this.appCode, permission);
|
|
16627
|
-
});
|
|
16628
|
-
}
|
|
16629
|
-
isAuthorized(service, permission, checForMenu = false) {
|
|
16630
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16631
|
-
this.root = this._appContext.getRootContext();
|
|
16632
|
-
let retryCount = 0;
|
|
16633
|
-
while (!this._oauthService.hasValidAccessToken()) {
|
|
16634
|
-
yield this._commonService.delay(100);
|
|
16635
|
-
retryCount++;
|
|
16636
|
-
if (retryCount > 50) {
|
|
16637
|
-
break;
|
|
16638
|
-
}
|
|
16639
|
-
}
|
|
16640
|
-
return yield this.checkPermission(service, permission, checForMenu);
|
|
16641
|
-
});
|
|
16642
|
-
}
|
|
16643
|
-
checkPermission(service, permissionToCheck, checkForMenu = false) {
|
|
16644
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16645
|
-
try {
|
|
16646
|
-
const user = this._userService.getCurrentUser();
|
|
16647
|
-
const valueIsDevMode = true;
|
|
16648
|
-
if (isDevMode() && valueIsDevMode) {
|
|
16649
|
-
return true;
|
|
16650
|
-
}
|
|
16651
|
-
if (user && user.issuperuser && user.issuperuser.toLowerCase() == 'true' && valueIsDevMode) {
|
|
16652
|
-
return true;
|
|
16653
|
-
}
|
|
16654
|
-
if (user && user.isadmin && user.isadmin.toLowerCase() == 'true' && !this.ignoreAdmin && valueIsDevMode) {
|
|
16655
|
-
return true;
|
|
16656
|
-
}
|
|
16657
|
-
const userPermissions = yield this.getServicePermission(service);
|
|
16658
|
-
if (userPermissions && userPermissions.length > 0) {
|
|
16659
|
-
return checkForMenu
|
|
16660
|
-
? userPermissions.includes(permissionToCheck)
|
|
16661
|
-
: this._checkPermission(userPermissions, permissionToCheck);
|
|
16662
|
-
}
|
|
16663
|
-
else {
|
|
16664
|
-
// console.log(`Không có quyền với phân hệ [${service}]`);
|
|
16665
|
-
return false;
|
|
16666
|
-
}
|
|
16667
|
-
}
|
|
16668
|
-
catch (_a) {
|
|
16669
|
-
return false;
|
|
16670
|
-
}
|
|
16671
|
-
});
|
|
16672
|
-
}
|
|
16673
|
-
_checkPermission(userPermissions, permissionToCheck) {
|
|
16674
|
-
let isAuthorized = false;
|
|
16675
|
-
// check permission của người dùng
|
|
16676
|
-
// duyệt qua từng permission của người dùng
|
|
16677
|
-
for (const userPermission of userPermissions) {
|
|
16678
|
-
// biến để break khỏi vòng khi người dùng được authorized
|
|
16679
|
-
let breakOuterLoop = false;
|
|
16680
|
-
// pointer permission của người dùng
|
|
16681
|
-
let userPermissionPointer = 0;
|
|
16682
|
-
// pointer permission đang check
|
|
16683
|
-
let permissionToCheckPointer = 0;
|
|
16684
|
-
// mark co the check query param
|
|
16685
|
-
let aboutToCheckQueryParam = false;
|
|
16686
|
-
// check từng char của 2 mảng
|
|
16687
|
-
for (; permissionToCheckPointer < permissionToCheck.length;) {
|
|
16688
|
-
// nếu char là ký tự bắt đầu template => tịnh tiến pointer của 2 mảng
|
|
16689
|
-
let needRecheck = false;
|
|
16690
|
-
if (userPermission[userPermissionPointer] == '{') {
|
|
16691
|
-
// cho đến khi tìm được ký tự '/' tiếp theo thì dừng lại
|
|
16692
|
-
for (; userPermissionPointer < userPermission.length; userPermissionPointer++) {
|
|
16693
|
-
if (userPermissionPointer == userPermission.length - 1) {
|
|
16694
|
-
break;
|
|
16695
|
-
}
|
|
16696
|
-
if (userPermission[userPermissionPointer] != '}') {
|
|
16697
|
-
continue;
|
|
16698
|
-
}
|
|
16699
|
-
if (userPermission[userPermissionPointer] === '?') {
|
|
16700
|
-
aboutToCheckQueryParam = true;
|
|
16701
|
-
}
|
|
16702
|
-
++userPermissionPointer; // tiến tiến đến ký tự sau kết thúc template
|
|
16703
|
-
// check trường hợp trường hợp chuỗi template có dạng "{template}acsekjf"
|
|
16704
|
-
// => cần check các ký tự sau template và trước ký tự '/'
|
|
16705
|
-
if (userPermission[userPermissionPointer] != '/' && (aboutToCheckQueryParam && userPermission[userPermissionPointer] != '&')) {
|
|
16706
|
-
needRecheck = true;
|
|
16707
|
-
for (; userPermissionPointer < userPermission.length; userPermissionPointer++) {
|
|
16708
|
-
if (userPermissionPointer == userPermission.length - 1) {
|
|
16709
|
-
break;
|
|
16710
|
-
}
|
|
16711
|
-
if (userPermission[userPermissionPointer] != '/') {
|
|
16712
|
-
continue;
|
|
16713
|
-
}
|
|
16714
|
-
break;
|
|
16715
|
-
}
|
|
16716
|
-
}
|
|
16717
|
-
break;
|
|
16718
|
-
}
|
|
16719
|
-
for (; permissionToCheckPointer < permissionToCheck.length; permissionToCheckPointer++) {
|
|
16720
|
-
if (permissionToCheckPointer == permissionToCheck.length - 1) {
|
|
16721
|
-
break;
|
|
16722
|
-
}
|
|
16723
|
-
if (permissionToCheck[permissionToCheckPointer] == '/' || (aboutToCheckQueryParam && permissionToCheck[permissionToCheckPointer] == '&')) {
|
|
16724
|
-
break;
|
|
16725
|
-
}
|
|
16726
|
-
}
|
|
16727
|
-
}
|
|
16728
|
-
let breakInnerLoop = false;
|
|
16729
|
-
if (needRecheck) {
|
|
16730
|
-
// check lại cho trường hợp chuỗi template có dạng "{template}acslekfj"
|
|
16731
|
-
// duyệt ngược lại cho đến khi gặp ký tự kết thúc template
|
|
16732
|
-
let tempUserPointer = userPermissionPointer;
|
|
16733
|
-
let tempToCheckPointer = permissionToCheckPointer;
|
|
16734
|
-
while (userPermission[tempUserPointer] != '}') {
|
|
16735
|
-
// ký tự khác nhau => break khỏi vòng kiểm tra trong
|
|
16736
|
-
if (userPermission[tempUserPointer].toLowerCase() != permissionToCheck[tempToCheckPointer].toLowerCase()) {
|
|
16737
|
-
breakInnerLoop = true;
|
|
16738
|
-
break;
|
|
16739
|
-
}
|
|
16740
|
-
tempUserPointer--;
|
|
16741
|
-
tempToCheckPointer--;
|
|
16742
|
-
}
|
|
16743
|
-
}
|
|
16744
|
-
if (breakInnerLoop) {
|
|
16745
|
-
break;
|
|
16746
|
-
}
|
|
16747
|
-
const userChar = userPermission[userPermissionPointer].toLowerCase();
|
|
16748
|
-
const toCheckChar = permissionToCheck[permissionToCheckPointer].toLowerCase();
|
|
16749
|
-
// nếu userPermission đang ở index cuối
|
|
16750
|
-
if (userPermissionPointer == userPermission.length - 1) {
|
|
16751
|
-
// check char cuối của 2 mảng (trừ khi là ký tự kết thúc template)
|
|
16752
|
-
// và cũng phải là char cuối của mảng permission cần check
|
|
16753
|
-
// => người dùng authorized và break khỏi vòng lặp ngoài cùng
|
|
16754
|
-
if ((userChar == '}' || userChar == toCheckChar)
|
|
16755
|
-
&& permissionToCheckPointer == permissionToCheck.length - 1) {
|
|
16756
|
-
breakOuterLoop = true;
|
|
16757
|
-
isAuthorized = true;
|
|
16758
|
-
}
|
|
16759
|
-
break;
|
|
16760
|
-
}
|
|
16761
|
-
// check char có giống nhau không, không giống thì break khỏi vòng check
|
|
16762
|
-
if (userChar != toCheckChar) {
|
|
16763
|
-
break;
|
|
16764
|
-
}
|
|
16765
|
-
// nếu char giống nhau thì tiếp tục vòng lăp
|
|
16766
|
-
permissionToCheckPointer++;
|
|
16767
|
-
userPermissionPointer++;
|
|
16768
|
-
}
|
|
16769
|
-
if (breakOuterLoop) {
|
|
16770
|
-
break;
|
|
16771
|
-
}
|
|
16772
|
-
}
|
|
16773
|
-
return isAuthorized;
|
|
16774
|
-
}
|
|
16775
|
-
_checkPermissionOld(userPermissions, permissionToCheck) {
|
|
16776
|
-
let isAuthorized = false;
|
|
16777
|
-
// check quyền theo cách cũ nếu trường họp là phân quyền module
|
|
16778
|
-
if (permissionToCheck.includes('MODULE')) {
|
|
16779
|
-
return userPermissions.includes(permissionToCheck);
|
|
16780
|
-
}
|
|
16781
|
-
for (const userPermission of userPermissions) {
|
|
16782
|
-
// Cắt chuỗi permission thành mảng để xem mỗi fragement có khớp nhau không
|
|
16783
|
-
const userPermissionFragments = userPermission.split('/');
|
|
16784
|
-
const permissionFragments = permissionToCheck.split('/');
|
|
16785
|
-
// Mảng khác độ dài thì thoát sớm
|
|
16786
|
-
if (userPermissionFragments.length != permissionFragments.length) {
|
|
16787
|
-
continue;
|
|
16788
|
-
}
|
|
16789
|
-
// biến flag ra hiệu người dùng authorized và out vòng
|
|
16790
|
-
let breakLoop = false;
|
|
16791
|
-
// nếu tất cả phần tử khớp nhau => permission này trùng và người dùng được authorized
|
|
16792
|
-
for (let index = 0; index < permissionFragments.length; index++) {
|
|
16793
|
-
const userFragement = userPermissionFragments[index];
|
|
16794
|
-
const permissionFragment = permissionFragments[index];
|
|
16795
|
-
// skip qua các phần tử có ký tự bắt đầu là '{'
|
|
16796
|
-
if (userFragement[0] == '{') {
|
|
16797
|
-
if (index == permissionFragments.length - 1) {
|
|
16798
|
-
isAuthorized = true;
|
|
16799
|
-
breakLoop = true;
|
|
16800
|
-
}
|
|
16801
|
-
continue;
|
|
16802
|
-
}
|
|
16803
|
-
if (userFragement.toLowerCase() != permissionFragment.toLowerCase()) {
|
|
16804
|
-
break;
|
|
16805
|
-
}
|
|
16806
|
-
if (index == permissionFragments.length - 1) {
|
|
16807
|
-
isAuthorized = true;
|
|
16808
|
-
breakLoop = true;
|
|
16809
|
-
}
|
|
16810
|
-
}
|
|
16811
|
-
if (breakLoop) {
|
|
16812
|
-
break;
|
|
16813
|
-
}
|
|
16814
|
-
}
|
|
16815
|
-
return isAuthorized;
|
|
16816
|
-
}
|
|
16817
|
-
isAuthorizedByPermissions(permissions, operator = 'OR', ignoreAdmin = false) {
|
|
16818
|
-
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
16819
|
-
const user = (yield this._userService.getCurrentUser());
|
|
16820
|
-
if (user && user.issuperuser.toLowerCase() == 'true') {
|
|
16821
|
-
resolve(true);
|
|
16822
|
-
return;
|
|
16823
|
-
}
|
|
16824
|
-
if (user && user.isadmin.toLowerCase() == 'true' && !this.ignoreAdmin) {
|
|
16825
|
-
resolve(true);
|
|
16826
|
-
return;
|
|
16827
|
-
}
|
|
16828
|
-
let isAuthorized = true;
|
|
16829
|
-
if (operator.toUpperCase() == 'OR') {
|
|
16830
|
-
isAuthorized = false;
|
|
16831
|
-
}
|
|
16832
|
-
permissions.forEach(item => {
|
|
16833
|
-
this.getServicePermission(item.service).then(permissionResult => {
|
|
16834
|
-
if (operator.toUpperCase() == 'OR') {
|
|
16835
|
-
if (permissionResult.includes(item.permission)) {
|
|
16836
|
-
isAuthorized = true;
|
|
16837
|
-
return;
|
|
16838
|
-
}
|
|
16839
|
-
}
|
|
16840
|
-
else {
|
|
16841
|
-
if (!permissionResult.includes(item.permission)) {
|
|
16842
|
-
isAuthorized = false;
|
|
16843
|
-
return;
|
|
16844
|
-
}
|
|
16845
|
-
}
|
|
16846
|
-
}, error => {
|
|
16847
|
-
reject(false);
|
|
16848
|
-
});
|
|
16849
|
-
});
|
|
16850
|
-
resolve(isAuthorized);
|
|
16851
|
-
}));
|
|
16852
|
-
}
|
|
16853
|
-
getServicePermission(service, overrideLocalStorage = false) {
|
|
16854
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16855
|
-
const key = `AUTHORIZATION.${service.toUpperCase()}`;
|
|
16856
|
-
if (!overrideLocalStorage) {
|
|
16857
|
-
const storageItem = this.storage.getItem(key);
|
|
16858
|
-
if (storageItem && storageItem !== 'null') {
|
|
16859
|
-
const result = JSON.parse(storageItem);
|
|
16860
|
-
return result;
|
|
16861
|
-
}
|
|
16862
|
-
}
|
|
16863
|
-
const url = `${this.serviceUri}/GetPermissionsByService?service=${service}`;
|
|
16864
|
-
const response = yield this.defaultGet(url);
|
|
16865
|
-
if (!response || !response.success) {
|
|
16866
|
-
return [];
|
|
16867
|
-
}
|
|
16868
|
-
if (overrideLocalStorage) {
|
|
16869
|
-
this.storage.removeItem(key);
|
|
16870
|
-
}
|
|
16871
|
-
this.storage.setItem(key, JSON.stringify(response.data));
|
|
16872
|
-
return response.data;
|
|
16873
|
-
});
|
|
16874
|
-
}
|
|
16875
|
-
getPermissionIdsByModule(moduleCode, userId) {
|
|
16876
|
-
const url = `${this.serviceUri}/GetPermissionIdsByModule/${moduleCode}/${userId}`;
|
|
16877
|
-
return this.defaultGet(url);
|
|
16878
|
-
}
|
|
16879
|
-
phanQuyenNguoiDung(model) {
|
|
16880
|
-
const url = `${this.serviceUri}/PhanQuyenNguoiDung`;
|
|
16881
|
-
return this.defaultPost(url, model);
|
|
16882
|
-
}
|
|
16883
|
-
}
|
|
16884
|
-
PermissionService.ɵprov = i0.ɵɵdefineInjectable({ factory: function PermissionService_Factory() { return new PermissionService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService), i0.ɵɵinject(UserService), i0.ɵɵinject(i4.OAuthService), i0.ɵɵinject(ApplicationContextService)); }, token: PermissionService, providedIn: "root" });
|
|
16885
|
-
PermissionService.decorators = [
|
|
16886
|
-
{ type: Injectable, args: [{
|
|
16887
|
-
providedIn: 'root'
|
|
16888
|
-
},] }
|
|
16889
|
-
];
|
|
16890
|
-
PermissionService.ctorParameters = () => [
|
|
16891
|
-
{ type: HttpClient },
|
|
16892
|
-
{ type: Injector },
|
|
16893
|
-
{ type: ModuleConfigService },
|
|
16894
|
-
{ type: UserService },
|
|
16895
|
-
{ type: OAuthService },
|
|
16896
|
-
{ type: ApplicationContextService }
|
|
16897
|
-
];
|
|
16898
|
-
|
|
16899
|
-
var sort_by;
|
|
16900
|
-
(function () {
|
|
16901
|
-
const defaultCompareFunc = function (a, b) {
|
|
16902
|
-
if (a == b)
|
|
16903
|
-
return 0;
|
|
16904
|
-
return a < b ? -1 : 1;
|
|
16905
|
-
};
|
|
16906
|
-
const getCompareFunc = function (primer, reverse) {
|
|
16907
|
-
const defaultCompare = defaultCompareFunc;
|
|
16908
|
-
let compare = defaultCompareFunc;
|
|
16909
|
-
if (primer) {
|
|
16910
|
-
compare = function (a, b) {
|
|
16911
|
-
return defaultCompare(primer(a), primer(b));
|
|
16912
|
-
};
|
|
16913
|
-
}
|
|
16914
|
-
if (reverse) {
|
|
16915
|
-
return function (a, b) {
|
|
16916
|
-
return -1 * compare(a, b);
|
|
16917
|
-
};
|
|
16918
|
-
}
|
|
16919
|
-
return compare;
|
|
16920
|
-
};
|
|
16921
|
-
sort_by = function (...args) {
|
|
16922
|
-
const fields = [], n_fields = args.length;
|
|
16923
|
-
let field, name, cmp;
|
|
16924
|
-
// preprocess sorting options
|
|
16925
|
-
for (let i = 0; i < n_fields; i++) {
|
|
16926
|
-
field = args[i];
|
|
16927
|
-
if (typeof field === 'string') {
|
|
16928
|
-
name = field;
|
|
16929
|
-
cmp = defaultCompareFunc;
|
|
16930
|
-
}
|
|
16931
|
-
else {
|
|
16932
|
-
name = field.name;
|
|
16933
|
-
cmp = getCompareFunc(field.primer, field.reverse);
|
|
16934
|
-
}
|
|
16935
|
-
fields.push({
|
|
16936
|
-
name: name,
|
|
16937
|
-
cmp: cmp
|
|
16938
|
-
});
|
|
16939
|
-
}
|
|
16940
|
-
// final comparison function
|
|
16941
|
-
return function (A, B) {
|
|
16942
|
-
let name, result;
|
|
16943
|
-
for (let i = 0; i < n_fields; i++) {
|
|
16944
|
-
result = 0;
|
|
16945
|
-
field = fields[i];
|
|
16946
|
-
name = field.name;
|
|
16947
|
-
result = field.cmp(A[name], B[name]);
|
|
16948
|
-
if (result !== 0)
|
|
16949
|
-
break;
|
|
16950
|
-
}
|
|
16951
|
-
return result;
|
|
16952
|
-
};
|
|
16953
|
-
};
|
|
16954
|
-
}());
|
|
16955
|
-
// multipleSort('idTinhThanh', 'idQuanHuyen')
|
|
16956
|
-
// multipleSort({name: 'idTinhThanh', reverse: true}, 'idQuanHuyen')
|
|
16957
|
-
// multipleSort({name: 'soThuTu', primer: parseInt}, 'idQuanHuyen') // parseInt là function
|
|
16958
|
-
const multipleSort = sort_by;
|
|
16959
|
-
|
|
16960
|
-
const moduleMap = {};
|
|
16961
|
-
function loadRemoteEntry(remoteEntry) {
|
|
16962
|
-
return new Promise((resolve, reject) => {
|
|
16963
|
-
if (moduleMap[remoteEntry]) {
|
|
16964
|
-
resolve();
|
|
16965
|
-
return;
|
|
16966
|
-
}
|
|
16967
|
-
const script = document.createElement('script');
|
|
16968
|
-
script.src = remoteEntry;
|
|
16969
|
-
script.onerror = reject;
|
|
16970
|
-
script.onload = () => {
|
|
16971
|
-
moduleMap[remoteEntry] = true;
|
|
16972
|
-
resolve(); // window is the global namespace
|
|
16973
|
-
};
|
|
16974
|
-
document.body.append(script);
|
|
16975
|
-
});
|
|
16976
|
-
}
|
|
16977
|
-
function lookupExposedModule(remoteName, exposedModule) {
|
|
16978
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16979
|
-
// Initializes the share scope. This fills it with known provided modules from this build and all remotes
|
|
16980
|
-
yield __webpack_init_sharing__('default');
|
|
16981
|
-
const container = window[remoteName]; // or get the container somewhere else
|
|
16982
|
-
// Initialize the container, it may provide shared modules
|
|
16983
|
-
yield container.init(__webpack_share_scopes__.default);
|
|
16984
|
-
const factory = yield container.get(exposedModule);
|
|
16985
|
-
const Module = factory();
|
|
16986
|
-
return Module;
|
|
16987
|
-
});
|
|
16988
|
-
}
|
|
16989
|
-
function loadRemoteModule(options) {
|
|
16990
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16991
|
-
yield loadRemoteEntry(options.remoteEntry);
|
|
16992
|
-
return yield lookupExposedModule(options.remoteName, options.exposedModule);
|
|
16993
|
-
});
|
|
16994
|
-
}
|
|
16995
|
-
function loadRemotePageModule(remoteName, module, environment) {
|
|
16996
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16997
|
-
let remoteEntry = `${environment.clientDomain.appDomain}/${remoteName}/remoteEntry.js`;
|
|
16998
|
-
if (!environment.production) {
|
|
16999
|
-
remoteEntry = `${environment.clientDomain[remoteName]}/remoteEntry.js`;
|
|
17000
|
-
}
|
|
17001
|
-
const options = {
|
|
17002
|
-
remoteName: remoteName,
|
|
17003
|
-
remoteEntry: remoteEntry,
|
|
17004
|
-
exposedModule: module,
|
|
17005
|
-
};
|
|
17006
|
-
return yield loadRemoteModule(options);
|
|
17007
|
-
});
|
|
17008
|
-
}
|
|
17009
|
-
|
|
17010
|
-
class FederationService {
|
|
17011
|
-
constructor(resolver, _moduleConfigService) {
|
|
17012
|
-
this.resolver = resolver;
|
|
17013
|
-
this._moduleConfigService = _moduleConfigService;
|
|
17014
|
-
this.environment = _moduleConfigService.getConfig().environment;
|
|
17015
|
-
}
|
|
17016
|
-
loadRemoteComponent(remoteName, componentName, viewContainerRef) {
|
|
17017
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17018
|
-
let remoteEntry = `${this.environment.clientDomain.appDomain}/${remoteName}/remoteEntry.js`;
|
|
17019
|
-
if (!this.environment.production) {
|
|
17020
|
-
remoteEntry = `${this.environment.clientDomain[remoteName]}/remoteEntry.js`;
|
|
17021
|
-
}
|
|
17022
|
-
const options = {
|
|
17023
|
-
remoteName: remoteName,
|
|
17024
|
-
remoteEntry: remoteEntry,
|
|
17025
|
-
exposedModule: componentName,
|
|
17026
|
-
};
|
|
17027
|
-
const component = yield loadRemoteModule(options);
|
|
17028
|
-
const componentFactory = this.resolver.resolveComponentFactory(component[componentName]);
|
|
17029
|
-
const viewContainer = viewContainerRef.viewContainerRef;
|
|
17030
|
-
viewContainer.clear();
|
|
17031
|
-
const compRef = viewContainer.createComponent(componentFactory);
|
|
17032
|
-
return compRef;
|
|
17033
|
-
});
|
|
17034
|
-
}
|
|
17035
|
-
loadRemoteNewComponent(remoteName, componentName, viewContainerRef) {
|
|
17036
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17037
|
-
let remoteEntry = `${this.environment.clientDomain.appDomain}/${remoteName}/remoteEntry.js`;
|
|
17038
|
-
if (!this.environment.production) {
|
|
17039
|
-
remoteEntry = `${this.environment.clientDomain[remoteName]}/remoteEntry.js`;
|
|
17040
|
-
}
|
|
17041
|
-
const options = {
|
|
17042
|
-
remoteName: remoteName,
|
|
17043
|
-
remoteEntry: remoteEntry,
|
|
17044
|
-
exposedModule: componentName,
|
|
17045
|
-
};
|
|
17046
|
-
const component = yield loadRemoteModule(options);
|
|
17047
|
-
const componentFactory = this.resolver.resolveComponentFactory(component[componentName]);
|
|
17048
|
-
viewContainerRef.clear();
|
|
17049
|
-
const compRef = viewContainerRef.createComponent(componentFactory);
|
|
17050
|
-
return compRef;
|
|
17051
|
-
});
|
|
17052
|
-
}
|
|
17053
|
-
}
|
|
17054
|
-
FederationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function FederationService_Factory() { return new FederationService(i0.ɵɵinject(i0.ComponentFactoryResolver), i0.ɵɵinject(ModuleConfigService)); }, token: FederationService, providedIn: "root" });
|
|
17055
|
-
FederationService.decorators = [
|
|
17056
|
-
{ type: Injectable, args: [{
|
|
17057
|
-
providedIn: 'root'
|
|
17058
|
-
},] }
|
|
17059
|
-
];
|
|
17060
|
-
FederationService.ctorParameters = () => [
|
|
17061
|
-
{ type: ComponentFactoryResolver },
|
|
17062
|
-
{ type: ModuleConfigService }
|
|
17063
|
-
];
|
|
17064
|
-
|
|
17065
|
-
class CoCauToChucService extends BaseService {
|
|
17066
|
-
constructor(http, injector, _moduleConfigService) {
|
|
17067
|
-
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.userOrgEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/organization`);
|
|
17068
|
-
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.userOrgEndpoint;
|
|
17069
|
-
this.environment = _moduleConfigService.getConfig().environment;
|
|
17070
|
-
if (this.isUseOldOrganization()) {
|
|
17071
|
-
this.serviceUri = `${this.environment.apiDomain.organizationEndpoint}/organization`;
|
|
17072
|
-
}
|
|
17073
|
-
}
|
|
17074
|
-
createDropdownTree(field = 'idDonViQuanLy') {
|
|
17075
|
-
return new DropdownControlSchema({
|
|
17076
|
-
field,
|
|
17077
|
-
placeholder: 'Chọn đơn vị',
|
|
17078
|
-
baseService: this,
|
|
17079
|
-
sortField: 'idDuongDan',
|
|
17080
|
-
fieldPlus: 'idDuongDan',
|
|
17081
|
-
isTree: true,
|
|
17082
|
-
fieldTree: 'idCha',
|
|
17083
|
-
valueParentRoot: this._commonService.guidEmpty(),
|
|
17084
|
-
// isServerLoad: true, Option này đang không chạy được trong case này
|
|
17085
|
-
loadOnInit: true,
|
|
17086
|
-
maxItemDisplay: 9999
|
|
17087
|
-
// funcGetLabel: (item) => {
|
|
17088
|
-
// let level = item.idDuongDan.split(';').length - 2;
|
|
17089
|
-
// let prefix = '';
|
|
17090
|
-
// if (level < 2)
|
|
17091
|
-
// level = 1;
|
|
17092
|
-
// else
|
|
17093
|
-
// prefix = '|';
|
|
17094
|
-
// return `${prefix}${'---'.repeat(level - 1)} ${item.ten}`;
|
|
17095
|
-
// }
|
|
17096
|
-
});
|
|
17097
|
-
}
|
|
17098
|
-
isUseOldOrganization() {
|
|
17099
|
-
const useOldOrganization = this.environment.useOldOrganization;
|
|
17100
|
-
if (useOldOrganization) {
|
|
17101
|
-
return true;
|
|
17102
|
-
}
|
|
17103
|
-
return false;
|
|
17104
|
-
}
|
|
17105
|
-
getByParentCode(organizationCode) {
|
|
17106
|
-
let apiUrl = `${this.serviceUri}/GetByParentCode`;
|
|
17107
|
-
if (organizationCode) {
|
|
17108
|
-
apiUrl = `${apiUrl}?parentCode=${organizationCode}`;
|
|
17109
|
-
}
|
|
17110
|
-
return this.defaultGet(apiUrl);
|
|
17111
|
-
}
|
|
17112
|
-
getByCanBoId(canBoId) {
|
|
17113
|
-
const apiUrl = `${this.serviceUri}/GetByCanBoId/${canBoId}`;
|
|
17114
|
-
return this.defaultGet(apiUrl);
|
|
17115
|
-
}
|
|
17116
|
-
getCoCauToChucTreeTable(isIgnoreClientCache = false) {
|
|
17117
|
-
const apiUrl = `${this.serviceUri}/GetTreeTable`;
|
|
17118
|
-
if (isIgnoreClientCache) {
|
|
17119
|
-
return this.getIgnoreClientCache(apiUrl);
|
|
17120
|
-
}
|
|
17121
|
-
return this.defaultGet(apiUrl);
|
|
17122
|
-
}
|
|
17123
|
-
updateMaPhanCap(idCha) {
|
|
17124
|
-
return this.defaultPost(`${this.serviceUri}/UpdateMaPhanCap/${idCha}`, {});
|
|
17125
|
-
}
|
|
17126
|
-
}
|
|
17127
|
-
CoCauToChucService.ɵprov = i0.ɵɵdefineInjectable({ factory: function CoCauToChucService_Factory() { return new CoCauToChucService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService)); }, token: CoCauToChucService, providedIn: "root" });
|
|
17128
|
-
CoCauToChucService.decorators = [
|
|
17129
|
-
{ type: Injectable, args: [{
|
|
17130
|
-
providedIn: 'root'
|
|
17131
|
-
},] }
|
|
17132
|
-
];
|
|
17133
|
-
CoCauToChucService.ctorParameters = () => [
|
|
17134
|
-
{ type: HttpClient },
|
|
17135
|
-
{ type: Injector },
|
|
17136
|
-
{ type: ModuleConfigService }
|
|
17137
|
-
];
|
|
17138
|
-
|
|
17139
|
-
class CanBo_HoSo_CoCauToChucService extends BaseService {
|
|
17140
|
-
constructor(http, injector, _moduleConfigService) {
|
|
17141
|
-
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.canboEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/CanBo_HoSo_CoCauToChuc`);
|
|
17142
|
-
this._moduleConfigService = _moduleConfigService;
|
|
17143
|
-
this.entityName = 'CanBo_HoSo_CoCauToChuc';
|
|
17144
|
-
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.canboEndpoint;
|
|
17145
|
-
}
|
|
17146
|
-
sapNhapCoCauToChuc(model) {
|
|
17147
|
-
return this.defaultPost(`${this.serviceUri}/SapNhapCoCauToChuc`, model);
|
|
17148
|
-
}
|
|
17149
|
-
getIdsDonViByCanBoLogin() {
|
|
17150
|
-
return this.defaultGet(`${this.serviceUri}/GetIdsDonViByCanBoLogin`);
|
|
17151
|
-
}
|
|
17152
|
-
getDonViChucVuCapCaoNhatByIdsCanBo(idsCanBo = []) {
|
|
17153
|
-
return this.defaultPost(`${this.serviceUri}/GetDonViChucVuCapCaoNhatByIdsCanBo`, idsCanBo);
|
|
17154
|
-
}
|
|
17155
|
-
unshiftColumnKhoaVienBoMon(modelSchemas, cols) {
|
|
17156
|
-
modelSchemas.unshift(...[new ModelSchema({
|
|
17157
|
-
field: 'donVi',
|
|
17158
|
-
name: 'Khoa viện/ đơn vị',
|
|
17159
|
-
fullName: 'Khoa viện/ đơn vị',
|
|
17160
|
-
description: 'Khoa viện/ đơn vị'
|
|
17161
|
-
}),
|
|
17162
|
-
new ModelSchema({
|
|
17163
|
-
field: 'boMon',
|
|
17164
|
-
name: 'Bộ môn/ văn phòng khoa',
|
|
17165
|
-
fullName: 'Bộ môn/ văn phòng khoa',
|
|
17166
|
-
description: 'Bộ môn/ văn phòng khoa'
|
|
17167
|
-
})]);
|
|
17168
|
-
cols.unshift(...[new ColumnSchemaBase({
|
|
17169
|
-
field: 'donVi',
|
|
17170
|
-
dataType: 'html',
|
|
17171
|
-
width: '200px',
|
|
17172
|
-
allowFilter: false,
|
|
17173
|
-
sort: false
|
|
17174
|
-
}),
|
|
17175
|
-
new ColumnSchemaBase({
|
|
17176
|
-
field: 'boMon',
|
|
17177
|
-
dataType: 'html',
|
|
17178
|
-
width: '200px',
|
|
17179
|
-
allowFilter: false,
|
|
17180
|
-
sort: false
|
|
17181
|
-
})]);
|
|
17182
|
-
}
|
|
17183
|
-
getsDonViTheoCap(dataSource = []) {
|
|
17184
|
-
return this.defaultPost(`${this.serviceUri}/GetsDonViTheoCap`, dataSource);
|
|
17185
|
-
}
|
|
17186
|
-
getKhoaVienBoMonAfterGetData(dataSource) {
|
|
17187
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17188
|
-
const items = dataSource.map(x => ({ idCanBo: x.idCanBo }));
|
|
17189
|
-
const lstDonViTheoCap = (yield this.getsDonViTheoCap(items)).data;
|
|
17190
|
-
if (lstDonViTheoCap.length == dataSource.length) {
|
|
17191
|
-
dataSource.forEach((element, index) => {
|
|
17192
|
-
element.donVi = lstDonViTheoCap[index].lstDonViCap2.join('<br/>');
|
|
17193
|
-
element.boMon = lstDonViTheoCap[index].lstDonViCap3.join('<br/>');
|
|
17194
|
-
});
|
|
16843
|
+
const items = dataSource.map(x => ({ idCanBo: x.idCanBo }));
|
|
16844
|
+
const lstDonViTheoCap = (yield this.getsDonViTheoCap(items)).data;
|
|
16845
|
+
if (lstDonViTheoCap.length == dataSource.length) {
|
|
16846
|
+
dataSource.forEach((element, index) => {
|
|
16847
|
+
element.donVi = lstDonViTheoCap[index].lstDonViCap2.join('<br/>');
|
|
16848
|
+
element.boMon = lstDonViTheoCap[index].lstDonViCap3.join('<br/>');
|
|
16849
|
+
});
|
|
17195
16850
|
}
|
|
17196
16851
|
});
|
|
17197
16852
|
}
|
|
@@ -17909,300 +17564,662 @@ CanBoHoSoService.ctorParameters = () => [
|
|
|
17909
17564
|
{ type: CrudService }
|
|
17910
17565
|
];
|
|
17911
17566
|
|
|
17912
|
-
class
|
|
17567
|
+
class EntityWorkflowHistoryService extends BaseService {
|
|
17913
17568
|
constructor(http, injector, _moduleConfigService) {
|
|
17914
|
-
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.
|
|
17915
|
-
this.
|
|
17916
|
-
this.
|
|
17917
|
-
this.
|
|
17918
|
-
this.
|
|
17569
|
+
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.userOrgEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/EntityWorkflowHistory`);
|
|
17570
|
+
this.entityName = 'EntityWorkflowHistory';
|
|
17571
|
+
this.serviceManagers = {};
|
|
17572
|
+
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.userOrgEndpoint;
|
|
17573
|
+
this._moduleConfig = _moduleConfigService.getConfig();
|
|
17919
17574
|
}
|
|
17920
|
-
|
|
17921
|
-
|
|
17575
|
+
registerService(entityName, service) {
|
|
17576
|
+
this.serviceManagers[entityName] = service;
|
|
17922
17577
|
}
|
|
17923
|
-
|
|
17924
|
-
return
|
|
17578
|
+
getEndpointByService(service) {
|
|
17579
|
+
return `${service.endPoint}/${this._moduleConfig.environment.apiVersion}`;
|
|
17925
17580
|
}
|
|
17926
|
-
|
|
17927
|
-
|
|
17581
|
+
setCurrentServiceUri(tableName) {
|
|
17582
|
+
const service = this.serviceManagers[tableName];
|
|
17583
|
+
if (service == undefined) {
|
|
17584
|
+
(this._injector.get(NotifierService)).showWarning('Bạn chưa đăng ký base service cho entity workflow history');
|
|
17585
|
+
}
|
|
17586
|
+
this.serviceUri = `${this.getEndpointByService(service)}/EntityWorkflowHistory`;
|
|
17587
|
+
}
|
|
17588
|
+
getLastHistory(tableName, filters = []) {
|
|
17589
|
+
const service = this.serviceManagers[tableName];
|
|
17590
|
+
if (service == undefined) {
|
|
17591
|
+
(this._injector.get(NotifierService)).showWarning('Bạn chưa đăng ký base service cho entity workflow history');
|
|
17592
|
+
}
|
|
17593
|
+
const url = `${this.getEndpointByService(service)}/EntityWorkflowHistory/GetLastByFilter`;
|
|
17594
|
+
const gridInfo = {
|
|
17595
|
+
pageInfo: {
|
|
17596
|
+
page: 1,
|
|
17597
|
+
pageSize: 1
|
|
17598
|
+
},
|
|
17599
|
+
filters,
|
|
17600
|
+
sorts: [
|
|
17601
|
+
new Sort({ field: 'created', dir: 1 })
|
|
17602
|
+
]
|
|
17603
|
+
};
|
|
17604
|
+
return this.defaultPost(url, gridInfo);
|
|
17605
|
+
}
|
|
17606
|
+
}
|
|
17607
|
+
EntityWorkflowHistoryService.ɵprov = i0.ɵɵdefineInjectable({ factory: function EntityWorkflowHistoryService_Factory() { return new EntityWorkflowHistoryService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService)); }, token: EntityWorkflowHistoryService, providedIn: "root" });
|
|
17608
|
+
EntityWorkflowHistoryService.decorators = [
|
|
17609
|
+
{ type: Injectable, args: [{
|
|
17610
|
+
providedIn: 'root'
|
|
17611
|
+
},] }
|
|
17612
|
+
];
|
|
17613
|
+
EntityWorkflowHistoryService.ctorParameters = () => [
|
|
17614
|
+
{ type: HttpClient },
|
|
17615
|
+
{ type: Injector },
|
|
17616
|
+
{ type: ModuleConfigService }
|
|
17617
|
+
];
|
|
17618
|
+
|
|
17619
|
+
const EXCEL_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
|
|
17620
|
+
const EXCEL_EXTENSION = '.xlsx';
|
|
17621
|
+
class ExportService {
|
|
17622
|
+
constructor(_http, _injector, _commonService, _moduleConfigService) {
|
|
17623
|
+
this._http = _http;
|
|
17624
|
+
this._injector = _injector;
|
|
17625
|
+
this._commonService = _commonService;
|
|
17626
|
+
this._moduleConfig = _moduleConfigService.getConfig();
|
|
17627
|
+
this.environment = this._moduleConfig.environment;
|
|
17628
|
+
this.serviceUri = `${this._moduleConfig.environment.apiDomain.templateEndpoint}/Export`;
|
|
17629
|
+
}
|
|
17630
|
+
objectToExcel(data, fileName, numOfHeaderRow) {
|
|
17631
|
+
return this._http
|
|
17632
|
+
.post(`${this.serviceUri}/ObjectToExcel?numOfHeaderRow=${numOfHeaderRow}`, data, { responseType: 'blob' })
|
|
17633
|
+
.pipe(catchError((err) => this._commonService.handleError(err, this._injector)))
|
|
17634
|
+
.subscribe(res => {
|
|
17635
|
+
this.saveAsExcelFile(res, fileName);
|
|
17636
|
+
});
|
|
17637
|
+
}
|
|
17638
|
+
saveAsExcelFile(buffer, fileName) {
|
|
17639
|
+
const data = new Blob([buffer], {
|
|
17640
|
+
type: EXCEL_TYPE
|
|
17641
|
+
});
|
|
17642
|
+
FileSaver__default.saveAs(data, fileName + '_' + new Date().getTime() + EXCEL_EXTENSION);
|
|
17643
|
+
}
|
|
17644
|
+
saveSpreadSheet(buffer, fileName) {
|
|
17645
|
+
const data = new Blob([buffer], {
|
|
17646
|
+
type: EXCEL_TYPE
|
|
17647
|
+
});
|
|
17648
|
+
FileSaver__default.saveAs(data, new Date().getTime() + '_' + fileName);
|
|
17649
|
+
}
|
|
17650
|
+
}
|
|
17651
|
+
ExportService.ɵprov = i0.ɵɵdefineInjectable({ factory: function ExportService_Factory() { return new ExportService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(CommonService), i0.ɵɵinject(ModuleConfigService)); }, token: ExportService, providedIn: "root" });
|
|
17652
|
+
ExportService.decorators = [
|
|
17653
|
+
{ type: Injectable, args: [{
|
|
17654
|
+
providedIn: 'root'
|
|
17655
|
+
},] }
|
|
17656
|
+
];
|
|
17657
|
+
ExportService.ctorParameters = () => [
|
|
17658
|
+
{ type: HttpClient },
|
|
17659
|
+
{ type: Injector },
|
|
17660
|
+
{ type: CommonService },
|
|
17661
|
+
{ type: ModuleConfigService }
|
|
17662
|
+
];
|
|
17663
|
+
|
|
17664
|
+
const moduleMap = {};
|
|
17665
|
+
function loadRemoteEntry(remoteEntry) {
|
|
17666
|
+
return new Promise((resolve, reject) => {
|
|
17667
|
+
if (moduleMap[remoteEntry]) {
|
|
17668
|
+
resolve();
|
|
17669
|
+
return;
|
|
17670
|
+
}
|
|
17671
|
+
const script = document.createElement('script');
|
|
17672
|
+
script.src = remoteEntry;
|
|
17673
|
+
script.onerror = reject;
|
|
17674
|
+
script.onload = () => {
|
|
17675
|
+
moduleMap[remoteEntry] = true;
|
|
17676
|
+
resolve(); // window is the global namespace
|
|
17677
|
+
};
|
|
17678
|
+
document.body.append(script);
|
|
17679
|
+
});
|
|
17680
|
+
}
|
|
17681
|
+
function lookupExposedModule(remoteName, exposedModule) {
|
|
17682
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17683
|
+
// Initializes the share scope. This fills it with known provided modules from this build and all remotes
|
|
17684
|
+
yield __webpack_init_sharing__('default');
|
|
17685
|
+
const container = window[remoteName]; // or get the container somewhere else
|
|
17686
|
+
// Initialize the container, it may provide shared modules
|
|
17687
|
+
yield container.init(__webpack_share_scopes__.default);
|
|
17688
|
+
const factory = yield container.get(exposedModule);
|
|
17689
|
+
const Module = factory();
|
|
17690
|
+
return Module;
|
|
17691
|
+
});
|
|
17692
|
+
}
|
|
17693
|
+
function loadRemoteModule(options) {
|
|
17694
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17695
|
+
yield loadRemoteEntry(options.remoteEntry);
|
|
17696
|
+
return yield lookupExposedModule(options.remoteName, options.exposedModule);
|
|
17697
|
+
});
|
|
17698
|
+
}
|
|
17699
|
+
function loadRemotePageModule(remoteName, module, environment) {
|
|
17700
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17701
|
+
let remoteEntry = `${environment.clientDomain.appDomain}/${remoteName}/remoteEntry.js`;
|
|
17702
|
+
if (!environment.production) {
|
|
17703
|
+
remoteEntry = `${environment.clientDomain[remoteName]}/remoteEntry.js`;
|
|
17704
|
+
}
|
|
17705
|
+
const options = {
|
|
17706
|
+
remoteName: remoteName,
|
|
17707
|
+
remoteEntry: remoteEntry,
|
|
17708
|
+
exposedModule: module,
|
|
17709
|
+
};
|
|
17710
|
+
return yield loadRemoteModule(options);
|
|
17711
|
+
});
|
|
17712
|
+
}
|
|
17713
|
+
|
|
17714
|
+
class FederationService {
|
|
17715
|
+
constructor(resolver, _moduleConfigService) {
|
|
17716
|
+
this.resolver = resolver;
|
|
17717
|
+
this._moduleConfigService = _moduleConfigService;
|
|
17718
|
+
this.environment = _moduleConfigService.getConfig().environment;
|
|
17719
|
+
}
|
|
17720
|
+
loadRemoteComponent(remoteName, componentName, viewContainerRef) {
|
|
17721
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17722
|
+
let remoteEntry = `${this.environment.clientDomain.appDomain}/${remoteName}/remoteEntry.js`;
|
|
17723
|
+
if (!this.environment.production) {
|
|
17724
|
+
remoteEntry = `${this.environment.clientDomain[remoteName]}/remoteEntry.js`;
|
|
17725
|
+
}
|
|
17726
|
+
const options = {
|
|
17727
|
+
remoteName: remoteName,
|
|
17728
|
+
remoteEntry: remoteEntry,
|
|
17729
|
+
exposedModule: componentName,
|
|
17730
|
+
};
|
|
17731
|
+
const component = yield loadRemoteModule(options);
|
|
17732
|
+
const componentFactory = this.resolver.resolveComponentFactory(component[componentName]);
|
|
17733
|
+
const viewContainer = viewContainerRef.viewContainerRef;
|
|
17734
|
+
viewContainer.clear();
|
|
17735
|
+
const compRef = viewContainer.createComponent(componentFactory);
|
|
17736
|
+
return compRef;
|
|
17737
|
+
});
|
|
17738
|
+
}
|
|
17739
|
+
loadRemoteNewComponent(remoteName, componentName, viewContainerRef) {
|
|
17740
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17741
|
+
let remoteEntry = `${this.environment.clientDomain.appDomain}/${remoteName}/remoteEntry.js`;
|
|
17742
|
+
if (!this.environment.production) {
|
|
17743
|
+
remoteEntry = `${this.environment.clientDomain[remoteName]}/remoteEntry.js`;
|
|
17744
|
+
}
|
|
17745
|
+
const options = {
|
|
17746
|
+
remoteName: remoteName,
|
|
17747
|
+
remoteEntry: remoteEntry,
|
|
17748
|
+
exposedModule: componentName,
|
|
17749
|
+
};
|
|
17750
|
+
const component = yield loadRemoteModule(options);
|
|
17751
|
+
const componentFactory = this.resolver.resolveComponentFactory(component[componentName]);
|
|
17752
|
+
viewContainerRef.clear();
|
|
17753
|
+
const compRef = viewContainerRef.createComponent(componentFactory);
|
|
17754
|
+
return compRef;
|
|
17755
|
+
});
|
|
17928
17756
|
}
|
|
17929
17757
|
}
|
|
17930
|
-
|
|
17931
|
-
|
|
17758
|
+
FederationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function FederationService_Factory() { return new FederationService(i0.ɵɵinject(i0.ComponentFactoryResolver), i0.ɵɵinject(ModuleConfigService)); }, token: FederationService, providedIn: "root" });
|
|
17759
|
+
FederationService.decorators = [
|
|
17932
17760
|
{ type: Injectable, args: [{
|
|
17933
17761
|
providedIn: 'root'
|
|
17934
17762
|
},] }
|
|
17935
17763
|
];
|
|
17936
|
-
|
|
17937
|
-
{ type:
|
|
17938
|
-
{ type: Injector },
|
|
17764
|
+
FederationService.ctorParameters = () => [
|
|
17765
|
+
{ type: ComponentFactoryResolver },
|
|
17939
17766
|
{ type: ModuleConfigService }
|
|
17940
17767
|
];
|
|
17941
17768
|
|
|
17942
|
-
class
|
|
17943
|
-
constructor(
|
|
17944
|
-
|
|
17945
|
-
this.
|
|
17946
|
-
this.
|
|
17947
|
-
this.
|
|
17948
|
-
|
|
17769
|
+
class PhanQuyenModel {
|
|
17770
|
+
constructor(init) {
|
|
17771
|
+
this.addRoleIds = [];
|
|
17772
|
+
this.removeRoleIds = [];
|
|
17773
|
+
this.addPermissionIds = [];
|
|
17774
|
+
this.removePermissionIds = [];
|
|
17775
|
+
for (const key in init) {
|
|
17776
|
+
this[key] = init[key];
|
|
17777
|
+
}
|
|
17949
17778
|
}
|
|
17950
17779
|
}
|
|
17951
|
-
|
|
17952
|
-
|
|
17953
|
-
|
|
17954
|
-
providedIn: 'root'
|
|
17955
|
-
},] }
|
|
17956
|
-
];
|
|
17957
|
-
CauHinhWorkflowService.ctorParameters = () => [
|
|
17958
|
-
{ type: HttpClient },
|
|
17959
|
-
{ type: Injector },
|
|
17960
|
-
{ type: ModuleConfigService }
|
|
17961
|
-
];
|
|
17962
|
-
|
|
17963
|
-
class DmLoaiCongViecService extends BaseService {
|
|
17964
|
-
constructor(http, injector, _moduleConfigService) {
|
|
17965
|
-
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.congviecEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/DM_LoaiCongViec`);
|
|
17780
|
+
class PermissionService extends BaseService {
|
|
17781
|
+
constructor(http, injector, _moduleConfigService, _userService, _oauthService, _appContext) {
|
|
17782
|
+
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.authorizationEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/permission`);
|
|
17966
17783
|
this._moduleConfigService = _moduleConfigService;
|
|
17967
|
-
this.
|
|
17968
|
-
this.
|
|
17969
|
-
this.
|
|
17970
|
-
this.
|
|
17971
|
-
this.
|
|
17972
|
-
|
|
17973
|
-
|
|
17784
|
+
this._userService = _userService;
|
|
17785
|
+
this._oauthService = _oauthService;
|
|
17786
|
+
this._appContext = _appContext;
|
|
17787
|
+
this.storage = sessionStorage;
|
|
17788
|
+
this.ignoreAdmin = false;
|
|
17789
|
+
this.delayCheckPermissions = [];
|
|
17790
|
+
this.appCode = null;
|
|
17791
|
+
this._config = this._moduleConfigService.getConfig();
|
|
17792
|
+
this.endPoint = this._config.environment.apiDomain.authorizationEndpoint;
|
|
17793
|
+
this.ignoreAdmin = this._config.environment.isIgnoreAdmin;
|
|
17794
|
+
this.appCode = this._config.appCode;
|
|
17795
|
+
}
|
|
17796
|
+
clearPermissionCacheAll() {
|
|
17797
|
+
var _a, _b, _c;
|
|
17798
|
+
const lstAppCodes = (_c = (_b = (_a = this._config.environment.appMetadata) === null || _a === void 0 ? void 0 : _a.appSwitcher) === null || _b === void 0 ? void 0 : _b.map(app => app.code)) !== null && _c !== void 0 ? _c : [];
|
|
17799
|
+
const lstApiEndpoint = [];
|
|
17800
|
+
const apiDomain = this._config.environment.apiDomain;
|
|
17801
|
+
for (const domainName in apiDomain) {
|
|
17802
|
+
if (domainName.startsWith('-') || domainName.startsWith('1') || domainName == 'gateway')
|
|
17803
|
+
continue;
|
|
17804
|
+
const realDomainName = domainName.split('Endpoint') ? domainName.split('Endpoint')[0] : domainName;
|
|
17805
|
+
lstApiEndpoint.push(realDomainName.toUpperCase());
|
|
17806
|
+
}
|
|
17807
|
+
return this.clearPermissionCache([...lstAppCodes, ...lstApiEndpoint]);
|
|
17808
|
+
}
|
|
17809
|
+
clearPermissionCache(lstModule) {
|
|
17810
|
+
const url = `${this.serviceUri}/ClearPermissionCache`;
|
|
17811
|
+
return this.defaultPost(url, lstModule);
|
|
17812
|
+
}
|
|
17813
|
+
getCurrentUserPermission() {
|
|
17814
|
+
const url = `${this.serviceUri}/GetCurrentUserPermission`;
|
|
17815
|
+
return this.defaultGet(url);
|
|
17816
|
+
}
|
|
17817
|
+
getAllBasePermission(userId) {
|
|
17818
|
+
var _a, _b, _c;
|
|
17819
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17820
|
+
const url = `${this.serviceUri}/GetAllBasePermission`;
|
|
17821
|
+
// return sớm vì đây là trường hợp lấy permission theo Id của User
|
|
17822
|
+
// ko set local storage vì sẽ làm hỏng quyền của người dùng hiện tại
|
|
17823
|
+
if (userId && userId != '' && userId != this._commonService.guidEmpty()) {
|
|
17824
|
+
return this.defaultGet(url + `?userId=${userId}`);
|
|
17825
|
+
}
|
|
17826
|
+
if (isDevMode()) {
|
|
17827
|
+
return;
|
|
17828
|
+
}
|
|
17829
|
+
const user = this._userService.getCurrentUser();
|
|
17830
|
+
if (user
|
|
17831
|
+
&& (user.issuperuser && user.issuperuser.toLowerCase() == 'true')
|
|
17832
|
+
|| (user.isadmin && user.isadmin.toLowerCase() == 'true' && !this.ignoreAdmin)) {
|
|
17833
|
+
return;
|
|
17834
|
+
}
|
|
17835
|
+
const res = yield this.defaultGet(url);
|
|
17836
|
+
const lstAppCodes = (_c = (_b = (_a = this._config.environment.appMetadata) === null || _a === void 0 ? void 0 : _a.appSwitcher) === null || _b === void 0 ? void 0 : _b.map(app => app.code)) !== null && _c !== void 0 ? _c : [];
|
|
17837
|
+
// Nếu Có error lấy dữ liệu quyền tổng hợp thì quay về lấy dữ liệu quyền dựa vào từng module
|
|
17838
|
+
if (!res || !res.success || res.data == null) {
|
|
17839
|
+
const promiseArr = [];
|
|
17840
|
+
for (const code of lstAppCodes) {
|
|
17841
|
+
promiseArr.push(this.getServicePermission(code, true));
|
|
17842
|
+
}
|
|
17843
|
+
yield Promise.all(promiseArr);
|
|
17844
|
+
return;
|
|
17845
|
+
}
|
|
17846
|
+
// Set local storage cho permission của người dùng
|
|
17847
|
+
for (const service of lstAppCodes) {
|
|
17848
|
+
let permissions = [];
|
|
17849
|
+
const serviceCode = service.toUpperCase();
|
|
17850
|
+
for (const key in res.data) {
|
|
17851
|
+
if (key.toUpperCase() != serviceCode) {
|
|
17852
|
+
continue;
|
|
17853
|
+
}
|
|
17854
|
+
permissions = res.data[key];
|
|
17855
|
+
break;
|
|
17856
|
+
}
|
|
17857
|
+
const key = `AUTHORIZATION.${serviceCode}`;
|
|
17858
|
+
const storageItem = this.storage.getItem(key);
|
|
17859
|
+
if (storageItem != null) {
|
|
17860
|
+
this.storage.removeItem(key);
|
|
17861
|
+
}
|
|
17862
|
+
this.storage.setItem(key, JSON.stringify(permissions));
|
|
17863
|
+
}
|
|
17864
|
+
});
|
|
17865
|
+
}
|
|
17866
|
+
/**
|
|
17867
|
+
* Truyền vào danh sách permision cần check
|
|
17868
|
+
* @param lstPermissionCode những perrmision code cần check => nên dùng trong trường hợp check các button trong code
|
|
17869
|
+
* @returns trả ra các perrmisionCode có quyền
|
|
17870
|
+
*/
|
|
17871
|
+
getPermissionAuthorized(lstPermissionCode) {
|
|
17872
|
+
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
17873
|
+
const user = (yield this._userService.getCurrentUser());
|
|
17874
|
+
if (user && user.issuperuser.toLowerCase() == 'true') {
|
|
17875
|
+
resolve(lstPermissionCode);
|
|
17876
|
+
return;
|
|
17877
|
+
}
|
|
17878
|
+
if (user && user.isadmin.toLowerCase() == 'true' && !this.ignoreAdmin) {
|
|
17879
|
+
resolve(lstPermissionCode);
|
|
17880
|
+
return;
|
|
17881
|
+
}
|
|
17882
|
+
const result = [];
|
|
17883
|
+
for (const item of lstPermissionCode) {
|
|
17884
|
+
if (yield this.isAuthorizedPermission(item)) {
|
|
17885
|
+
result.push(item);
|
|
17886
|
+
}
|
|
17887
|
+
}
|
|
17888
|
+
resolve(result);
|
|
17889
|
+
}));
|
|
17890
|
+
}
|
|
17891
|
+
isAuthorizedPermission(permission) {
|
|
17892
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17893
|
+
let retryCount = 0;
|
|
17894
|
+
while (!this._oauthService.hasValidAccessToken()) {
|
|
17895
|
+
yield this._commonService.delay(100);
|
|
17896
|
+
retryCount++;
|
|
17897
|
+
if (retryCount > 50) {
|
|
17898
|
+
break;
|
|
17899
|
+
}
|
|
17900
|
+
}
|
|
17901
|
+
return yield this.checkPermission(this.appCode, permission);
|
|
17902
|
+
});
|
|
17903
|
+
}
|
|
17904
|
+
isAuthorized(service, permission, checForMenu = false) {
|
|
17905
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17906
|
+
this.root = this._appContext.getRootContext();
|
|
17907
|
+
let retryCount = 0;
|
|
17908
|
+
while (!this._oauthService.hasValidAccessToken()) {
|
|
17909
|
+
yield this._commonService.delay(100);
|
|
17910
|
+
retryCount++;
|
|
17911
|
+
if (retryCount > 50) {
|
|
17912
|
+
break;
|
|
17913
|
+
}
|
|
17914
|
+
}
|
|
17915
|
+
return yield this.checkPermission(service, permission, checForMenu);
|
|
17916
|
+
});
|
|
17917
|
+
}
|
|
17918
|
+
checkPermission(service, permissionToCheck, checkForMenu = false) {
|
|
17919
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17920
|
+
try {
|
|
17921
|
+
const user = this._userService.getCurrentUser();
|
|
17922
|
+
const valueIsDevMode = true;
|
|
17923
|
+
if (isDevMode() && valueIsDevMode) {
|
|
17924
|
+
return true;
|
|
17925
|
+
}
|
|
17926
|
+
if (user && user.issuperuser && user.issuperuser.toLowerCase() == 'true' && valueIsDevMode) {
|
|
17927
|
+
return true;
|
|
17928
|
+
}
|
|
17929
|
+
if (user && user.isadmin && user.isadmin.toLowerCase() == 'true' && !this.ignoreAdmin && valueIsDevMode) {
|
|
17930
|
+
return true;
|
|
17931
|
+
}
|
|
17932
|
+
const userPermissions = yield this.getServicePermission(service);
|
|
17933
|
+
if (userPermissions && userPermissions.length > 0) {
|
|
17934
|
+
return checkForMenu
|
|
17935
|
+
? userPermissions.includes(permissionToCheck)
|
|
17936
|
+
: this._checkPermission(userPermissions, permissionToCheck);
|
|
17937
|
+
}
|
|
17938
|
+
else {
|
|
17939
|
+
// console.log(`Không có quyền với phân hệ [${service}]`);
|
|
17940
|
+
return false;
|
|
17941
|
+
}
|
|
17942
|
+
}
|
|
17943
|
+
catch (_a) {
|
|
17944
|
+
return false;
|
|
17945
|
+
}
|
|
17946
|
+
});
|
|
17947
|
+
}
|
|
17948
|
+
_checkPermission(userPermissions, permissionToCheck) {
|
|
17949
|
+
let isAuthorized = false;
|
|
17950
|
+
// check permission của người dùng
|
|
17951
|
+
// duyệt qua từng permission của người dùng
|
|
17952
|
+
for (const userPermission of userPermissions) {
|
|
17953
|
+
// biến để break khỏi vòng khi người dùng được authorized
|
|
17954
|
+
let breakOuterLoop = false;
|
|
17955
|
+
// pointer permission của người dùng
|
|
17956
|
+
let userPermissionPointer = 0;
|
|
17957
|
+
// pointer permission đang check
|
|
17958
|
+
let permissionToCheckPointer = 0;
|
|
17959
|
+
// mark co the check query param
|
|
17960
|
+
let aboutToCheckQueryParam = false;
|
|
17961
|
+
// check từng char của 2 mảng
|
|
17962
|
+
for (; permissionToCheckPointer < permissionToCheck.length;) {
|
|
17963
|
+
// nếu char là ký tự bắt đầu template => tịnh tiến pointer của 2 mảng
|
|
17964
|
+
let needRecheck = false;
|
|
17965
|
+
if (userPermission[userPermissionPointer] == '{') {
|
|
17966
|
+
// cho đến khi tìm được ký tự '/' tiếp theo thì dừng lại
|
|
17967
|
+
for (; userPermissionPointer < userPermission.length; userPermissionPointer++) {
|
|
17968
|
+
if (userPermissionPointer == userPermission.length - 1) {
|
|
17969
|
+
break;
|
|
17970
|
+
}
|
|
17971
|
+
if (userPermission[userPermissionPointer] != '}') {
|
|
17972
|
+
continue;
|
|
17973
|
+
}
|
|
17974
|
+
if (userPermission[userPermissionPointer] === '?') {
|
|
17975
|
+
aboutToCheckQueryParam = true;
|
|
17976
|
+
}
|
|
17977
|
+
++userPermissionPointer; // tiến tiến đến ký tự sau kết thúc template
|
|
17978
|
+
// check trường hợp trường hợp chuỗi template có dạng "{template}acsekjf"
|
|
17979
|
+
// => cần check các ký tự sau template và trước ký tự '/'
|
|
17980
|
+
if (userPermission[userPermissionPointer] != '/' && (aboutToCheckQueryParam && userPermission[userPermissionPointer] != '&')) {
|
|
17981
|
+
needRecheck = true;
|
|
17982
|
+
for (; userPermissionPointer < userPermission.length; userPermissionPointer++) {
|
|
17983
|
+
if (userPermissionPointer == userPermission.length - 1) {
|
|
17984
|
+
break;
|
|
17985
|
+
}
|
|
17986
|
+
if (userPermission[userPermissionPointer] != '/') {
|
|
17987
|
+
continue;
|
|
17988
|
+
}
|
|
17989
|
+
break;
|
|
17990
|
+
}
|
|
17991
|
+
}
|
|
17992
|
+
break;
|
|
17993
|
+
}
|
|
17994
|
+
for (; permissionToCheckPointer < permissionToCheck.length; permissionToCheckPointer++) {
|
|
17995
|
+
if (permissionToCheckPointer == permissionToCheck.length - 1) {
|
|
17996
|
+
break;
|
|
17997
|
+
}
|
|
17998
|
+
if (permissionToCheck[permissionToCheckPointer] == '/' || (aboutToCheckQueryParam && permissionToCheck[permissionToCheckPointer] == '&')) {
|
|
17999
|
+
break;
|
|
18000
|
+
}
|
|
18001
|
+
}
|
|
18002
|
+
}
|
|
18003
|
+
let breakInnerLoop = false;
|
|
18004
|
+
if (needRecheck) {
|
|
18005
|
+
// check lại cho trường hợp chuỗi template có dạng "{template}acslekfj"
|
|
18006
|
+
// duyệt ngược lại cho đến khi gặp ký tự kết thúc template
|
|
18007
|
+
let tempUserPointer = userPermissionPointer;
|
|
18008
|
+
let tempToCheckPointer = permissionToCheckPointer;
|
|
18009
|
+
while (userPermission[tempUserPointer] != '}') {
|
|
18010
|
+
// ký tự khác nhau => break khỏi vòng kiểm tra trong
|
|
18011
|
+
if (userPermission[tempUserPointer].toLowerCase() != permissionToCheck[tempToCheckPointer].toLowerCase()) {
|
|
18012
|
+
breakInnerLoop = true;
|
|
18013
|
+
break;
|
|
18014
|
+
}
|
|
18015
|
+
tempUserPointer--;
|
|
18016
|
+
tempToCheckPointer--;
|
|
18017
|
+
}
|
|
18018
|
+
}
|
|
18019
|
+
if (breakInnerLoop) {
|
|
18020
|
+
break;
|
|
18021
|
+
}
|
|
18022
|
+
const userChar = userPermission[userPermissionPointer].toLowerCase();
|
|
18023
|
+
const toCheckChar = permissionToCheck[permissionToCheckPointer].toLowerCase();
|
|
18024
|
+
// nếu userPermission đang ở index cuối
|
|
18025
|
+
if (userPermissionPointer == userPermission.length - 1) {
|
|
18026
|
+
// check char cuối của 2 mảng (trừ khi là ký tự kết thúc template)
|
|
18027
|
+
// và cũng phải là char cuối của mảng permission cần check
|
|
18028
|
+
// => người dùng authorized và break khỏi vòng lặp ngoài cùng
|
|
18029
|
+
if ((userChar == '}' || userChar == toCheckChar)
|
|
18030
|
+
&& permissionToCheckPointer == permissionToCheck.length - 1) {
|
|
18031
|
+
breakOuterLoop = true;
|
|
18032
|
+
isAuthorized = true;
|
|
18033
|
+
}
|
|
18034
|
+
break;
|
|
18035
|
+
}
|
|
18036
|
+
// check char có giống nhau không, không giống thì break khỏi vòng check
|
|
18037
|
+
if (userChar != toCheckChar) {
|
|
18038
|
+
break;
|
|
18039
|
+
}
|
|
18040
|
+
// nếu char giống nhau thì tiếp tục vòng lăp
|
|
18041
|
+
permissionToCheckPointer++;
|
|
18042
|
+
userPermissionPointer++;
|
|
17974
18043
|
}
|
|
17975
|
-
if (
|
|
17976
|
-
|
|
18044
|
+
if (breakOuterLoop) {
|
|
18045
|
+
break;
|
|
17977
18046
|
}
|
|
17978
|
-
|
|
17979
|
-
|
|
17980
|
-
|
|
17981
|
-
|
|
17982
|
-
|
|
17983
|
-
|
|
17984
|
-
|
|
17985
|
-
|
|
17986
|
-
|
|
17987
|
-
|
|
17988
|
-
|
|
18047
|
+
}
|
|
18048
|
+
return isAuthorized;
|
|
18049
|
+
}
|
|
18050
|
+
_checkPermissionOld(userPermissions, permissionToCheck) {
|
|
18051
|
+
let isAuthorized = false;
|
|
18052
|
+
// check quyền theo cách cũ nếu trường họp là phân quyền module
|
|
18053
|
+
if (permissionToCheck.includes('MODULE')) {
|
|
18054
|
+
return userPermissions.includes(permissionToCheck);
|
|
18055
|
+
}
|
|
18056
|
+
for (const userPermission of userPermissions) {
|
|
18057
|
+
// Cắt chuỗi permission thành mảng để xem mỗi fragement có khớp nhau không
|
|
18058
|
+
const userPermissionFragments = userPermission.split('/');
|
|
18059
|
+
const permissionFragments = permissionToCheck.split('/');
|
|
18060
|
+
// Mảng khác độ dài thì thoát sớm
|
|
18061
|
+
if (userPermissionFragments.length != permissionFragments.length) {
|
|
18062
|
+
continue;
|
|
18063
|
+
}
|
|
18064
|
+
// biến flag ra hiệu người dùng authorized và out vòng
|
|
18065
|
+
let breakLoop = false;
|
|
18066
|
+
// nếu tất cả phần tử khớp nhau => permission này trùng và người dùng được authorized
|
|
18067
|
+
for (let index = 0; index < permissionFragments.length; index++) {
|
|
18068
|
+
const userFragement = userPermissionFragments[index];
|
|
18069
|
+
const permissionFragment = permissionFragments[index];
|
|
18070
|
+
// skip qua các phần tử có ký tự bắt đầu là '{'
|
|
18071
|
+
if (userFragement[0] == '{') {
|
|
18072
|
+
if (index == permissionFragments.length - 1) {
|
|
18073
|
+
isAuthorized = true;
|
|
18074
|
+
breakLoop = true;
|
|
18075
|
+
}
|
|
18076
|
+
continue;
|
|
18077
|
+
}
|
|
18078
|
+
if (userFragement.toLowerCase() != permissionFragment.toLowerCase()) {
|
|
18079
|
+
break;
|
|
18080
|
+
}
|
|
18081
|
+
if (index == permissionFragments.length - 1) {
|
|
18082
|
+
isAuthorized = true;
|
|
18083
|
+
breakLoop = true;
|
|
17989
18084
|
}
|
|
17990
18085
|
}
|
|
17991
|
-
if (
|
|
17992
|
-
|
|
18086
|
+
if (breakLoop) {
|
|
18087
|
+
break;
|
|
17993
18088
|
}
|
|
17994
|
-
|
|
17995
|
-
|
|
17996
|
-
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.congviecEndpoint;
|
|
18089
|
+
}
|
|
18090
|
+
return isAuthorized;
|
|
17997
18091
|
}
|
|
17998
|
-
|
|
17999
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
18000
|
-
|
|
18001
|
-
|
|
18092
|
+
isAuthorizedByPermissions(permissions, operator = 'OR', ignoreAdmin = false) {
|
|
18093
|
+
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
18094
|
+
const user = (yield this._userService.getCurrentUser());
|
|
18095
|
+
if (user && user.issuperuser.toLowerCase() == 'true') {
|
|
18096
|
+
resolve(true);
|
|
18097
|
+
return;
|
|
18002
18098
|
}
|
|
18003
|
-
|
|
18004
|
-
|
|
18005
|
-
|
|
18006
|
-
if (cauHinhWorkflows == null) {
|
|
18007
|
-
notifierService.showWarning('Dịch vụ workflow không phản hồi');
|
|
18008
|
-
return [];
|
|
18099
|
+
if (user && user.isadmin.toLowerCase() == 'true' && !this.ignoreAdmin) {
|
|
18100
|
+
resolve(true);
|
|
18101
|
+
return;
|
|
18009
18102
|
}
|
|
18010
|
-
|
|
18011
|
-
|
|
18012
|
-
|
|
18013
|
-
|
|
18014
|
-
|
|
18015
|
-
|
|
18016
|
-
|
|
18017
|
-
|
|
18018
|
-
|
|
18019
|
-
|
|
18020
|
-
|
|
18103
|
+
let isAuthorized = true;
|
|
18104
|
+
if (operator.toUpperCase() == 'OR') {
|
|
18105
|
+
isAuthorized = false;
|
|
18106
|
+
}
|
|
18107
|
+
permissions.forEach(item => {
|
|
18108
|
+
this.getServicePermission(item.service).then(permissionResult => {
|
|
18109
|
+
if (operator.toUpperCase() == 'OR') {
|
|
18110
|
+
if (permissionResult.includes(item.permission)) {
|
|
18111
|
+
isAuthorized = true;
|
|
18112
|
+
return;
|
|
18113
|
+
}
|
|
18021
18114
|
}
|
|
18022
|
-
|
|
18023
|
-
|
|
18024
|
-
|
|
18025
|
-
|
|
18026
|
-
this.newFilter('code', Operator.in, workflowCodes)
|
|
18027
|
-
], new DropdownOptions({
|
|
18028
|
-
valueField: 'code',
|
|
18029
|
-
displayField: 'title',
|
|
18030
|
-
fieldPlus: 'data'
|
|
18031
|
-
})));
|
|
18032
|
-
workflows.forEach(item => {
|
|
18033
|
-
item.data = JSON.parse(item.data);
|
|
18034
|
-
const stateMachineData = item.data;
|
|
18035
|
-
stateMachineData.actions = {};
|
|
18036
|
-
stateMachineData.machines.forEach(machine => {
|
|
18037
|
-
stateMachineData.actions[machine.code] = [];
|
|
18038
|
-
stateMachineData.connections.forEach(conn => {
|
|
18039
|
-
if (conn.source == machine.id) {
|
|
18040
|
-
stateMachineData.actions[machine.code].push(conn);
|
|
18115
|
+
else {
|
|
18116
|
+
if (!permissionResult.includes(item.permission)) {
|
|
18117
|
+
isAuthorized = false;
|
|
18118
|
+
return;
|
|
18041
18119
|
}
|
|
18042
|
-
}
|
|
18120
|
+
}
|
|
18121
|
+
}, error => {
|
|
18122
|
+
reject(false);
|
|
18043
18123
|
});
|
|
18044
18124
|
});
|
|
18045
|
-
|
|
18046
|
-
|
|
18047
|
-
if (!itemWorkflowSetting.idLoaiCongViec) {
|
|
18048
|
-
this.dicWorkflowByLoaiCongViec[this.keyIdLoaiCongViecRoot] = itemWorkflowSetting;
|
|
18049
|
-
}
|
|
18050
|
-
else {
|
|
18051
|
-
this.dicWorkflowByLoaiCongViec[itemWorkflowSetting.idLoaiCongViec] = itemWorkflowSetting;
|
|
18052
|
-
}
|
|
18053
|
-
});
|
|
18054
|
-
return workflows;
|
|
18055
|
-
});
|
|
18056
|
-
}
|
|
18057
|
-
getIdLoaiCongViecs(idLoaiCongViec) {
|
|
18058
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
18059
|
-
const notifierService = this._injector.get(NotifierService);
|
|
18060
|
-
const itemLoaiCongViec = yield this.getItemLoaiCongViec(idLoaiCongViec);
|
|
18061
|
-
if (itemLoaiCongViec == null) {
|
|
18062
|
-
notifierService.showWarning('Loại công việc không tồn tại');
|
|
18063
|
-
return null;
|
|
18064
|
-
}
|
|
18065
|
-
const idLoaiCongViecs = itemLoaiCongViec.idDuongDan.split(';').filter(q => !!q);
|
|
18066
|
-
return idLoaiCongViecs;
|
|
18067
|
-
});
|
|
18068
|
-
}
|
|
18069
|
-
getItemLoaiCongViec(idLoaiCongViec) {
|
|
18070
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
18071
|
-
if (!this.dicLoaiCongViec[idLoaiCongViec]) {
|
|
18072
|
-
this.dicLoaiCongViec[idLoaiCongViec] = (yield this.getDetail(idLoaiCongViec)).data;
|
|
18073
|
-
}
|
|
18074
|
-
return this.dicLoaiCongViec[idLoaiCongViec];
|
|
18075
|
-
});
|
|
18076
|
-
}
|
|
18077
|
-
}
|
|
18078
|
-
DmLoaiCongViecService.ɵprov = i0.ɵɵdefineInjectable({ factory: function DmLoaiCongViecService_Factory() { return new DmLoaiCongViecService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService)); }, token: DmLoaiCongViecService, providedIn: "root" });
|
|
18079
|
-
DmLoaiCongViecService.decorators = [
|
|
18080
|
-
{ type: Injectable, args: [{
|
|
18081
|
-
providedIn: 'root'
|
|
18082
|
-
},] }
|
|
18083
|
-
];
|
|
18084
|
-
DmLoaiCongViecService.ctorParameters = () => [
|
|
18085
|
-
{ type: HttpClient },
|
|
18086
|
-
{ type: Injector },
|
|
18087
|
-
{ type: ModuleConfigService }
|
|
18088
|
-
];
|
|
18089
|
-
|
|
18090
|
-
class CongViecService extends BaseService {
|
|
18091
|
-
constructor(http, injector, _moduleConfigService, _dmLoaiCongViecService) {
|
|
18092
|
-
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.congviecEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/CongViec_Chinh`);
|
|
18093
|
-
this._dmLoaiCongViecService = _dmLoaiCongViecService;
|
|
18094
|
-
this.serviceCode = 'congviec';
|
|
18095
|
-
this.entityName = 'CongViec_Chinh';
|
|
18096
|
-
this.objectName = 'công việc';
|
|
18097
|
-
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.congviecEndpoint;
|
|
18098
|
-
this._moduleConfig = _moduleConfigService.getConfig();
|
|
18099
|
-
}
|
|
18100
|
-
adjustSettingWorkflowForCrudList(setting) {
|
|
18101
|
-
this.useWorkflow = true;
|
|
18102
|
-
setting.isWorkflowTree = true;
|
|
18103
|
-
setting.baseService = this;
|
|
18104
|
-
setting.displayField = (item) => item.ten;
|
|
18105
|
-
setting.baseService.useWorkflow = true;
|
|
18106
|
-
setting.workflowConfigAdvance = {
|
|
18107
|
-
getWorkflowSetting: this.getWorkflowConfig.bind(this)
|
|
18108
|
-
};
|
|
18125
|
+
resolve(isAuthorized);
|
|
18126
|
+
}));
|
|
18109
18127
|
}
|
|
18110
|
-
|
|
18128
|
+
getServicePermission(service, overrideLocalStorage = false) {
|
|
18111
18129
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18112
|
-
|
|
18130
|
+
const key = `AUTHORIZATION.${service.toUpperCase()}`;
|
|
18131
|
+
if (!overrideLocalStorage) {
|
|
18132
|
+
const storageItem = this.storage.getItem(key);
|
|
18133
|
+
if (storageItem && storageItem !== 'null') {
|
|
18134
|
+
const result = JSON.parse(storageItem);
|
|
18135
|
+
return result;
|
|
18136
|
+
}
|
|
18137
|
+
}
|
|
18138
|
+
const url = `${this.serviceUri}/GetPermissionsByService?service=${service}`;
|
|
18139
|
+
const response = yield this.defaultGet(url);
|
|
18140
|
+
if (!response || !response.success) {
|
|
18141
|
+
return [];
|
|
18142
|
+
}
|
|
18143
|
+
if (overrideLocalStorage) {
|
|
18144
|
+
this.storage.removeItem(key);
|
|
18145
|
+
}
|
|
18146
|
+
this.storage.setItem(key, JSON.stringify(response.data));
|
|
18147
|
+
return response.data;
|
|
18113
18148
|
});
|
|
18114
18149
|
}
|
|
18115
|
-
|
|
18116
|
-
|
|
18117
|
-
|
|
18118
|
-
getDicIdByMenuState(data, tuNgay, denNgay) {
|
|
18119
|
-
return this.defaultPost(`${this.serviceUri}/GetDicIdByMenuState`, {
|
|
18120
|
-
lstTrangThai: data,
|
|
18121
|
-
tuNgay,
|
|
18122
|
-
denNgay
|
|
18123
|
-
});
|
|
18150
|
+
getPermissionIdsByModule(moduleCode, userId) {
|
|
18151
|
+
const url = `${this.serviceUri}/GetPermissionIdsByModule/${moduleCode}/${userId}`;
|
|
18152
|
+
return this.defaultGet(url);
|
|
18124
18153
|
}
|
|
18125
|
-
|
|
18126
|
-
const url = `${this.serviceUri}/
|
|
18154
|
+
phanQuyenNguoiDung(model) {
|
|
18155
|
+
const url = `${this.serviceUri}/PhanQuyenNguoiDung`;
|
|
18127
18156
|
return this.defaultPost(url, model);
|
|
18128
18157
|
}
|
|
18129
|
-
deleteBulkCongViecCon(ids) {
|
|
18130
|
-
const url = `${this.serviceUri}/DeleteBulkCongViecCon`;
|
|
18131
|
-
return this.defaultPost(url, ids);
|
|
18132
|
-
}
|
|
18133
|
-
getDataDashboardCaNhan(inputData) {
|
|
18134
|
-
const url = `${this.serviceUri}/GetDataDashboardCaNhan`;
|
|
18135
|
-
return this.defaultPost(url, inputData);
|
|
18136
|
-
}
|
|
18137
|
-
getDataDashboardByDonVi(inputData) {
|
|
18138
|
-
const url = `${this.serviceUri}/GetDataDashboardByDonVi`;
|
|
18139
|
-
return this.defaultPost(url, inputData);
|
|
18140
|
-
}
|
|
18141
|
-
getListTasksDashboard(dataFilter) {
|
|
18142
|
-
const url = `${this.serviceUri}/getListTasksDashboard`;
|
|
18143
|
-
return this.defaultPost(url, dataFilter);
|
|
18144
|
-
}
|
|
18145
18158
|
}
|
|
18146
|
-
|
|
18147
|
-
|
|
18159
|
+
PermissionService.ɵprov = i0.ɵɵdefineInjectable({ factory: function PermissionService_Factory() { return new PermissionService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService), i0.ɵɵinject(UserService), i0.ɵɵinject(i4.OAuthService), i0.ɵɵinject(ApplicationContextService)); }, token: PermissionService, providedIn: "root" });
|
|
18160
|
+
PermissionService.decorators = [
|
|
18148
18161
|
{ type: Injectable, args: [{
|
|
18149
18162
|
providedIn: 'root'
|
|
18150
18163
|
},] }
|
|
18151
18164
|
];
|
|
18152
|
-
|
|
18165
|
+
PermissionService.ctorParameters = () => [
|
|
18153
18166
|
{ type: HttpClient },
|
|
18154
18167
|
{ type: Injector },
|
|
18155
18168
|
{ type: ModuleConfigService },
|
|
18156
|
-
{ type:
|
|
18169
|
+
{ type: UserService },
|
|
18170
|
+
{ type: OAuthService },
|
|
18171
|
+
{ type: ApplicationContextService }
|
|
18157
18172
|
];
|
|
18158
18173
|
|
|
18159
|
-
class
|
|
18174
|
+
class WorkflowHistoryService extends BaseService {
|
|
18160
18175
|
constructor(http, injector, _moduleConfigService) {
|
|
18161
|
-
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.
|
|
18162
|
-
this.entityName = 'EntityWorkflowHistory';
|
|
18176
|
+
super(http, injector, `${_moduleConfigService.getConfig().environment.apiDomain.workflowEndpoint}/${_moduleConfigService.getConfig().environment.apiVersion}/WorkflowHistory`);
|
|
18163
18177
|
this.serviceManagers = {};
|
|
18164
|
-
this.
|
|
18178
|
+
this.entityName = 'WorkflowHistory';
|
|
18179
|
+
this.serviceCode = 'workflow';
|
|
18180
|
+
this.apiDomain = _moduleConfigService.getConfig().environment.apiDomain;
|
|
18181
|
+
this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.workflowEndpoint;
|
|
18165
18182
|
this._moduleConfig = _moduleConfigService.getConfig();
|
|
18183
|
+
this.apiVersion = _moduleConfigService.getConfig().environment.apiVersion;
|
|
18166
18184
|
}
|
|
18167
|
-
registerService(
|
|
18168
|
-
this.serviceManagers[
|
|
18185
|
+
registerService(settingKey, service) {
|
|
18186
|
+
this.serviceManagers[settingKey] = service;
|
|
18169
18187
|
}
|
|
18170
18188
|
getEndpointByService(service) {
|
|
18171
18189
|
return `${service.endPoint}/${this._moduleConfig.environment.apiVersion}`;
|
|
18172
18190
|
}
|
|
18173
|
-
|
|
18174
|
-
|
|
18175
|
-
|
|
18176
|
-
(this._injector.get(NotifierService)).showWarning('Bạn chưa đăng ký base service cho entity workflow history');
|
|
18177
|
-
}
|
|
18178
|
-
this.serviceUri = `${this.getEndpointByService(service)}/EntityWorkflowHistory`;
|
|
18191
|
+
changeEndpoint(baseService) {
|
|
18192
|
+
this.serviceUri = `${this.getEndpointByService(baseService)}/WorkflowHistory`;
|
|
18193
|
+
return this;
|
|
18179
18194
|
}
|
|
18180
|
-
|
|
18181
|
-
|
|
18182
|
-
|
|
18183
|
-
|
|
18195
|
+
getLastByItemId(itemId) {
|
|
18196
|
+
// return this.getDetailByFilter(
|
|
18197
|
+
// [
|
|
18198
|
+
// this.newFilter('itemId', Operator.equal, itemId)
|
|
18199
|
+
// ],
|
|
18200
|
+
// [{ field: 'time', dir: -1 }]
|
|
18201
|
+
// );
|
|
18202
|
+
return this.defaultPost(`${this.serviceUri}/GetLastByItemIdInMainThread/${itemId}`, {});
|
|
18203
|
+
}
|
|
18204
|
+
choYKien(model) {
|
|
18205
|
+
return this.defaultPost(`${this.serviceUri}/ChoYKien`, model);
|
|
18206
|
+
}
|
|
18207
|
+
getAllObjectRelated(serviceCode, entity, entityKey, fullApiUrl = null) {
|
|
18208
|
+
let apiUrl = fullApiUrl || this.apiDomain[`${serviceCode}Endpoint`];
|
|
18209
|
+
if (!apiUrl) {
|
|
18210
|
+
throw new Error(`Không tìm thấy api endpoint ứng với service ${serviceCode}`);
|
|
18184
18211
|
}
|
|
18185
|
-
|
|
18186
|
-
|
|
18187
|
-
pageInfo: {
|
|
18188
|
-
page: 1,
|
|
18189
|
-
pageSize: 1
|
|
18190
|
-
},
|
|
18191
|
-
filters,
|
|
18192
|
-
sorts: [
|
|
18193
|
-
new Sort({ field: 'created', dir: 1 })
|
|
18194
|
-
]
|
|
18195
|
-
};
|
|
18196
|
-
return this.defaultPost(url, gridInfo);
|
|
18212
|
+
apiUrl = `${apiUrl}/${this.apiVersion}/WorkflowHistory/GetAllObjectRelated/${entity}/${entityKey}`;
|
|
18213
|
+
return this.defaultGet(apiUrl);
|
|
18197
18214
|
}
|
|
18198
18215
|
}
|
|
18199
|
-
|
|
18200
|
-
|
|
18216
|
+
WorkflowHistoryService.ɵprov = i0.ɵɵdefineInjectable({ factory: function WorkflowHistoryService_Factory() { return new WorkflowHistoryService(i0.ɵɵinject(i1$1.HttpClient), i0.ɵɵinject(i0.INJECTOR), i0.ɵɵinject(ModuleConfigService)); }, token: WorkflowHistoryService, providedIn: "root" });
|
|
18217
|
+
WorkflowHistoryService.decorators = [
|
|
18201
18218
|
{ type: Injectable, args: [{
|
|
18202
18219
|
providedIn: 'root'
|
|
18203
18220
|
},] }
|
|
18204
18221
|
];
|
|
18205
|
-
|
|
18222
|
+
WorkflowHistoryService.ctorParameters = () => [
|
|
18206
18223
|
{ type: HttpClient },
|
|
18207
18224
|
{ type: Injector },
|
|
18208
18225
|
{ type: ModuleConfigService }
|
|
@@ -18349,83 +18366,66 @@ WorkflowPermissionDetailService.ctorParameters = () => [
|
|
|
18349
18366
|
{ type: ModuleConfigService }
|
|
18350
18367
|
];
|
|
18351
18368
|
|
|
18352
|
-
|
|
18353
|
-
|
|
18354
|
-
|
|
18355
|
-
|
|
18356
|
-
|
|
18357
|
-
|
|
18358
|
-
|
|
18359
|
-
|
|
18360
|
-
|
|
18361
|
-
|
|
18362
|
-
|
|
18363
|
-
|
|
18364
|
-
|
|
18365
|
-
|
|
18366
|
-
getEndpointByService(service) {
|
|
18367
|
-
return `${service.endPoint}/${this._moduleConfig.environment.apiVersion}`;
|
|
18368
|
-
}
|
|
18369
|
-
changeEndpoint(baseService) {
|
|
18370
|
-
this.serviceUri = `${this.getEndpointByService(baseService)}/WorkflowHistory`;
|
|
18371
|
-
return this;
|
|
18372
|
-
}
|
|
18373
|
-
getLastByItemId(itemId) {
|
|
18374
|
-
// return this.getDetailByFilter(
|
|
18375
|
-
// [
|
|
18376
|
-
// this.newFilter('itemId', Operator.equal, itemId)
|
|
18377
|
-
// ],
|
|
18378
|
-
// [{ field: 'time', dir: -1 }]
|
|
18379
|
-
// );
|
|
18380
|
-
return this.defaultPost(`${this.serviceUri}/GetLastByItemIdInMainThread/${itemId}`, {});
|
|
18381
|
-
}
|
|
18382
|
-
choYKien(model) {
|
|
18383
|
-
return this.defaultPost(`${this.serviceUri}/ChoYKien`, model);
|
|
18384
|
-
}
|
|
18385
|
-
getAllObjectRelated(serviceCode, entity, entityKey, fullApiUrl = null) {
|
|
18386
|
-
let apiUrl = fullApiUrl || this.apiDomain[`${serviceCode}Endpoint`];
|
|
18387
|
-
if (!apiUrl) {
|
|
18388
|
-
throw new Error(`Không tìm thấy api endpoint ứng với service ${serviceCode}`);
|
|
18369
|
+
var sort_by;
|
|
18370
|
+
(function () {
|
|
18371
|
+
const defaultCompareFunc = function (a, b) {
|
|
18372
|
+
if (a == b)
|
|
18373
|
+
return 0;
|
|
18374
|
+
return a < b ? -1 : 1;
|
|
18375
|
+
};
|
|
18376
|
+
const getCompareFunc = function (primer, reverse) {
|
|
18377
|
+
const defaultCompare = defaultCompareFunc;
|
|
18378
|
+
let compare = defaultCompareFunc;
|
|
18379
|
+
if (primer) {
|
|
18380
|
+
compare = function (a, b) {
|
|
18381
|
+
return defaultCompare(primer(a), primer(b));
|
|
18382
|
+
};
|
|
18389
18383
|
}
|
|
18390
|
-
|
|
18391
|
-
|
|
18392
|
-
|
|
18393
|
-
}
|
|
18394
|
-
|
|
18395
|
-
|
|
18396
|
-
|
|
18397
|
-
|
|
18398
|
-
|
|
18399
|
-
|
|
18400
|
-
|
|
18401
|
-
|
|
18402
|
-
|
|
18403
|
-
|
|
18404
|
-
|
|
18405
|
-
|
|
18406
|
-
|
|
18407
|
-
|
|
18408
|
-
|
|
18409
|
-
|
|
18410
|
-
|
|
18411
|
-
|
|
18412
|
-
|
|
18413
|
-
|
|
18414
|
-
|
|
18415
|
-
|
|
18416
|
-
|
|
18417
|
-
|
|
18418
|
-
|
|
18419
|
-
|
|
18420
|
-
|
|
18421
|
-
|
|
18422
|
-
|
|
18423
|
-
];
|
|
18424
|
-
|
|
18425
|
-
|
|
18426
|
-
|
|
18427
|
-
|
|
18428
|
-
|
|
18384
|
+
if (reverse) {
|
|
18385
|
+
return function (a, b) {
|
|
18386
|
+
return -1 * compare(a, b);
|
|
18387
|
+
};
|
|
18388
|
+
}
|
|
18389
|
+
return compare;
|
|
18390
|
+
};
|
|
18391
|
+
sort_by = function (...args) {
|
|
18392
|
+
const fields = [], n_fields = args.length;
|
|
18393
|
+
let field, name, cmp;
|
|
18394
|
+
// preprocess sorting options
|
|
18395
|
+
for (let i = 0; i < n_fields; i++) {
|
|
18396
|
+
field = args[i];
|
|
18397
|
+
if (typeof field === 'string') {
|
|
18398
|
+
name = field;
|
|
18399
|
+
cmp = defaultCompareFunc;
|
|
18400
|
+
}
|
|
18401
|
+
else {
|
|
18402
|
+
name = field.name;
|
|
18403
|
+
cmp = getCompareFunc(field.primer, field.reverse);
|
|
18404
|
+
}
|
|
18405
|
+
fields.push({
|
|
18406
|
+
name: name,
|
|
18407
|
+
cmp: cmp
|
|
18408
|
+
});
|
|
18409
|
+
}
|
|
18410
|
+
// final comparison function
|
|
18411
|
+
return function (A, B) {
|
|
18412
|
+
let name, result;
|
|
18413
|
+
for (let i = 0; i < n_fields; i++) {
|
|
18414
|
+
result = 0;
|
|
18415
|
+
field = fields[i];
|
|
18416
|
+
name = field.name;
|
|
18417
|
+
result = field.cmp(A[name], B[name]);
|
|
18418
|
+
if (result !== 0)
|
|
18419
|
+
break;
|
|
18420
|
+
}
|
|
18421
|
+
return result;
|
|
18422
|
+
};
|
|
18423
|
+
};
|
|
18424
|
+
}());
|
|
18425
|
+
// multipleSort('idTinhThanh', 'idQuanHuyen')
|
|
18426
|
+
// multipleSort({name: 'idTinhThanh', reverse: true}, 'idQuanHuyen')
|
|
18427
|
+
// multipleSort({name: 'soThuTu', primer: parseInt}, 'idQuanHuyen') // parseInt là function
|
|
18428
|
+
const multipleSort = sort_by;
|
|
18429
18429
|
|
|
18430
18430
|
class ListComponentBase extends ComponentBase {
|
|
18431
18431
|
constructor(_injector, _isTreeTable) {
|
|
@@ -19678,15 +19678,15 @@ class ListComponentBase extends ComponentBase {
|
|
|
19678
19678
|
const result = newArr.reduce((x, y) => y.colSpan + x, 0);
|
|
19679
19679
|
return result > a ? result : a;
|
|
19680
19680
|
}, 0);
|
|
19681
|
-
const startIndex = this.setting.hiddenCheckbox ? 0 : 1;
|
|
19682
19681
|
const endIndex = maxColSize - (this.setting.hiddenFunctionColumn ? 1 : 2);
|
|
19683
19682
|
for (let ind = 0; ind < lstRow.length; ind++) {
|
|
19684
19683
|
const arrTh = [...allTh[ind]];
|
|
19684
|
+
const startIndex = arrTh[0].className.includes('chkbox') ? 1 : 0;
|
|
19685
19685
|
if (startIndex > endIndex) {
|
|
19686
19686
|
return null;
|
|
19687
19687
|
}
|
|
19688
19688
|
result[ind] = (_a = result[ind]) !== null && _a !== void 0 ? _a : [];
|
|
19689
|
-
let colIndex =
|
|
19689
|
+
let colIndex = result[ind].length;
|
|
19690
19690
|
const numOfColSpan = arrTh.reduce((x, y) => x + y.colSpan - 1, 0);
|
|
19691
19691
|
for (let i = startIndex; i <= endIndex - numOfColSpan; i++) {
|
|
19692
19692
|
if (arrTh[i]) {
|
|
@@ -19848,6 +19848,7 @@ class ListComponentBase extends ComponentBase {
|
|
|
19848
19848
|
}
|
|
19849
19849
|
getValueCheckboxFormat(data) {
|
|
19850
19850
|
const checkBox = data.querySelector('p-checkbox');
|
|
19851
|
+
const input = data.querySelector('input');
|
|
19851
19852
|
if (checkBox) {
|
|
19852
19853
|
const value = data.querySelector('span.pi-check');
|
|
19853
19854
|
if (value) {
|
|
@@ -19857,6 +19858,9 @@ class ListComponentBase extends ComponentBase {
|
|
|
19857
19858
|
return 'Không';
|
|
19858
19859
|
}
|
|
19859
19860
|
}
|
|
19861
|
+
if (input) {
|
|
19862
|
+
return input.value;
|
|
19863
|
+
}
|
|
19860
19864
|
return '';
|
|
19861
19865
|
}
|
|
19862
19866
|
view(rowData) {
|