tnx-shared 5.3.429 → 5.3.430
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 +398 -251
- 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/component-base-with-button.d.ts +2 -0
- package/classes/base/component-base-with-button.d.ts.map +1 -1
- package/classes/base/data-form-base.d.ts +32 -0
- package/classes/base/data-form-base.d.ts.map +1 -1
- package/classes/base/list-component-base.d.ts.map +1 -1
- package/components/crud/crud-form/crud-form.component.d.ts +1 -1
- package/components/crud/crud-form/crud-form.component.d.ts.map +1 -1
- package/esm2015/classes/base/component-base-with-button.js +6 -1
- package/esm2015/classes/base/data-form-base.js +150 -20
- package/esm2015/classes/base/list-component-base.js +2 -1
- package/esm2015/components/crud/crud-form/crud-form.component.js +1 -1
- package/esm2015/components/tn-dialog/tn-dialog.component.js +2 -2
- package/fesm2015/tnx-shared.js +313 -178
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- package/tnx-shared.metadata.json +1 -1
|
@@ -11639,7 +11639,13 @@
|
|
|
11639
11639
|
var ComponentBaseWithButton = /** @class */ (function (_super) {
|
|
11640
11640
|
__extends(ComponentBaseWithButton, _super);
|
|
11641
11641
|
function ComponentBaseWithButton(_injector) {
|
|
11642
|
-
|
|
11642
|
+
var _this = _super.call(this, _injector) || this;
|
|
11643
|
+
// Danh sách nút hành động quy trình. Được render TỰ ĐỘNG ở footer của tn-dialog,
|
|
11644
|
+
// nên form không cần tự khai báo *ngFor trong #buttonTemplate.
|
|
11645
|
+
_this.buttons = [];
|
|
11646
|
+
// Tiền tố nhãn cho các nút quy trình tự động (vd 'Lưu và'); để rỗng nếu không cần.
|
|
11647
|
+
_this.workflowButtonLabelPrefix = 'Lưu và ';
|
|
11648
|
+
return _this;
|
|
11643
11649
|
}
|
|
11644
11650
|
return ComponentBaseWithButton;
|
|
11645
11651
|
}(ComponentBase));
|
|
@@ -19029,6 +19035,192 @@
|
|
|
19029
19035
|
{ type: StorageUpdatedService }
|
|
19030
19036
|
]; };
|
|
19031
19037
|
|
|
19038
|
+
var WorkflowPermissionDetailService = /** @class */ (function (_super) {
|
|
19039
|
+
__extends(WorkflowPermissionDetailService, _super);
|
|
19040
|
+
function WorkflowPermissionDetailService(http, injector, _moduleConfigService) {
|
|
19041
|
+
var _this = _super.call(this, http, injector, _moduleConfigService.getConfig().environment.apiDomain.workflowEndpoint + "/" + _moduleConfigService.getConfig().environment.apiVersion + "/WorkflowPermissionDetail") || this;
|
|
19042
|
+
_this.serviceManagers = {};
|
|
19043
|
+
_this.entityName = 'WorkflowPermissionDetail';
|
|
19044
|
+
_this.tableName = '';
|
|
19045
|
+
_this.guidEmpty = '00000000-0000-0000-0000-000000000000';
|
|
19046
|
+
_this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.workflowEndpoint;
|
|
19047
|
+
_this._moduleConfig = _moduleConfigService.getConfig();
|
|
19048
|
+
return _this;
|
|
19049
|
+
}
|
|
19050
|
+
WorkflowPermissionDetailService.prototype.registerService = function (settingKey, service) {
|
|
19051
|
+
this.serviceManagers[settingKey] = service;
|
|
19052
|
+
};
|
|
19053
|
+
WorkflowPermissionDetailService.prototype.getEndpointByService = function (service) {
|
|
19054
|
+
return service.endPoint + "/" + this._moduleConfig.environment.apiVersion;
|
|
19055
|
+
};
|
|
19056
|
+
WorkflowPermissionDetailService.prototype.changeEndpoint = function (baseService) {
|
|
19057
|
+
this.serviceUri = this.getEndpointByService(baseService) + "/WorkflowPermissionDetail";
|
|
19058
|
+
this.tableName = baseService.entityName;
|
|
19059
|
+
return this;
|
|
19060
|
+
};
|
|
19061
|
+
WorkflowPermissionDetailService.prototype.appendInfoForWorkflowSingle = function (userIdCurrent, data, fieldKey, ignoreWorkflow, callBackWhenNotHaveStatus) {
|
|
19062
|
+
if (fieldKey === void 0) { fieldKey = 'id'; }
|
|
19063
|
+
if (ignoreWorkflow === void 0) { ignoreWorkflow = false; }
|
|
19064
|
+
if (callBackWhenNotHaveStatus === void 0) { callBackWhenNotHaveStatus = null; }
|
|
19065
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
19066
|
+
var itemId, filters, sorts, dataStatus, notifierService;
|
|
19067
|
+
return __generator(this, function (_a) {
|
|
19068
|
+
switch (_a.label) {
|
|
19069
|
+
case 0:
|
|
19070
|
+
if (callBackWhenNotHaveStatus == null) {
|
|
19071
|
+
callBackWhenNotHaveStatus = function (itemStatus, rowItem) {
|
|
19072
|
+
if (rowItem[fieldKey]
|
|
19073
|
+
&& rowItem.workflowCode
|
|
19074
|
+
&& rowItem.currentStateCode) {
|
|
19075
|
+
itemStatus.textTrangThai = 'Đã bắt đầu quy trình';
|
|
19076
|
+
itemStatus.trangThai = rowItem.currentStateCode;
|
|
19077
|
+
itemStatus.workflowCode = rowItem.workflowCode;
|
|
19078
|
+
itemStatus.permission = exports.PermissionBase.READ;
|
|
19079
|
+
}
|
|
19080
|
+
};
|
|
19081
|
+
}
|
|
19082
|
+
itemId = data[fieldKey];
|
|
19083
|
+
filters = [
|
|
19084
|
+
this.newFilter('itemId', exports.Operator.equal, itemId),
|
|
19085
|
+
this.newFilter('notInWorkflow', exports.Operator.equal, false),
|
|
19086
|
+
];
|
|
19087
|
+
sorts = [];
|
|
19088
|
+
if (!ignoreWorkflow) {
|
|
19089
|
+
filters.push(this.newFilter('userId', exports.Operator.equal, userIdCurrent));
|
|
19090
|
+
}
|
|
19091
|
+
else {
|
|
19092
|
+
sorts.push(new Sort({ field: 'permission', dir: -1 }), new Sort({ field: 'inComing', dir: -1 }), new Sort({ field: 'isCOEdit', dir: -1 }));
|
|
19093
|
+
}
|
|
19094
|
+
return [4 /*yield*/, this.getAll(filters, 'itemId,userId,trangThai,textTrangThai,workflowCode,permission,isCOEdit', sorts, 'ForCrudList')];
|
|
19095
|
+
case 1:
|
|
19096
|
+
dataStatus = (_a.sent()).data;
|
|
19097
|
+
if (dataStatus == null) {
|
|
19098
|
+
notifierService = this._injector.get(NotifierService);
|
|
19099
|
+
return [2 /*return*/, notifierService.showWarning('Không lấy được thông tin trạng thái hiện tại của bản ghi')];
|
|
19100
|
+
}
|
|
19101
|
+
this.appendWorkflowInfoToItem(data, itemId, userIdCurrent, ignoreWorkflow, dataStatus, callBackWhenNotHaveStatus);
|
|
19102
|
+
return [2 /*return*/, true];
|
|
19103
|
+
}
|
|
19104
|
+
});
|
|
19105
|
+
});
|
|
19106
|
+
};
|
|
19107
|
+
WorkflowPermissionDetailService.prototype.appendWorkflowInfoToItem = function (data, itemId, userIdCurrent, ignoreWorkflow, dataStatus, callBackWhenNotHaveStatus) {
|
|
19108
|
+
var _this = this;
|
|
19109
|
+
if (callBackWhenNotHaveStatus === void 0) { callBackWhenNotHaveStatus = null; }
|
|
19110
|
+
var itemStatus = {
|
|
19111
|
+
textTrangThai: 'Chưa chạy quy trình'
|
|
19112
|
+
};
|
|
19113
|
+
if (itemId) {
|
|
19114
|
+
// const lstItemStatus = dataStatus.filter(q => q.itemId == itemId && q.userId == userIdCurrent);
|
|
19115
|
+
// if (ignoreWorkflow === true && lstItemStatus.length === 0) {
|
|
19116
|
+
// lstItemStatus.push(...dataStatus.filter(q => q.itemId === itemId));
|
|
19117
|
+
// }
|
|
19118
|
+
var lstItemStatus = dataStatus.filter(function (q) { return q.itemId === itemId; });
|
|
19119
|
+
// let itemStatus = null;
|
|
19120
|
+
if (lstItemStatus.length) {
|
|
19121
|
+
itemStatus = lstItemStatus.find(function (q) { return (q.permission & exports.PermissionBase.EDIT) == exports.PermissionBase.EDIT; });
|
|
19122
|
+
if (itemStatus == null) {
|
|
19123
|
+
itemStatus = lstItemStatus[0];
|
|
19124
|
+
}
|
|
19125
|
+
}
|
|
19126
|
+
}
|
|
19127
|
+
// Nếu không có bản ghi trạng thái
|
|
19128
|
+
// Nhưng đã tạo task rồi thì hiển thị trạng thái "đã tạo công việc" để tránh trường hợp hiển thị nút bắt đầu thừa trên giao diện
|
|
19129
|
+
if (!itemStatus.trangThai) {
|
|
19130
|
+
callBackWhenNotHaveStatus(itemStatus, data);
|
|
19131
|
+
}
|
|
19132
|
+
data.__isCoEdit = dataStatus.some(function (x) { return x.itemId === itemId && x.userId != _this.guidEmpty && x.isCOEdit; });
|
|
19133
|
+
data.__trangThai = itemStatus.trangThai;
|
|
19134
|
+
data.__textTrangThai = itemStatus.textTrangThai;
|
|
19135
|
+
if (itemStatus.workflowCode == DummyWorkflowCode) {
|
|
19136
|
+
data.hiddenWorkflowAction = true;
|
|
19137
|
+
}
|
|
19138
|
+
data.__workflowCode = itemStatus.workflowCode;
|
|
19139
|
+
data.__permission = itemStatus.permission;
|
|
19140
|
+
data.__disableEdit = true;
|
|
19141
|
+
data.__disableDelete = true;
|
|
19142
|
+
if (data.basePermission & exports.PermissionBase.EDIT
|
|
19143
|
+
|| data.__permission & exports.PermissionBase.EDIT) {
|
|
19144
|
+
data.__disableEdit = false;
|
|
19145
|
+
}
|
|
19146
|
+
else {
|
|
19147
|
+
data.__disablePermissionEdit = true;
|
|
19148
|
+
}
|
|
19149
|
+
if (data.basePermission & exports.PermissionBase.DELETE
|
|
19150
|
+
|| data.__permission & exports.PermissionBase.DELETE) {
|
|
19151
|
+
data.__disableDelete = false;
|
|
19152
|
+
}
|
|
19153
|
+
else {
|
|
19154
|
+
data.__disablePermissionDelete = true;
|
|
19155
|
+
}
|
|
19156
|
+
};
|
|
19157
|
+
/**
|
|
19158
|
+
* Lấy thêm các thông tin cần cho quy trình nghiệp vụ cho các bản ghi trong data
|
|
19159
|
+
*/
|
|
19160
|
+
WorkflowPermissionDetailService.prototype.appendInfoForWorkflow = function (userIdCurrent, data, fieldKey, ignoreWorkflow, callBackWhenNotHaveStatus) {
|
|
19161
|
+
if (fieldKey === void 0) { fieldKey = 'id'; }
|
|
19162
|
+
if (ignoreWorkflow === void 0) { ignoreWorkflow = false; }
|
|
19163
|
+
if (callBackWhenNotHaveStatus === void 0) { callBackWhenNotHaveStatus = null; }
|
|
19164
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
19165
|
+
var lstItemId, filters, sorts, dataStatus, notifierService;
|
|
19166
|
+
var _this = this;
|
|
19167
|
+
return __generator(this, function (_a) {
|
|
19168
|
+
switch (_a.label) {
|
|
19169
|
+
case 0:
|
|
19170
|
+
if (callBackWhenNotHaveStatus == null) {
|
|
19171
|
+
callBackWhenNotHaveStatus = function (itemStatus, rowItem) {
|
|
19172
|
+
if (rowItem[fieldKey]
|
|
19173
|
+
&& rowItem.workflowCode
|
|
19174
|
+
&& rowItem.currentStateCode) {
|
|
19175
|
+
itemStatus.textTrangThai = 'Đã bắt đầu quy trình';
|
|
19176
|
+
itemStatus.trangThai = rowItem.currentStateCode;
|
|
19177
|
+
itemStatus.workflowCode = rowItem.workflowCode;
|
|
19178
|
+
itemStatus.permission = exports.PermissionBase.READ;
|
|
19179
|
+
}
|
|
19180
|
+
};
|
|
19181
|
+
}
|
|
19182
|
+
lstItemId = data.filter(function (q) { return q[fieldKey]; }).map(function (q) { return q[fieldKey]; });
|
|
19183
|
+
filters = [
|
|
19184
|
+
this.newFilter('itemId', exports.Operator.in, lstItemId),
|
|
19185
|
+
this.newFilter('notInWorkflow', exports.Operator.equal, false),
|
|
19186
|
+
];
|
|
19187
|
+
if (this.tableName) {
|
|
19188
|
+
filters.push(this.newFilter('tableName', exports.Operator.equal, this.tableName));
|
|
19189
|
+
}
|
|
19190
|
+
sorts = [];
|
|
19191
|
+
// if (!ignoreWorkflow) {
|
|
19192
|
+
// filters.push(this.newFilter('userId', Operator.equal, userIdCurrent));
|
|
19193
|
+
// }
|
|
19194
|
+
sorts.push(new Sort({ field: 'permission', dir: -1 }), new Sort({ field: 'inComing', dir: -1 }), new Sort({ field: 'isCOEdit', dir: -1 }));
|
|
19195
|
+
return [4 /*yield*/, this.getAll(filters, 'itemId,userId,trangThai,textTrangThai,workflowCode,permission,isCOEdit', sorts, 'ForCrudList')];
|
|
19196
|
+
case 1:
|
|
19197
|
+
dataStatus = (_a.sent()).data;
|
|
19198
|
+
if (dataStatus == null) {
|
|
19199
|
+
notifierService = this._injector.get(NotifierService);
|
|
19200
|
+
return [2 /*return*/, notifierService.showWarning('Không lấy được thông tin trạng thái hiện tại của bản ghi')];
|
|
19201
|
+
}
|
|
19202
|
+
data.forEach(function (rowItem) {
|
|
19203
|
+
_this.appendWorkflowInfoToItem(rowItem, rowItem[fieldKey], userIdCurrent, ignoreWorkflow, dataStatus, callBackWhenNotHaveStatus);
|
|
19204
|
+
});
|
|
19205
|
+
return [2 /*return*/, true];
|
|
19206
|
+
}
|
|
19207
|
+
});
|
|
19208
|
+
});
|
|
19209
|
+
};
|
|
19210
|
+
return WorkflowPermissionDetailService;
|
|
19211
|
+
}(BaseService));
|
|
19212
|
+
WorkflowPermissionDetailService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function WorkflowPermissionDetailService_Factory() { return new WorkflowPermissionDetailService(i0__namespace.ɵɵinject(i1__namespace$1.HttpClient), i0__namespace.ɵɵinject(i0__namespace.INJECTOR), i0__namespace.ɵɵinject(ModuleConfigService)); }, token: WorkflowPermissionDetailService, providedIn: "root" });
|
|
19213
|
+
WorkflowPermissionDetailService.decorators = [
|
|
19214
|
+
{ type: i0.Injectable, args: [{
|
|
19215
|
+
providedIn: 'root'
|
|
19216
|
+
},] }
|
|
19217
|
+
];
|
|
19218
|
+
WorkflowPermissionDetailService.ctorParameters = function () { return [
|
|
19219
|
+
{ type: i1$1.HttpClient },
|
|
19220
|
+
{ type: i0.Injector },
|
|
19221
|
+
{ type: ModuleConfigService }
|
|
19222
|
+
]; };
|
|
19223
|
+
|
|
19032
19224
|
var DataFormBase = /** @class */ (function (_super) {
|
|
19033
19225
|
__extends(DataFormBase, _super);
|
|
19034
19226
|
function DataFormBase(_injector) {
|
|
@@ -19053,6 +19245,8 @@
|
|
|
19053
19245
|
_this.autoGetDetail = true;
|
|
19054
19246
|
_this.autoSave = true;
|
|
19055
19247
|
_this.isCloseForm = true;
|
|
19248
|
+
// Khi lưu bằng workflow action: tạm chặn đóng form lúc lưu, chỉ đóng sau khi action chạy xong
|
|
19249
|
+
_this._suppressOnSaved = false;
|
|
19056
19250
|
_this.saving = false;
|
|
19057
19251
|
_this.getDetailPlusUrl = null;
|
|
19058
19252
|
_this.insertPlusUrl = null;
|
|
@@ -19077,6 +19271,7 @@
|
|
|
19077
19271
|
_this._entityMetadataService = _this._injector.get(EntityMetadataService);
|
|
19078
19272
|
_this._userService = _this._injector.get(UserService);
|
|
19079
19273
|
_this._commonService = _this._injector.get(CommonService);
|
|
19274
|
+
_this._workflowPermissionDetailService = _this._injector.get(WorkflowPermissionDetailService);
|
|
19080
19275
|
return _this;
|
|
19081
19276
|
}
|
|
19082
19277
|
DataFormBase.prototype.ngOnInit = function () {
|
|
@@ -19206,6 +19401,134 @@
|
|
|
19206
19401
|
evt.rootModel[FieldWorkflowCodeInCrudForm] = workflowSetting.workflowCode;
|
|
19207
19402
|
}
|
|
19208
19403
|
};
|
|
19404
|
+
/**
|
|
19405
|
+
* Lấy trạng thái quy trình hiện tại của bản ghi, gắn các field __trangThai/__textTrangThai/__workflowCode/__permission
|
|
19406
|
+
* vào data và sinh danh sách nút hành động quy trình (this.buttons) khi bản ghi đã chạy quy trình.
|
|
19407
|
+
* Yêu cầu: this.setting.baseService đã được cấu hình và this.crudList được truyền từ crud-list cha.
|
|
19408
|
+
*/
|
|
19409
|
+
DataFormBase.prototype.generateWorkflowButton = function (data) {
|
|
19410
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
19411
|
+
var lstItemStatus, itemStatus, actions;
|
|
19412
|
+
var _this = this;
|
|
19413
|
+
return __generator(this, function (_e) {
|
|
19414
|
+
switch (_e.label) {
|
|
19415
|
+
case 0: return [4 /*yield*/, this._workflowPermissionDetailService.changeEndpoint(this.setting.baseService).getAll([
|
|
19416
|
+
this.newFilter('itemId', exports.Operator.equal, data.id),
|
|
19417
|
+
], 'itemId,userId,trangThai,textTrangThai,workflowCode,permission', [], 'ForCrudList')];
|
|
19418
|
+
case 1:
|
|
19419
|
+
lstItemStatus = (_e.sent()).data;
|
|
19420
|
+
if (lstItemStatus == null) {
|
|
19421
|
+
return [2 /*return*/, this._notifierService.showWarning('Không lấy được thông tin trạng thái hiện tại của bản ghi')];
|
|
19422
|
+
}
|
|
19423
|
+
itemStatus = null;
|
|
19424
|
+
if (!lstItemStatus.length) {
|
|
19425
|
+
itemStatus = {
|
|
19426
|
+
textTrangThai: 'Chưa chạy quy trình'
|
|
19427
|
+
};
|
|
19428
|
+
}
|
|
19429
|
+
else {
|
|
19430
|
+
data.startedWorkflow = true;
|
|
19431
|
+
itemStatus = lstItemStatus.find(function (q) { return (q.permission & exports.PermissionBase.EDIT) == exports.PermissionBase.EDIT; });
|
|
19432
|
+
if (itemStatus == null) {
|
|
19433
|
+
itemStatus = lstItemStatus[0];
|
|
19434
|
+
}
|
|
19435
|
+
}
|
|
19436
|
+
data.__trangThai = itemStatus.trangThai;
|
|
19437
|
+
data.__textTrangThai = itemStatus.textTrangThai;
|
|
19438
|
+
data.__workflowCode = itemStatus.workflowCode;
|
|
19439
|
+
data.__permission = itemStatus.permission;
|
|
19440
|
+
if (!(data.startedWorkflow && this.crudList)) return [3 /*break*/, 3];
|
|
19441
|
+
return [4 /*yield*/, this.crudList.getActionWorkflow(data)];
|
|
19442
|
+
case 2:
|
|
19443
|
+
actions = _e.sent();
|
|
19444
|
+
if (!Array.isArray(actions))
|
|
19445
|
+
return [2 /*return*/];
|
|
19446
|
+
// Chỉ bọc các action lấy từ getActionAllow; các nút phụ (Thu hồi, Cho ý kiến,
|
|
19447
|
+
// Xem lịch sử, Chuyển xử lý) giữ nguyên hành vi gốc
|
|
19448
|
+
actions.filter(function (b) { return b.isActionAllow; }).forEach(function (b) { return _this._decorateWorkflowActionButton(b); });
|
|
19449
|
+
this.buttons = actions;
|
|
19450
|
+
_e.label = 3;
|
|
19451
|
+
case 3: return [2 /*return*/];
|
|
19452
|
+
}
|
|
19453
|
+
});
|
|
19454
|
+
});
|
|
19455
|
+
};
|
|
19456
|
+
/**
|
|
19457
|
+
* Gắn hành vi cho 1 nút action quy trình (lấy từ getActionAllow):
|
|
19458
|
+
* - Khi form đang sửa: thêm tiền tố nhãn; nếu dữ liệu thay đổi thì lưu trước (không đóng form), lưu lỗi thì dừng.
|
|
19459
|
+
* - Chạy action gốc, và đóng form sau khi action thực sự hoàn tất.
|
|
19460
|
+
*/
|
|
19461
|
+
DataFormBase.prototype._decorateWorkflowActionButton = function (button) {
|
|
19462
|
+
var _this = this;
|
|
19463
|
+
var isEdit = this._isFormEdit();
|
|
19464
|
+
var runAction = button.command;
|
|
19465
|
+
if (isEdit) {
|
|
19466
|
+
button.label = this.workflowButtonLabelPrefix + button.label;
|
|
19467
|
+
}
|
|
19468
|
+
button.command = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
19469
|
+
var saved;
|
|
19470
|
+
return __generator(this, function (_e) {
|
|
19471
|
+
switch (_e.label) {
|
|
19472
|
+
case 0:
|
|
19473
|
+
if (this.model.submitting)
|
|
19474
|
+
return [2 /*return*/];
|
|
19475
|
+
if (!(isEdit && this._isWorkflowDataChanged())) return [3 /*break*/, 2];
|
|
19476
|
+
this.model.submitting = true;
|
|
19477
|
+
this._suppressOnSaved = true; // không đóng form khi lưu
|
|
19478
|
+
return [4 /*yield*/, this.save()];
|
|
19479
|
+
case 1:
|
|
19480
|
+
saved = _e.sent();
|
|
19481
|
+
this._suppressOnSaved = false;
|
|
19482
|
+
if (!saved)
|
|
19483
|
+
return [2 /*return*/];
|
|
19484
|
+
_e.label = 2;
|
|
19485
|
+
case 2:
|
|
19486
|
+
if (!runAction)
|
|
19487
|
+
return [2 /*return*/];
|
|
19488
|
+
this._closeFormWhenWorkflowProcessed();
|
|
19489
|
+
return [4 /*yield*/, runAction()];
|
|
19490
|
+
case 3:
|
|
19491
|
+
_e.sent();
|
|
19492
|
+
return [2 /*return*/];
|
|
19493
|
+
}
|
|
19494
|
+
});
|
|
19495
|
+
}); };
|
|
19496
|
+
};
|
|
19497
|
+
/**
|
|
19498
|
+
* Đóng form (phát onSaved) đúng một lần khi crudList báo action quy trình đã xử lý xong.
|
|
19499
|
+
*/
|
|
19500
|
+
DataFormBase.prototype._closeFormWhenWorkflowProcessed = function () {
|
|
19501
|
+
var _this = this;
|
|
19502
|
+
var _a;
|
|
19503
|
+
var processed = (_a = this.crudList) === null || _a === void 0 ? void 0 : _a.onProcessedWorkflow;
|
|
19504
|
+
if (!processed)
|
|
19505
|
+
return;
|
|
19506
|
+
var sub = processed.subscribe(function () {
|
|
19507
|
+
sub.unsubscribe();
|
|
19508
|
+
_this.onSaved.emit({ id: _this.model.data.id, insert: false, isCloseForm: true });
|
|
19509
|
+
});
|
|
19510
|
+
};
|
|
19511
|
+
/**
|
|
19512
|
+
* So sánh dữ liệu hiện tại với snapshot lúc tải (logSetting.valueBeforeUpdate) để biết form có thay đổi không.
|
|
19513
|
+
* Chuẩn hoá cả 2 qua crudForm.getMinimizeData (bỏ _status/_errors/_source, resolve dropdown object về giá trị thô)
|
|
19514
|
+
* để so sánh ổn định. Nếu không có snapshot thì coi như có thay đổi (luôn lưu) cho an toàn.
|
|
19515
|
+
*/
|
|
19516
|
+
/**
|
|
19517
|
+
* Form có tham gia quy trình hay không (dựa trên cấu hình parentSetting) - cùng điều kiện với biến hasWorkflow trong addSchemaBase.
|
|
19518
|
+
*/
|
|
19519
|
+
DataFormBase.prototype._hasWorkflow = function () {
|
|
19520
|
+
var _a;
|
|
19521
|
+
return !!(this.parentSetting
|
|
19522
|
+
&& ((this.parentSetting.workflowSettingNew && ((_a = this.parentSetting.workflowSettingNew.workflows) === null || _a === void 0 ? void 0 : _a.length) > 0)
|
|
19523
|
+
|| this.parentSetting.isWorkflowTree));
|
|
19524
|
+
};
|
|
19525
|
+
DataFormBase.prototype._isWorkflowDataChanged = function () {
|
|
19526
|
+
if (!this.logSetting.valueBeforeUpdate || !this.crudForm)
|
|
19527
|
+
return true;
|
|
19528
|
+
var current = JSON.stringify(this.crudForm.getMinimizeData(this.model.data));
|
|
19529
|
+
var before = JSON.stringify(this.crudForm.getMinimizeData(this.logSetting.valueBeforeUpdate));
|
|
19530
|
+
return current !== before;
|
|
19531
|
+
};
|
|
19209
19532
|
DataFormBase.prototype._handleFormReady = function (formEvent) {
|
|
19210
19533
|
return __awaiter(this, void 0, void 0, function () {
|
|
19211
19534
|
return __generator(this, function (_e) {
|
|
@@ -19306,7 +19629,9 @@
|
|
|
19306
19629
|
return [4 /*yield*/, this.onAfterGetDetail(response.data)];
|
|
19307
19630
|
case 7:
|
|
19308
19631
|
_e.sent();
|
|
19309
|
-
|
|
19632
|
+
// Lưu snapshot dữ liệu trước khi sửa khi: bật log HOẶC form có quy trình
|
|
19633
|
+
// (để so sánh thay đổi, quyết định có cần lưu trước khi chạy action quy trình hay không)
|
|
19634
|
+
if (this.logSetting.isEnableLog || this._hasWorkflow()) {
|
|
19310
19635
|
this.logSetting.valueBeforeUpdate = this._commonService.cloneObject(response.data);
|
|
19311
19636
|
}
|
|
19312
19637
|
return [3 /*break*/, 10];
|
|
@@ -19436,7 +19761,12 @@
|
|
|
19436
19761
|
if (this.logSetting.isEnableLog) {
|
|
19437
19762
|
this.getLogValueAfterLoadDetail();
|
|
19438
19763
|
}
|
|
19439
|
-
return [
|
|
19764
|
+
if (!(this._hasWorkflow() && this.crudList)) return [3 /*break*/, 4];
|
|
19765
|
+
return [4 /*yield*/, this.generateWorkflowButton(data)];
|
|
19766
|
+
case 3:
|
|
19767
|
+
_e.sent();
|
|
19768
|
+
_e.label = 4;
|
|
19769
|
+
case 4: return [2 /*return*/];
|
|
19440
19770
|
}
|
|
19441
19771
|
});
|
|
19442
19772
|
});
|
|
@@ -19821,7 +20151,7 @@
|
|
|
19821
20151
|
case 0: return [4 /*yield*/, this.validateFormBase()];
|
|
19822
20152
|
case 1:
|
|
19823
20153
|
validated = _e.sent();
|
|
19824
|
-
if (!validated) return [3 /*break*/,
|
|
20154
|
+
if (!validated) return [3 /*break*/, 14];
|
|
19825
20155
|
if (!this.logSetting.isEnableLog) return [3 /*break*/, 5];
|
|
19826
20156
|
if (!!this.logSetting.isCustomAll) return [3 /*break*/, 3];
|
|
19827
20157
|
return [4 /*yield*/, this.getLogValue()];
|
|
@@ -19842,27 +20172,26 @@
|
|
|
19842
20172
|
case 6:
|
|
19843
20173
|
_e.sent();
|
|
19844
20174
|
this.triggerSaveFileUpload();
|
|
19845
|
-
if (!this.autoSave) return [3 /*break*/,
|
|
20175
|
+
if (!this.autoSave) return [3 /*break*/, 12];
|
|
19846
20176
|
if (!(this._isFormEdit() || this._isFormView())) return [3 /*break*/, 8];
|
|
19847
20177
|
return [4 /*yield*/, this.onUpdate()];
|
|
19848
|
-
case 7:
|
|
19849
|
-
_e.sent();
|
|
19850
|
-
return [3 /*break*/, 10];
|
|
20178
|
+
case 7: return [2 /*return*/, _e.sent()];
|
|
19851
20179
|
case 8:
|
|
19852
20180
|
if (!this._isFormAddNew()) return [3 /*break*/, 10];
|
|
19853
20181
|
return [4 /*yield*/, this.onInsert()];
|
|
19854
|
-
case 9:
|
|
19855
|
-
|
|
19856
|
-
|
|
19857
|
-
|
|
19858
|
-
case 11:
|
|
20182
|
+
case 9: return [2 /*return*/, _e.sent()];
|
|
20183
|
+
case 10:
|
|
20184
|
+
// form view, do nothing
|
|
20185
|
+
return [2 /*return*/, false];
|
|
20186
|
+
case 11: return [3 /*break*/, 13];
|
|
20187
|
+
case 12:
|
|
19859
20188
|
this.handleManualSave();
|
|
19860
|
-
|
|
19861
|
-
case
|
|
19862
|
-
case
|
|
20189
|
+
return [2 /*return*/, true];
|
|
20190
|
+
case 13: return [3 /*break*/, 15];
|
|
20191
|
+
case 14:
|
|
19863
20192
|
this.model.submitting = false;
|
|
19864
|
-
|
|
19865
|
-
case
|
|
20193
|
+
return [2 /*return*/, false];
|
|
20194
|
+
case 15: return [2 /*return*/];
|
|
19866
20195
|
}
|
|
19867
20196
|
});
|
|
19868
20197
|
});
|
|
@@ -19963,11 +20292,9 @@
|
|
|
19963
20292
|
case 3:
|
|
19964
20293
|
confirmed = _e.sent();
|
|
19965
20294
|
if (!confirmed)
|
|
19966
|
-
return [2 /*return
|
|
20295
|
+
return [2 /*return*/, false];
|
|
19967
20296
|
return [4 /*yield*/, this._insert()];
|
|
19968
|
-
case 4:
|
|
19969
|
-
_e.sent();
|
|
19970
|
-
return [2 /*return*/];
|
|
20297
|
+
case 4: return [2 /*return*/, _e.sent()];
|
|
19971
20298
|
}
|
|
19972
20299
|
});
|
|
19973
20300
|
});
|
|
@@ -19994,39 +20321,40 @@
|
|
|
19994
20321
|
return __awaiter(this, void 0, void 0, function () {
|
|
19995
20322
|
var _this = this;
|
|
19996
20323
|
return __generator(this, function (_e) {
|
|
19997
|
-
this.getPromiseActionInsert()
|
|
19998
|
-
|
|
19999
|
-
|
|
20000
|
-
|
|
20001
|
-
|
|
20002
|
-
|
|
20003
|
-
|
|
20004
|
-
|
|
20005
|
-
|
|
20006
|
-
|
|
20007
|
-
|
|
20008
|
-
|
|
20009
|
-
|
|
20010
|
-
|
|
20011
|
-
|
|
20012
|
-
|
|
20013
|
-
|
|
20014
|
-
|
|
20015
|
-
|
|
20016
|
-
|
|
20017
|
-
|
|
20018
|
-
|
|
20324
|
+
return [2 /*return*/, this.getPromiseActionInsert()
|
|
20325
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () {
|
|
20326
|
+
return __generator(this, function (_e) {
|
|
20327
|
+
switch (_e.label) {
|
|
20328
|
+
case 0:
|
|
20329
|
+
this.model.submitting = false;
|
|
20330
|
+
this.showMessageAfterInsert(response.success, response);
|
|
20331
|
+
if (!response.success) return [3 /*break*/, 2];
|
|
20332
|
+
this.model.data.id = response.data;
|
|
20333
|
+
return [4 /*yield*/, this.onAfterSave(response)];
|
|
20334
|
+
case 1:
|
|
20335
|
+
_e.sent();
|
|
20336
|
+
if (!this._suppressOnSaved) {
|
|
20337
|
+
this.onSaved.emit({
|
|
20338
|
+
id: this.model.data.id,
|
|
20339
|
+
insert: true,
|
|
20340
|
+
isCloseForm: this.isCloseForm
|
|
20341
|
+
});
|
|
20342
|
+
}
|
|
20343
|
+
return [2 /*return*/, true];
|
|
20344
|
+
case 2:
|
|
20345
|
+
this.handleInsertError(response);
|
|
20346
|
+
return [2 /*return*/, false];
|
|
20347
|
+
}
|
|
20348
|
+
});
|
|
20349
|
+
}); }, function (error) {
|
|
20350
|
+
if (!error.error.success && error.error.errorCheckExist) {
|
|
20351
|
+
_this.model.submitting = false;
|
|
20352
|
+
return false;
|
|
20019
20353
|
}
|
|
20020
|
-
});
|
|
20021
|
-
}); }, function (error) {
|
|
20022
|
-
if (!error.error.success && error.error.errorCheckExist) {
|
|
20023
20354
|
_this.model.submitting = false;
|
|
20024
|
-
|
|
20025
|
-
|
|
20026
|
-
|
|
20027
|
-
_this.showMessageAfterInsert(false, error);
|
|
20028
|
-
});
|
|
20029
|
-
return [2 /*return*/];
|
|
20355
|
+
_this.showMessageAfterInsert(false, error);
|
|
20356
|
+
return false;
|
|
20357
|
+
})];
|
|
20030
20358
|
});
|
|
20031
20359
|
});
|
|
20032
20360
|
};
|
|
@@ -20037,10 +20365,11 @@
|
|
|
20037
20365
|
};
|
|
20038
20366
|
DataFormBase.prototype.onUpdate = function () {
|
|
20039
20367
|
return __awaiter(this, void 0, void 0, function () {
|
|
20368
|
+
var updatePromise;
|
|
20040
20369
|
var _this = this;
|
|
20041
20370
|
return __generator(this, function (_e) {
|
|
20042
20371
|
this.setDefaultValue(this.model.data);
|
|
20043
|
-
this.getPromiseActionUpdate()
|
|
20372
|
+
updatePromise = this.getPromiseActionUpdate()
|
|
20044
20373
|
.then(function (response) { return __awaiter(_this, void 0, void 0, function () {
|
|
20045
20374
|
return __generator(this, function (_e) {
|
|
20046
20375
|
switch (_e.label) {
|
|
@@ -20051,30 +20380,32 @@
|
|
|
20051
20380
|
return [4 /*yield*/, this.onAfterSave(response)];
|
|
20052
20381
|
case 1:
|
|
20053
20382
|
_e.sent();
|
|
20054
|
-
this.
|
|
20055
|
-
|
|
20056
|
-
|
|
20057
|
-
|
|
20058
|
-
|
|
20059
|
-
|
|
20383
|
+
if (!this._suppressOnSaved) {
|
|
20384
|
+
this.onSaved.emit({
|
|
20385
|
+
id: this.model.data.id,
|
|
20386
|
+
insert: false,
|
|
20387
|
+
isCloseForm: this.isCloseForm
|
|
20388
|
+
});
|
|
20389
|
+
}
|
|
20390
|
+
return [2 /*return*/, true];
|
|
20060
20391
|
case 2:
|
|
20061
20392
|
this.handleUpdateError(response);
|
|
20062
|
-
|
|
20063
|
-
case 3: return [2 /*return*/];
|
|
20393
|
+
return [2 /*return*/, false];
|
|
20064
20394
|
}
|
|
20065
20395
|
});
|
|
20066
20396
|
}); }, function (error) {
|
|
20067
20397
|
if (!error.error.success && error.error.errorCheckExist) {
|
|
20068
20398
|
_this.model.submitting = false;
|
|
20069
|
-
return;
|
|
20399
|
+
return false;
|
|
20070
20400
|
}
|
|
20071
20401
|
_this.model.submitting = false;
|
|
20072
20402
|
_this.showMessageAfterUpdate(false, error);
|
|
20403
|
+
return false;
|
|
20073
20404
|
});
|
|
20074
20405
|
if (this.logSetting.isEnableLog) {
|
|
20075
20406
|
this.logSetting.arrValueAfterUpdate = [];
|
|
20076
20407
|
}
|
|
20077
|
-
return [2 /*return
|
|
20408
|
+
return [2 /*return*/, updatePromise];
|
|
20078
20409
|
});
|
|
20079
20410
|
});
|
|
20080
20411
|
};
|
|
@@ -20192,6 +20523,7 @@
|
|
|
20192
20523
|
parentSetting: [{ type: i0.Input }],
|
|
20193
20524
|
model: [{ type: i0.Input }],
|
|
20194
20525
|
forceOnlyView: [{ type: i0.Input }],
|
|
20526
|
+
crudList: [{ type: i0.Input }],
|
|
20195
20527
|
onSave: [{ type: i0.Output }],
|
|
20196
20528
|
onSaved: [{ type: i0.Output }],
|
|
20197
20529
|
onCancel: [{ type: i0.Output }],
|
|
@@ -22459,192 +22791,6 @@
|
|
|
22459
22791
|
{ type: ModuleConfigService }
|
|
22460
22792
|
]; };
|
|
22461
22793
|
|
|
22462
|
-
var WorkflowPermissionDetailService = /** @class */ (function (_super) {
|
|
22463
|
-
__extends(WorkflowPermissionDetailService, _super);
|
|
22464
|
-
function WorkflowPermissionDetailService(http, injector, _moduleConfigService) {
|
|
22465
|
-
var _this = _super.call(this, http, injector, _moduleConfigService.getConfig().environment.apiDomain.workflowEndpoint + "/" + _moduleConfigService.getConfig().environment.apiVersion + "/WorkflowPermissionDetail") || this;
|
|
22466
|
-
_this.serviceManagers = {};
|
|
22467
|
-
_this.entityName = 'WorkflowPermissionDetail';
|
|
22468
|
-
_this.tableName = '';
|
|
22469
|
-
_this.guidEmpty = '00000000-0000-0000-0000-000000000000';
|
|
22470
|
-
_this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.workflowEndpoint;
|
|
22471
|
-
_this._moduleConfig = _moduleConfigService.getConfig();
|
|
22472
|
-
return _this;
|
|
22473
|
-
}
|
|
22474
|
-
WorkflowPermissionDetailService.prototype.registerService = function (settingKey, service) {
|
|
22475
|
-
this.serviceManagers[settingKey] = service;
|
|
22476
|
-
};
|
|
22477
|
-
WorkflowPermissionDetailService.prototype.getEndpointByService = function (service) {
|
|
22478
|
-
return service.endPoint + "/" + this._moduleConfig.environment.apiVersion;
|
|
22479
|
-
};
|
|
22480
|
-
WorkflowPermissionDetailService.prototype.changeEndpoint = function (baseService) {
|
|
22481
|
-
this.serviceUri = this.getEndpointByService(baseService) + "/WorkflowPermissionDetail";
|
|
22482
|
-
this.tableName = baseService.entityName;
|
|
22483
|
-
return this;
|
|
22484
|
-
};
|
|
22485
|
-
WorkflowPermissionDetailService.prototype.appendInfoForWorkflowSingle = function (userIdCurrent, data, fieldKey, ignoreWorkflow, callBackWhenNotHaveStatus) {
|
|
22486
|
-
if (fieldKey === void 0) { fieldKey = 'id'; }
|
|
22487
|
-
if (ignoreWorkflow === void 0) { ignoreWorkflow = false; }
|
|
22488
|
-
if (callBackWhenNotHaveStatus === void 0) { callBackWhenNotHaveStatus = null; }
|
|
22489
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
22490
|
-
var itemId, filters, sorts, dataStatus, notifierService;
|
|
22491
|
-
return __generator(this, function (_a) {
|
|
22492
|
-
switch (_a.label) {
|
|
22493
|
-
case 0:
|
|
22494
|
-
if (callBackWhenNotHaveStatus == null) {
|
|
22495
|
-
callBackWhenNotHaveStatus = function (itemStatus, rowItem) {
|
|
22496
|
-
if (rowItem[fieldKey]
|
|
22497
|
-
&& rowItem.workflowCode
|
|
22498
|
-
&& rowItem.currentStateCode) {
|
|
22499
|
-
itemStatus.textTrangThai = 'Đã bắt đầu quy trình';
|
|
22500
|
-
itemStatus.trangThai = rowItem.currentStateCode;
|
|
22501
|
-
itemStatus.workflowCode = rowItem.workflowCode;
|
|
22502
|
-
itemStatus.permission = exports.PermissionBase.READ;
|
|
22503
|
-
}
|
|
22504
|
-
};
|
|
22505
|
-
}
|
|
22506
|
-
itemId = data[fieldKey];
|
|
22507
|
-
filters = [
|
|
22508
|
-
this.newFilter('itemId', exports.Operator.equal, itemId),
|
|
22509
|
-
this.newFilter('notInWorkflow', exports.Operator.equal, false),
|
|
22510
|
-
];
|
|
22511
|
-
sorts = [];
|
|
22512
|
-
if (!ignoreWorkflow) {
|
|
22513
|
-
filters.push(this.newFilter('userId', exports.Operator.equal, userIdCurrent));
|
|
22514
|
-
}
|
|
22515
|
-
else {
|
|
22516
|
-
sorts.push(new Sort({ field: 'permission', dir: -1 }), new Sort({ field: 'inComing', dir: -1 }), new Sort({ field: 'isCOEdit', dir: -1 }));
|
|
22517
|
-
}
|
|
22518
|
-
return [4 /*yield*/, this.getAll(filters, 'itemId,userId,trangThai,textTrangThai,workflowCode,permission,isCOEdit', sorts, 'ForCrudList')];
|
|
22519
|
-
case 1:
|
|
22520
|
-
dataStatus = (_a.sent()).data;
|
|
22521
|
-
if (dataStatus == null) {
|
|
22522
|
-
notifierService = this._injector.get(NotifierService);
|
|
22523
|
-
return [2 /*return*/, notifierService.showWarning('Không lấy được thông tin trạng thái hiện tại của bản ghi')];
|
|
22524
|
-
}
|
|
22525
|
-
this.appendWorkflowInfoToItem(data, itemId, userIdCurrent, ignoreWorkflow, dataStatus, callBackWhenNotHaveStatus);
|
|
22526
|
-
return [2 /*return*/, true];
|
|
22527
|
-
}
|
|
22528
|
-
});
|
|
22529
|
-
});
|
|
22530
|
-
};
|
|
22531
|
-
WorkflowPermissionDetailService.prototype.appendWorkflowInfoToItem = function (data, itemId, userIdCurrent, ignoreWorkflow, dataStatus, callBackWhenNotHaveStatus) {
|
|
22532
|
-
var _this = this;
|
|
22533
|
-
if (callBackWhenNotHaveStatus === void 0) { callBackWhenNotHaveStatus = null; }
|
|
22534
|
-
var itemStatus = {
|
|
22535
|
-
textTrangThai: 'Chưa chạy quy trình'
|
|
22536
|
-
};
|
|
22537
|
-
if (itemId) {
|
|
22538
|
-
// const lstItemStatus = dataStatus.filter(q => q.itemId == itemId && q.userId == userIdCurrent);
|
|
22539
|
-
// if (ignoreWorkflow === true && lstItemStatus.length === 0) {
|
|
22540
|
-
// lstItemStatus.push(...dataStatus.filter(q => q.itemId === itemId));
|
|
22541
|
-
// }
|
|
22542
|
-
var lstItemStatus = dataStatus.filter(function (q) { return q.itemId === itemId; });
|
|
22543
|
-
// let itemStatus = null;
|
|
22544
|
-
if (lstItemStatus.length) {
|
|
22545
|
-
itemStatus = lstItemStatus.find(function (q) { return (q.permission & exports.PermissionBase.EDIT) == exports.PermissionBase.EDIT; });
|
|
22546
|
-
if (itemStatus == null) {
|
|
22547
|
-
itemStatus = lstItemStatus[0];
|
|
22548
|
-
}
|
|
22549
|
-
}
|
|
22550
|
-
}
|
|
22551
|
-
// Nếu không có bản ghi trạng thái
|
|
22552
|
-
// Nhưng đã tạo task rồi thì hiển thị trạng thái "đã tạo công việc" để tránh trường hợp hiển thị nút bắt đầu thừa trên giao diện
|
|
22553
|
-
if (!itemStatus.trangThai) {
|
|
22554
|
-
callBackWhenNotHaveStatus(itemStatus, data);
|
|
22555
|
-
}
|
|
22556
|
-
data.__isCoEdit = dataStatus.some(function (x) { return x.itemId === itemId && x.userId != _this.guidEmpty && x.isCOEdit; });
|
|
22557
|
-
data.__trangThai = itemStatus.trangThai;
|
|
22558
|
-
data.__textTrangThai = itemStatus.textTrangThai;
|
|
22559
|
-
if (itemStatus.workflowCode == DummyWorkflowCode) {
|
|
22560
|
-
data.hiddenWorkflowAction = true;
|
|
22561
|
-
}
|
|
22562
|
-
data.__workflowCode = itemStatus.workflowCode;
|
|
22563
|
-
data.__permission = itemStatus.permission;
|
|
22564
|
-
data.__disableEdit = true;
|
|
22565
|
-
data.__disableDelete = true;
|
|
22566
|
-
if (data.basePermission & exports.PermissionBase.EDIT
|
|
22567
|
-
|| data.__permission & exports.PermissionBase.EDIT) {
|
|
22568
|
-
data.__disableEdit = false;
|
|
22569
|
-
}
|
|
22570
|
-
else {
|
|
22571
|
-
data.__disablePermissionEdit = true;
|
|
22572
|
-
}
|
|
22573
|
-
if (data.basePermission & exports.PermissionBase.DELETE
|
|
22574
|
-
|| data.__permission & exports.PermissionBase.DELETE) {
|
|
22575
|
-
data.__disableDelete = false;
|
|
22576
|
-
}
|
|
22577
|
-
else {
|
|
22578
|
-
data.__disablePermissionDelete = true;
|
|
22579
|
-
}
|
|
22580
|
-
};
|
|
22581
|
-
/**
|
|
22582
|
-
* Lấy thêm các thông tin cần cho quy trình nghiệp vụ cho các bản ghi trong data
|
|
22583
|
-
*/
|
|
22584
|
-
WorkflowPermissionDetailService.prototype.appendInfoForWorkflow = function (userIdCurrent, data, fieldKey, ignoreWorkflow, callBackWhenNotHaveStatus) {
|
|
22585
|
-
if (fieldKey === void 0) { fieldKey = 'id'; }
|
|
22586
|
-
if (ignoreWorkflow === void 0) { ignoreWorkflow = false; }
|
|
22587
|
-
if (callBackWhenNotHaveStatus === void 0) { callBackWhenNotHaveStatus = null; }
|
|
22588
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
22589
|
-
var lstItemId, filters, sorts, dataStatus, notifierService;
|
|
22590
|
-
var _this = this;
|
|
22591
|
-
return __generator(this, function (_a) {
|
|
22592
|
-
switch (_a.label) {
|
|
22593
|
-
case 0:
|
|
22594
|
-
if (callBackWhenNotHaveStatus == null) {
|
|
22595
|
-
callBackWhenNotHaveStatus = function (itemStatus, rowItem) {
|
|
22596
|
-
if (rowItem[fieldKey]
|
|
22597
|
-
&& rowItem.workflowCode
|
|
22598
|
-
&& rowItem.currentStateCode) {
|
|
22599
|
-
itemStatus.textTrangThai = 'Đã bắt đầu quy trình';
|
|
22600
|
-
itemStatus.trangThai = rowItem.currentStateCode;
|
|
22601
|
-
itemStatus.workflowCode = rowItem.workflowCode;
|
|
22602
|
-
itemStatus.permission = exports.PermissionBase.READ;
|
|
22603
|
-
}
|
|
22604
|
-
};
|
|
22605
|
-
}
|
|
22606
|
-
lstItemId = data.filter(function (q) { return q[fieldKey]; }).map(function (q) { return q[fieldKey]; });
|
|
22607
|
-
filters = [
|
|
22608
|
-
this.newFilter('itemId', exports.Operator.in, lstItemId),
|
|
22609
|
-
this.newFilter('notInWorkflow', exports.Operator.equal, false),
|
|
22610
|
-
];
|
|
22611
|
-
if (this.tableName) {
|
|
22612
|
-
filters.push(this.newFilter('tableName', exports.Operator.equal, this.tableName));
|
|
22613
|
-
}
|
|
22614
|
-
sorts = [];
|
|
22615
|
-
// if (!ignoreWorkflow) {
|
|
22616
|
-
// filters.push(this.newFilter('userId', Operator.equal, userIdCurrent));
|
|
22617
|
-
// }
|
|
22618
|
-
sorts.push(new Sort({ field: 'permission', dir: -1 }), new Sort({ field: 'inComing', dir: -1 }), new Sort({ field: 'isCOEdit', dir: -1 }));
|
|
22619
|
-
return [4 /*yield*/, this.getAll(filters, 'itemId,userId,trangThai,textTrangThai,workflowCode,permission,isCOEdit', sorts, 'ForCrudList')];
|
|
22620
|
-
case 1:
|
|
22621
|
-
dataStatus = (_a.sent()).data;
|
|
22622
|
-
if (dataStatus == null) {
|
|
22623
|
-
notifierService = this._injector.get(NotifierService);
|
|
22624
|
-
return [2 /*return*/, notifierService.showWarning('Không lấy được thông tin trạng thái hiện tại của bản ghi')];
|
|
22625
|
-
}
|
|
22626
|
-
data.forEach(function (rowItem) {
|
|
22627
|
-
_this.appendWorkflowInfoToItem(rowItem, rowItem[fieldKey], userIdCurrent, ignoreWorkflow, dataStatus, callBackWhenNotHaveStatus);
|
|
22628
|
-
});
|
|
22629
|
-
return [2 /*return*/, true];
|
|
22630
|
-
}
|
|
22631
|
-
});
|
|
22632
|
-
});
|
|
22633
|
-
};
|
|
22634
|
-
return WorkflowPermissionDetailService;
|
|
22635
|
-
}(BaseService));
|
|
22636
|
-
WorkflowPermissionDetailService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function WorkflowPermissionDetailService_Factory() { return new WorkflowPermissionDetailService(i0__namespace.ɵɵinject(i1__namespace$1.HttpClient), i0__namespace.ɵɵinject(i0__namespace.INJECTOR), i0__namespace.ɵɵinject(ModuleConfigService)); }, token: WorkflowPermissionDetailService, providedIn: "root" });
|
|
22637
|
-
WorkflowPermissionDetailService.decorators = [
|
|
22638
|
-
{ type: i0.Injectable, args: [{
|
|
22639
|
-
providedIn: 'root'
|
|
22640
|
-
},] }
|
|
22641
|
-
];
|
|
22642
|
-
WorkflowPermissionDetailService.ctorParameters = function () { return [
|
|
22643
|
-
{ type: i1$1.HttpClient },
|
|
22644
|
-
{ type: i0.Injector },
|
|
22645
|
-
{ type: ModuleConfigService }
|
|
22646
|
-
]; };
|
|
22647
|
-
|
|
22648
22794
|
var sort_by;
|
|
22649
22795
|
(function () {
|
|
22650
22796
|
var defaultCompareFunc = function (a, b) {
|
|
@@ -26143,6 +26289,7 @@
|
|
|
26143
26289
|
buttonContexts.push({
|
|
26144
26290
|
soThuTu: action.soThuTu,
|
|
26145
26291
|
actionCode: action.code,
|
|
26292
|
+
isActionAllow: true,
|
|
26146
26293
|
icon: _this.sourceIcon[action.icon],
|
|
26147
26294
|
label: action.name,
|
|
26148
26295
|
command: function () { return _this.processWorkflow(crudListSetting, itemWorkflowSetting_1, action); }
|
|
@@ -56795,7 +56942,7 @@
|
|
|
56795
56942
|
TnDialogComponent.decorators = [
|
|
56796
56943
|
{ type: i0.Component, args: [{
|
|
56797
56944
|
selector: 'tn-dialog',
|
|
56798
|
-
template: "<p-dialog #dialog [closeOnEscape]=\"closeOnEscape\" [appendTo]=\"'body'\" [focusOnShow]=\"false\" [focusTrap]=\"false\"\n [(visible)]=\"visible\" [modal]=\"modal\" [responsive]=\"true\" [maximizable]=\"maximizable\" [autoZIndex]=\"true\"\n [styleClass]=\"styleClass\" [maskStyleClass]=\"maskClass\" [showHeader]=\"showHeader\"\n [style]=\"{'width': popupSize.width + 'px', 'min-width': popupSize.width + 'px', 'height': popupSize.height + 'px', 'min-height': popupSize.height + 'px'}\"\n (onShow)=\"handleShowDialog($event)\" (onHide)=\"handleHideDialog($event)\">\n <tn-custom-scrollbar #scrollbar [useDefaultScrollBar]=\"useDefaultScrollBar\" [class]=\"scrollBarStyleClass\"\n [config]=\"scrollConfig\" [style]=\"scrollStyle\" class=\"tn-dialog-scrollbar\">\n <ng-content></ng-content>\n </tn-custom-scrollbar>\n <p-header *ngIf=\"showHeader\">\n <ng-container *ngIf=\"header && !headerTemplate\">\n <div>{{header | translate}}</div>\n </ng-container>\n <ng-container *ngIf=\"headerTemplate\">\n <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n </ng-container>\n </p-header>\n <p-footer *ngIf=\"showFooter\">\n <p-footer *ngIf=\"formBase && formBase.buttonTemplate\" style=\"display: flex;float: right\">\n <ng-container *ngTemplateOutlet=\"formBase.buttonTemplate\">\n </ng-container>\n </p-footer>\n <ng-container *ngIf=\"!formBase || !formBase.buttonTemplate\">\n <p-footer *ngIf=\"footer\">\n <ng-container *ngTemplateOutlet=\"footer\"></ng-container>\n </p-footer>\n <p-footer *ngIf=\"buttonTemplateInput\">\n <ng-container *ngTemplateOutlet=\"buttonTemplateInput\"></ng-container>\n </p-footer>\n <p-footer *ngIf=\"!footer && !buttonTemplateInput\">\n <button pButton preventTab type=\"button\" icon=\"pi pi-replay\" class=\"p-button-text p-button-secondary\"\n [label]=\"'FORM.CANCEL' | translate\" (click)=\"handleHideDialog($event)\"></button>\n </p-footer>\n </ng-container>\n </p-footer>\n</p-dialog>",
|
|
56945
|
+
template: "<p-dialog #dialog [closeOnEscape]=\"closeOnEscape\" [appendTo]=\"'body'\" [focusOnShow]=\"false\" [focusTrap]=\"false\"\n [(visible)]=\"visible\" [modal]=\"modal\" [responsive]=\"true\" [maximizable]=\"maximizable\" [autoZIndex]=\"true\"\n [styleClass]=\"styleClass\" [maskStyleClass]=\"maskClass\" [showHeader]=\"showHeader\"\n [style]=\"{'width': popupSize.width + 'px', 'min-width': popupSize.width + 'px', 'height': popupSize.height + 'px', 'min-height': popupSize.height + 'px'}\"\n (onShow)=\"handleShowDialog($event)\" (onHide)=\"handleHideDialog($event)\">\n <tn-custom-scrollbar #scrollbar [useDefaultScrollBar]=\"useDefaultScrollBar\" [class]=\"scrollBarStyleClass\"\n [config]=\"scrollConfig\" [style]=\"scrollStyle\" class=\"tn-dialog-scrollbar\">\n <ng-content></ng-content>\n </tn-custom-scrollbar>\n <p-header *ngIf=\"showHeader\">\n <ng-container *ngIf=\"header && !headerTemplate\">\n <div>{{header | translate}}</div>\n </ng-container>\n <ng-container *ngIf=\"headerTemplate\">\n <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n </ng-container>\n </p-header>\n <p-footer *ngIf=\"showFooter\">\n <p-footer *ngIf=\"formBase && formBase.buttonTemplate\" style=\"display: flex;float: right\">\n <button *ngFor=\"let butt of formBase.buttons\" pButton [icon]=\"butt.icon\" class=\"p-button-text\"\n [label]=\"butt.label\" (click)=\"butt.command()\"></button>\n <ng-container *ngTemplateOutlet=\"formBase.buttonTemplate\">\n </ng-container>\n </p-footer>\n <ng-container *ngIf=\"!formBase || !formBase.buttonTemplate\">\n <p-footer *ngIf=\"footer\">\n <ng-container *ngTemplateOutlet=\"footer\"></ng-container>\n </p-footer>\n <p-footer *ngIf=\"buttonTemplateInput\">\n <ng-container *ngTemplateOutlet=\"buttonTemplateInput\"></ng-container>\n </p-footer>\n <p-footer *ngIf=\"!footer && !buttonTemplateInput\">\n <button pButton preventTab type=\"button\" icon=\"pi pi-replay\" class=\"p-button-text p-button-secondary\"\n [label]=\"'FORM.CANCEL' | translate\" (click)=\"handleHideDialog($event)\"></button>\n </p-footer>\n </ng-container>\n </p-footer>\n</p-dialog>",
|
|
56799
56946
|
styles: [""]
|
|
56800
56947
|
},] }
|
|
56801
56948
|
];
|