tnx-shared 5.3.429 → 5.3.431
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 +402 -253
- 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/classes/form-schema.d.ts +1 -0
- package/classes/form-schema.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/classes/form-schema.js +3 -1
- package/esm2015/components/crud/crud-form/crud-form.component.js +1 -1
- package/esm2015/components/entity-picker/entity-picker-dialog/components/entity-picker-data/entity-picker-data.component.js +3 -3
- package/esm2015/components/tn-dialog/tn-dialog.component.js +2 -2
- package/fesm2015/tnx-shared.js +317 -180
- package/fesm2015/tnx-shared.js.map +1 -1
- package/package.json +2 -2
- package/tnx-shared.metadata.json +1 -1
|
@@ -1709,6 +1709,8 @@
|
|
|
1709
1709
|
_this.ignoreWorkflow = false;
|
|
1710
1710
|
_this.rowButtonTemplate = null;
|
|
1711
1711
|
_this.rowButtonBeforeTemplate = null;
|
|
1712
|
+
// true: hiển thị templateFilterHeader thành cột bên trái danh sách (giống popup user-picker), thay vì ở trên
|
|
1713
|
+
_this.filterHeaderAsLeftPanel = false;
|
|
1712
1714
|
_this.hiddenPageSetting = false;
|
|
1713
1715
|
_this.showEditLink = true;
|
|
1714
1716
|
_this.titleUnPicked = 'Danh sách các mục chưa chọn';
|
|
@@ -11639,7 +11641,13 @@
|
|
|
11639
11641
|
var ComponentBaseWithButton = /** @class */ (function (_super) {
|
|
11640
11642
|
__extends(ComponentBaseWithButton, _super);
|
|
11641
11643
|
function ComponentBaseWithButton(_injector) {
|
|
11642
|
-
|
|
11644
|
+
var _this = _super.call(this, _injector) || this;
|
|
11645
|
+
// Danh sách nút hành động quy trình. Được render TỰ ĐỘNG ở footer của tn-dialog,
|
|
11646
|
+
// nên form không cần tự khai báo *ngFor trong #buttonTemplate.
|
|
11647
|
+
_this.buttons = [];
|
|
11648
|
+
// 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.
|
|
11649
|
+
_this.workflowButtonLabelPrefix = 'Lưu và ';
|
|
11650
|
+
return _this;
|
|
11643
11651
|
}
|
|
11644
11652
|
return ComponentBaseWithButton;
|
|
11645
11653
|
}(ComponentBase));
|
|
@@ -19029,6 +19037,192 @@
|
|
|
19029
19037
|
{ type: StorageUpdatedService }
|
|
19030
19038
|
]; };
|
|
19031
19039
|
|
|
19040
|
+
var WorkflowPermissionDetailService = /** @class */ (function (_super) {
|
|
19041
|
+
__extends(WorkflowPermissionDetailService, _super);
|
|
19042
|
+
function WorkflowPermissionDetailService(http, injector, _moduleConfigService) {
|
|
19043
|
+
var _this = _super.call(this, http, injector, _moduleConfigService.getConfig().environment.apiDomain.workflowEndpoint + "/" + _moduleConfigService.getConfig().environment.apiVersion + "/WorkflowPermissionDetail") || this;
|
|
19044
|
+
_this.serviceManagers = {};
|
|
19045
|
+
_this.entityName = 'WorkflowPermissionDetail';
|
|
19046
|
+
_this.tableName = '';
|
|
19047
|
+
_this.guidEmpty = '00000000-0000-0000-0000-000000000000';
|
|
19048
|
+
_this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.workflowEndpoint;
|
|
19049
|
+
_this._moduleConfig = _moduleConfigService.getConfig();
|
|
19050
|
+
return _this;
|
|
19051
|
+
}
|
|
19052
|
+
WorkflowPermissionDetailService.prototype.registerService = function (settingKey, service) {
|
|
19053
|
+
this.serviceManagers[settingKey] = service;
|
|
19054
|
+
};
|
|
19055
|
+
WorkflowPermissionDetailService.prototype.getEndpointByService = function (service) {
|
|
19056
|
+
return service.endPoint + "/" + this._moduleConfig.environment.apiVersion;
|
|
19057
|
+
};
|
|
19058
|
+
WorkflowPermissionDetailService.prototype.changeEndpoint = function (baseService) {
|
|
19059
|
+
this.serviceUri = this.getEndpointByService(baseService) + "/WorkflowPermissionDetail";
|
|
19060
|
+
this.tableName = baseService.entityName;
|
|
19061
|
+
return this;
|
|
19062
|
+
};
|
|
19063
|
+
WorkflowPermissionDetailService.prototype.appendInfoForWorkflowSingle = function (userIdCurrent, data, fieldKey, ignoreWorkflow, callBackWhenNotHaveStatus) {
|
|
19064
|
+
if (fieldKey === void 0) { fieldKey = 'id'; }
|
|
19065
|
+
if (ignoreWorkflow === void 0) { ignoreWorkflow = false; }
|
|
19066
|
+
if (callBackWhenNotHaveStatus === void 0) { callBackWhenNotHaveStatus = null; }
|
|
19067
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
19068
|
+
var itemId, filters, sorts, dataStatus, notifierService;
|
|
19069
|
+
return __generator(this, function (_a) {
|
|
19070
|
+
switch (_a.label) {
|
|
19071
|
+
case 0:
|
|
19072
|
+
if (callBackWhenNotHaveStatus == null) {
|
|
19073
|
+
callBackWhenNotHaveStatus = function (itemStatus, rowItem) {
|
|
19074
|
+
if (rowItem[fieldKey]
|
|
19075
|
+
&& rowItem.workflowCode
|
|
19076
|
+
&& rowItem.currentStateCode) {
|
|
19077
|
+
itemStatus.textTrangThai = 'Đã bắt đầu quy trình';
|
|
19078
|
+
itemStatus.trangThai = rowItem.currentStateCode;
|
|
19079
|
+
itemStatus.workflowCode = rowItem.workflowCode;
|
|
19080
|
+
itemStatus.permission = exports.PermissionBase.READ;
|
|
19081
|
+
}
|
|
19082
|
+
};
|
|
19083
|
+
}
|
|
19084
|
+
itemId = data[fieldKey];
|
|
19085
|
+
filters = [
|
|
19086
|
+
this.newFilter('itemId', exports.Operator.equal, itemId),
|
|
19087
|
+
this.newFilter('notInWorkflow', exports.Operator.equal, false),
|
|
19088
|
+
];
|
|
19089
|
+
sorts = [];
|
|
19090
|
+
if (!ignoreWorkflow) {
|
|
19091
|
+
filters.push(this.newFilter('userId', exports.Operator.equal, userIdCurrent));
|
|
19092
|
+
}
|
|
19093
|
+
else {
|
|
19094
|
+
sorts.push(new Sort({ field: 'permission', dir: -1 }), new Sort({ field: 'inComing', dir: -1 }), new Sort({ field: 'isCOEdit', dir: -1 }));
|
|
19095
|
+
}
|
|
19096
|
+
return [4 /*yield*/, this.getAll(filters, 'itemId,userId,trangThai,textTrangThai,workflowCode,permission,isCOEdit', sorts, 'ForCrudList')];
|
|
19097
|
+
case 1:
|
|
19098
|
+
dataStatus = (_a.sent()).data;
|
|
19099
|
+
if (dataStatus == null) {
|
|
19100
|
+
notifierService = this._injector.get(NotifierService);
|
|
19101
|
+
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')];
|
|
19102
|
+
}
|
|
19103
|
+
this.appendWorkflowInfoToItem(data, itemId, userIdCurrent, ignoreWorkflow, dataStatus, callBackWhenNotHaveStatus);
|
|
19104
|
+
return [2 /*return*/, true];
|
|
19105
|
+
}
|
|
19106
|
+
});
|
|
19107
|
+
});
|
|
19108
|
+
};
|
|
19109
|
+
WorkflowPermissionDetailService.prototype.appendWorkflowInfoToItem = function (data, itemId, userIdCurrent, ignoreWorkflow, dataStatus, callBackWhenNotHaveStatus) {
|
|
19110
|
+
var _this = this;
|
|
19111
|
+
if (callBackWhenNotHaveStatus === void 0) { callBackWhenNotHaveStatus = null; }
|
|
19112
|
+
var itemStatus = {
|
|
19113
|
+
textTrangThai: 'Chưa chạy quy trình'
|
|
19114
|
+
};
|
|
19115
|
+
if (itemId) {
|
|
19116
|
+
// const lstItemStatus = dataStatus.filter(q => q.itemId == itemId && q.userId == userIdCurrent);
|
|
19117
|
+
// if (ignoreWorkflow === true && lstItemStatus.length === 0) {
|
|
19118
|
+
// lstItemStatus.push(...dataStatus.filter(q => q.itemId === itemId));
|
|
19119
|
+
// }
|
|
19120
|
+
var lstItemStatus = dataStatus.filter(function (q) { return q.itemId === itemId; });
|
|
19121
|
+
// let itemStatus = null;
|
|
19122
|
+
if (lstItemStatus.length) {
|
|
19123
|
+
itemStatus = lstItemStatus.find(function (q) { return (q.permission & exports.PermissionBase.EDIT) == exports.PermissionBase.EDIT; });
|
|
19124
|
+
if (itemStatus == null) {
|
|
19125
|
+
itemStatus = lstItemStatus[0];
|
|
19126
|
+
}
|
|
19127
|
+
}
|
|
19128
|
+
}
|
|
19129
|
+
// Nếu không có bản ghi trạng thái
|
|
19130
|
+
// 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
|
|
19131
|
+
if (!itemStatus.trangThai) {
|
|
19132
|
+
callBackWhenNotHaveStatus(itemStatus, data);
|
|
19133
|
+
}
|
|
19134
|
+
data.__isCoEdit = dataStatus.some(function (x) { return x.itemId === itemId && x.userId != _this.guidEmpty && x.isCOEdit; });
|
|
19135
|
+
data.__trangThai = itemStatus.trangThai;
|
|
19136
|
+
data.__textTrangThai = itemStatus.textTrangThai;
|
|
19137
|
+
if (itemStatus.workflowCode == DummyWorkflowCode) {
|
|
19138
|
+
data.hiddenWorkflowAction = true;
|
|
19139
|
+
}
|
|
19140
|
+
data.__workflowCode = itemStatus.workflowCode;
|
|
19141
|
+
data.__permission = itemStatus.permission;
|
|
19142
|
+
data.__disableEdit = true;
|
|
19143
|
+
data.__disableDelete = true;
|
|
19144
|
+
if (data.basePermission & exports.PermissionBase.EDIT
|
|
19145
|
+
|| data.__permission & exports.PermissionBase.EDIT) {
|
|
19146
|
+
data.__disableEdit = false;
|
|
19147
|
+
}
|
|
19148
|
+
else {
|
|
19149
|
+
data.__disablePermissionEdit = true;
|
|
19150
|
+
}
|
|
19151
|
+
if (data.basePermission & exports.PermissionBase.DELETE
|
|
19152
|
+
|| data.__permission & exports.PermissionBase.DELETE) {
|
|
19153
|
+
data.__disableDelete = false;
|
|
19154
|
+
}
|
|
19155
|
+
else {
|
|
19156
|
+
data.__disablePermissionDelete = true;
|
|
19157
|
+
}
|
|
19158
|
+
};
|
|
19159
|
+
/**
|
|
19160
|
+
* 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
|
|
19161
|
+
*/
|
|
19162
|
+
WorkflowPermissionDetailService.prototype.appendInfoForWorkflow = function (userIdCurrent, data, fieldKey, ignoreWorkflow, callBackWhenNotHaveStatus) {
|
|
19163
|
+
if (fieldKey === void 0) { fieldKey = 'id'; }
|
|
19164
|
+
if (ignoreWorkflow === void 0) { ignoreWorkflow = false; }
|
|
19165
|
+
if (callBackWhenNotHaveStatus === void 0) { callBackWhenNotHaveStatus = null; }
|
|
19166
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
19167
|
+
var lstItemId, filters, sorts, dataStatus, notifierService;
|
|
19168
|
+
var _this = this;
|
|
19169
|
+
return __generator(this, function (_a) {
|
|
19170
|
+
switch (_a.label) {
|
|
19171
|
+
case 0:
|
|
19172
|
+
if (callBackWhenNotHaveStatus == null) {
|
|
19173
|
+
callBackWhenNotHaveStatus = function (itemStatus, rowItem) {
|
|
19174
|
+
if (rowItem[fieldKey]
|
|
19175
|
+
&& rowItem.workflowCode
|
|
19176
|
+
&& rowItem.currentStateCode) {
|
|
19177
|
+
itemStatus.textTrangThai = 'Đã bắt đầu quy trình';
|
|
19178
|
+
itemStatus.trangThai = rowItem.currentStateCode;
|
|
19179
|
+
itemStatus.workflowCode = rowItem.workflowCode;
|
|
19180
|
+
itemStatus.permission = exports.PermissionBase.READ;
|
|
19181
|
+
}
|
|
19182
|
+
};
|
|
19183
|
+
}
|
|
19184
|
+
lstItemId = data.filter(function (q) { return q[fieldKey]; }).map(function (q) { return q[fieldKey]; });
|
|
19185
|
+
filters = [
|
|
19186
|
+
this.newFilter('itemId', exports.Operator.in, lstItemId),
|
|
19187
|
+
this.newFilter('notInWorkflow', exports.Operator.equal, false),
|
|
19188
|
+
];
|
|
19189
|
+
if (this.tableName) {
|
|
19190
|
+
filters.push(this.newFilter('tableName', exports.Operator.equal, this.tableName));
|
|
19191
|
+
}
|
|
19192
|
+
sorts = [];
|
|
19193
|
+
// if (!ignoreWorkflow) {
|
|
19194
|
+
// filters.push(this.newFilter('userId', Operator.equal, userIdCurrent));
|
|
19195
|
+
// }
|
|
19196
|
+
sorts.push(new Sort({ field: 'permission', dir: -1 }), new Sort({ field: 'inComing', dir: -1 }), new Sort({ field: 'isCOEdit', dir: -1 }));
|
|
19197
|
+
return [4 /*yield*/, this.getAll(filters, 'itemId,userId,trangThai,textTrangThai,workflowCode,permission,isCOEdit', sorts, 'ForCrudList')];
|
|
19198
|
+
case 1:
|
|
19199
|
+
dataStatus = (_a.sent()).data;
|
|
19200
|
+
if (dataStatus == null) {
|
|
19201
|
+
notifierService = this._injector.get(NotifierService);
|
|
19202
|
+
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')];
|
|
19203
|
+
}
|
|
19204
|
+
data.forEach(function (rowItem) {
|
|
19205
|
+
_this.appendWorkflowInfoToItem(rowItem, rowItem[fieldKey], userIdCurrent, ignoreWorkflow, dataStatus, callBackWhenNotHaveStatus);
|
|
19206
|
+
});
|
|
19207
|
+
return [2 /*return*/, true];
|
|
19208
|
+
}
|
|
19209
|
+
});
|
|
19210
|
+
});
|
|
19211
|
+
};
|
|
19212
|
+
return WorkflowPermissionDetailService;
|
|
19213
|
+
}(BaseService));
|
|
19214
|
+
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" });
|
|
19215
|
+
WorkflowPermissionDetailService.decorators = [
|
|
19216
|
+
{ type: i0.Injectable, args: [{
|
|
19217
|
+
providedIn: 'root'
|
|
19218
|
+
},] }
|
|
19219
|
+
];
|
|
19220
|
+
WorkflowPermissionDetailService.ctorParameters = function () { return [
|
|
19221
|
+
{ type: i1$1.HttpClient },
|
|
19222
|
+
{ type: i0.Injector },
|
|
19223
|
+
{ type: ModuleConfigService }
|
|
19224
|
+
]; };
|
|
19225
|
+
|
|
19032
19226
|
var DataFormBase = /** @class */ (function (_super) {
|
|
19033
19227
|
__extends(DataFormBase, _super);
|
|
19034
19228
|
function DataFormBase(_injector) {
|
|
@@ -19053,6 +19247,8 @@
|
|
|
19053
19247
|
_this.autoGetDetail = true;
|
|
19054
19248
|
_this.autoSave = true;
|
|
19055
19249
|
_this.isCloseForm = true;
|
|
19250
|
+
// 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
|
|
19251
|
+
_this._suppressOnSaved = false;
|
|
19056
19252
|
_this.saving = false;
|
|
19057
19253
|
_this.getDetailPlusUrl = null;
|
|
19058
19254
|
_this.insertPlusUrl = null;
|
|
@@ -19077,6 +19273,7 @@
|
|
|
19077
19273
|
_this._entityMetadataService = _this._injector.get(EntityMetadataService);
|
|
19078
19274
|
_this._userService = _this._injector.get(UserService);
|
|
19079
19275
|
_this._commonService = _this._injector.get(CommonService);
|
|
19276
|
+
_this._workflowPermissionDetailService = _this._injector.get(WorkflowPermissionDetailService);
|
|
19080
19277
|
return _this;
|
|
19081
19278
|
}
|
|
19082
19279
|
DataFormBase.prototype.ngOnInit = function () {
|
|
@@ -19206,6 +19403,134 @@
|
|
|
19206
19403
|
evt.rootModel[FieldWorkflowCodeInCrudForm] = workflowSetting.workflowCode;
|
|
19207
19404
|
}
|
|
19208
19405
|
};
|
|
19406
|
+
/**
|
|
19407
|
+
* 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
|
|
19408
|
+
* 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.
|
|
19409
|
+
* Yêu cầu: this.setting.baseService đã được cấu hình và this.crudList được truyền từ crud-list cha.
|
|
19410
|
+
*/
|
|
19411
|
+
DataFormBase.prototype.generateWorkflowButton = function (data) {
|
|
19412
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
19413
|
+
var lstItemStatus, itemStatus, actions;
|
|
19414
|
+
var _this = this;
|
|
19415
|
+
return __generator(this, function (_e) {
|
|
19416
|
+
switch (_e.label) {
|
|
19417
|
+
case 0: return [4 /*yield*/, this._workflowPermissionDetailService.changeEndpoint(this.setting.baseService).getAll([
|
|
19418
|
+
this.newFilter('itemId', exports.Operator.equal, data.id),
|
|
19419
|
+
], 'itemId,userId,trangThai,textTrangThai,workflowCode,permission', [], 'ForCrudList')];
|
|
19420
|
+
case 1:
|
|
19421
|
+
lstItemStatus = (_e.sent()).data;
|
|
19422
|
+
if (lstItemStatus == null) {
|
|
19423
|
+
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')];
|
|
19424
|
+
}
|
|
19425
|
+
itemStatus = null;
|
|
19426
|
+
if (!lstItemStatus.length) {
|
|
19427
|
+
itemStatus = {
|
|
19428
|
+
textTrangThai: 'Chưa chạy quy trình'
|
|
19429
|
+
};
|
|
19430
|
+
}
|
|
19431
|
+
else {
|
|
19432
|
+
data.startedWorkflow = true;
|
|
19433
|
+
itemStatus = lstItemStatus.find(function (q) { return (q.permission & exports.PermissionBase.EDIT) == exports.PermissionBase.EDIT; });
|
|
19434
|
+
if (itemStatus == null) {
|
|
19435
|
+
itemStatus = lstItemStatus[0];
|
|
19436
|
+
}
|
|
19437
|
+
}
|
|
19438
|
+
data.__trangThai = itemStatus.trangThai;
|
|
19439
|
+
data.__textTrangThai = itemStatus.textTrangThai;
|
|
19440
|
+
data.__workflowCode = itemStatus.workflowCode;
|
|
19441
|
+
data.__permission = itemStatus.permission;
|
|
19442
|
+
if (!(data.startedWorkflow && this.crudList)) return [3 /*break*/, 3];
|
|
19443
|
+
return [4 /*yield*/, this.crudList.getActionWorkflow(data)];
|
|
19444
|
+
case 2:
|
|
19445
|
+
actions = _e.sent();
|
|
19446
|
+
if (!Array.isArray(actions))
|
|
19447
|
+
return [2 /*return*/];
|
|
19448
|
+
// Chỉ bọc các action lấy từ getActionAllow; các nút phụ (Thu hồi, Cho ý kiến,
|
|
19449
|
+
// Xem lịch sử, Chuyển xử lý) giữ nguyên hành vi gốc
|
|
19450
|
+
actions.filter(function (b) { return b.isActionAllow; }).forEach(function (b) { return _this._decorateWorkflowActionButton(b); });
|
|
19451
|
+
this.buttons = actions;
|
|
19452
|
+
_e.label = 3;
|
|
19453
|
+
case 3: return [2 /*return*/];
|
|
19454
|
+
}
|
|
19455
|
+
});
|
|
19456
|
+
});
|
|
19457
|
+
};
|
|
19458
|
+
/**
|
|
19459
|
+
* Gắn hành vi cho 1 nút action quy trình (lấy từ getActionAllow):
|
|
19460
|
+
* - 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.
|
|
19461
|
+
* - Chạy action gốc, và đóng form sau khi action thực sự hoàn tất.
|
|
19462
|
+
*/
|
|
19463
|
+
DataFormBase.prototype._decorateWorkflowActionButton = function (button) {
|
|
19464
|
+
var _this = this;
|
|
19465
|
+
var isEdit = this._isFormEdit();
|
|
19466
|
+
var runAction = button.command;
|
|
19467
|
+
if (isEdit) {
|
|
19468
|
+
button.label = this.workflowButtonLabelPrefix + button.label;
|
|
19469
|
+
}
|
|
19470
|
+
button.command = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
19471
|
+
var saved;
|
|
19472
|
+
return __generator(this, function (_e) {
|
|
19473
|
+
switch (_e.label) {
|
|
19474
|
+
case 0:
|
|
19475
|
+
if (this.model.submitting)
|
|
19476
|
+
return [2 /*return*/];
|
|
19477
|
+
if (!(isEdit && this._isWorkflowDataChanged())) return [3 /*break*/, 2];
|
|
19478
|
+
this.model.submitting = true;
|
|
19479
|
+
this._suppressOnSaved = true; // không đóng form khi lưu
|
|
19480
|
+
return [4 /*yield*/, this.save()];
|
|
19481
|
+
case 1:
|
|
19482
|
+
saved = _e.sent();
|
|
19483
|
+
this._suppressOnSaved = false;
|
|
19484
|
+
if (!saved)
|
|
19485
|
+
return [2 /*return*/];
|
|
19486
|
+
_e.label = 2;
|
|
19487
|
+
case 2:
|
|
19488
|
+
if (!runAction)
|
|
19489
|
+
return [2 /*return*/];
|
|
19490
|
+
this._closeFormWhenWorkflowProcessed();
|
|
19491
|
+
return [4 /*yield*/, runAction()];
|
|
19492
|
+
case 3:
|
|
19493
|
+
_e.sent();
|
|
19494
|
+
return [2 /*return*/];
|
|
19495
|
+
}
|
|
19496
|
+
});
|
|
19497
|
+
}); };
|
|
19498
|
+
};
|
|
19499
|
+
/**
|
|
19500
|
+
* Đóng form (phát onSaved) đúng một lần khi crudList báo action quy trình đã xử lý xong.
|
|
19501
|
+
*/
|
|
19502
|
+
DataFormBase.prototype._closeFormWhenWorkflowProcessed = function () {
|
|
19503
|
+
var _this = this;
|
|
19504
|
+
var _a;
|
|
19505
|
+
var processed = (_a = this.crudList) === null || _a === void 0 ? void 0 : _a.onProcessedWorkflow;
|
|
19506
|
+
if (!processed)
|
|
19507
|
+
return;
|
|
19508
|
+
var sub = processed.subscribe(function () {
|
|
19509
|
+
sub.unsubscribe();
|
|
19510
|
+
_this.onSaved.emit({ id: _this.model.data.id, insert: false, isCloseForm: true });
|
|
19511
|
+
});
|
|
19512
|
+
};
|
|
19513
|
+
/**
|
|
19514
|
+
* 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.
|
|
19515
|
+
* Chuẩn hoá cả 2 qua crudForm.getMinimizeData (bỏ _status/_errors/_source, resolve dropdown object về giá trị thô)
|
|
19516
|
+
* để 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.
|
|
19517
|
+
*/
|
|
19518
|
+
/**
|
|
19519
|
+
* 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.
|
|
19520
|
+
*/
|
|
19521
|
+
DataFormBase.prototype._hasWorkflow = function () {
|
|
19522
|
+
var _a;
|
|
19523
|
+
return !!(this.parentSetting
|
|
19524
|
+
&& ((this.parentSetting.workflowSettingNew && ((_a = this.parentSetting.workflowSettingNew.workflows) === null || _a === void 0 ? void 0 : _a.length) > 0)
|
|
19525
|
+
|| this.parentSetting.isWorkflowTree));
|
|
19526
|
+
};
|
|
19527
|
+
DataFormBase.prototype._isWorkflowDataChanged = function () {
|
|
19528
|
+
if (!this.logSetting.valueBeforeUpdate || !this.crudForm)
|
|
19529
|
+
return true;
|
|
19530
|
+
var current = JSON.stringify(this.crudForm.getMinimizeData(this.model.data));
|
|
19531
|
+
var before = JSON.stringify(this.crudForm.getMinimizeData(this.logSetting.valueBeforeUpdate));
|
|
19532
|
+
return current !== before;
|
|
19533
|
+
};
|
|
19209
19534
|
DataFormBase.prototype._handleFormReady = function (formEvent) {
|
|
19210
19535
|
return __awaiter(this, void 0, void 0, function () {
|
|
19211
19536
|
return __generator(this, function (_e) {
|
|
@@ -19306,7 +19631,9 @@
|
|
|
19306
19631
|
return [4 /*yield*/, this.onAfterGetDetail(response.data)];
|
|
19307
19632
|
case 7:
|
|
19308
19633
|
_e.sent();
|
|
19309
|
-
|
|
19634
|
+
// Lưu snapshot dữ liệu trước khi sửa khi: bật log HOẶC form có quy trình
|
|
19635
|
+
// (để 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)
|
|
19636
|
+
if (this.logSetting.isEnableLog || this._hasWorkflow()) {
|
|
19310
19637
|
this.logSetting.valueBeforeUpdate = this._commonService.cloneObject(response.data);
|
|
19311
19638
|
}
|
|
19312
19639
|
return [3 /*break*/, 10];
|
|
@@ -19436,7 +19763,12 @@
|
|
|
19436
19763
|
if (this.logSetting.isEnableLog) {
|
|
19437
19764
|
this.getLogValueAfterLoadDetail();
|
|
19438
19765
|
}
|
|
19439
|
-
return [
|
|
19766
|
+
if (!(this._hasWorkflow() && this.crudList)) return [3 /*break*/, 4];
|
|
19767
|
+
return [4 /*yield*/, this.generateWorkflowButton(data)];
|
|
19768
|
+
case 3:
|
|
19769
|
+
_e.sent();
|
|
19770
|
+
_e.label = 4;
|
|
19771
|
+
case 4: return [2 /*return*/];
|
|
19440
19772
|
}
|
|
19441
19773
|
});
|
|
19442
19774
|
});
|
|
@@ -19821,7 +20153,7 @@
|
|
|
19821
20153
|
case 0: return [4 /*yield*/, this.validateFormBase()];
|
|
19822
20154
|
case 1:
|
|
19823
20155
|
validated = _e.sent();
|
|
19824
|
-
if (!validated) return [3 /*break*/,
|
|
20156
|
+
if (!validated) return [3 /*break*/, 14];
|
|
19825
20157
|
if (!this.logSetting.isEnableLog) return [3 /*break*/, 5];
|
|
19826
20158
|
if (!!this.logSetting.isCustomAll) return [3 /*break*/, 3];
|
|
19827
20159
|
return [4 /*yield*/, this.getLogValue()];
|
|
@@ -19842,27 +20174,26 @@
|
|
|
19842
20174
|
case 6:
|
|
19843
20175
|
_e.sent();
|
|
19844
20176
|
this.triggerSaveFileUpload();
|
|
19845
|
-
if (!this.autoSave) return [3 /*break*/,
|
|
20177
|
+
if (!this.autoSave) return [3 /*break*/, 12];
|
|
19846
20178
|
if (!(this._isFormEdit() || this._isFormView())) return [3 /*break*/, 8];
|
|
19847
20179
|
return [4 /*yield*/, this.onUpdate()];
|
|
19848
|
-
case 7:
|
|
19849
|
-
_e.sent();
|
|
19850
|
-
return [3 /*break*/, 10];
|
|
20180
|
+
case 7: return [2 /*return*/, _e.sent()];
|
|
19851
20181
|
case 8:
|
|
19852
20182
|
if (!this._isFormAddNew()) return [3 /*break*/, 10];
|
|
19853
20183
|
return [4 /*yield*/, this.onInsert()];
|
|
19854
|
-
case 9:
|
|
19855
|
-
|
|
19856
|
-
|
|
19857
|
-
|
|
19858
|
-
case 11:
|
|
20184
|
+
case 9: return [2 /*return*/, _e.sent()];
|
|
20185
|
+
case 10:
|
|
20186
|
+
// form view, do nothing
|
|
20187
|
+
return [2 /*return*/, false];
|
|
20188
|
+
case 11: return [3 /*break*/, 13];
|
|
20189
|
+
case 12:
|
|
19859
20190
|
this.handleManualSave();
|
|
19860
|
-
|
|
19861
|
-
case
|
|
19862
|
-
case
|
|
20191
|
+
return [2 /*return*/, true];
|
|
20192
|
+
case 13: return [3 /*break*/, 15];
|
|
20193
|
+
case 14:
|
|
19863
20194
|
this.model.submitting = false;
|
|
19864
|
-
|
|
19865
|
-
case
|
|
20195
|
+
return [2 /*return*/, false];
|
|
20196
|
+
case 15: return [2 /*return*/];
|
|
19866
20197
|
}
|
|
19867
20198
|
});
|
|
19868
20199
|
});
|
|
@@ -19963,11 +20294,9 @@
|
|
|
19963
20294
|
case 3:
|
|
19964
20295
|
confirmed = _e.sent();
|
|
19965
20296
|
if (!confirmed)
|
|
19966
|
-
return [2 /*return
|
|
20297
|
+
return [2 /*return*/, false];
|
|
19967
20298
|
return [4 /*yield*/, this._insert()];
|
|
19968
|
-
case 4:
|
|
19969
|
-
_e.sent();
|
|
19970
|
-
return [2 /*return*/];
|
|
20299
|
+
case 4: return [2 /*return*/, _e.sent()];
|
|
19971
20300
|
}
|
|
19972
20301
|
});
|
|
19973
20302
|
});
|
|
@@ -19994,39 +20323,40 @@
|
|
|
19994
20323
|
return __awaiter(this, void 0, void 0, function () {
|
|
19995
20324
|
var _this = this;
|
|
19996
20325
|
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
|
-
|
|
20326
|
+
return [2 /*return*/, this.getPromiseActionInsert()
|
|
20327
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () {
|
|
20328
|
+
return __generator(this, function (_e) {
|
|
20329
|
+
switch (_e.label) {
|
|
20330
|
+
case 0:
|
|
20331
|
+
this.model.submitting = false;
|
|
20332
|
+
this.showMessageAfterInsert(response.success, response);
|
|
20333
|
+
if (!response.success) return [3 /*break*/, 2];
|
|
20334
|
+
this.model.data.id = response.data;
|
|
20335
|
+
return [4 /*yield*/, this.onAfterSave(response)];
|
|
20336
|
+
case 1:
|
|
20337
|
+
_e.sent();
|
|
20338
|
+
if (!this._suppressOnSaved) {
|
|
20339
|
+
this.onSaved.emit({
|
|
20340
|
+
id: this.model.data.id,
|
|
20341
|
+
insert: true,
|
|
20342
|
+
isCloseForm: this.isCloseForm
|
|
20343
|
+
});
|
|
20344
|
+
}
|
|
20345
|
+
return [2 /*return*/, true];
|
|
20346
|
+
case 2:
|
|
20347
|
+
this.handleInsertError(response);
|
|
20348
|
+
return [2 /*return*/, false];
|
|
20349
|
+
}
|
|
20350
|
+
});
|
|
20351
|
+
}); }, function (error) {
|
|
20352
|
+
if (!error.error.success && error.error.errorCheckExist) {
|
|
20353
|
+
_this.model.submitting = false;
|
|
20354
|
+
return false;
|
|
20019
20355
|
}
|
|
20020
|
-
});
|
|
20021
|
-
}); }, function (error) {
|
|
20022
|
-
if (!error.error.success && error.error.errorCheckExist) {
|
|
20023
20356
|
_this.model.submitting = false;
|
|
20024
|
-
|
|
20025
|
-
|
|
20026
|
-
|
|
20027
|
-
_this.showMessageAfterInsert(false, error);
|
|
20028
|
-
});
|
|
20029
|
-
return [2 /*return*/];
|
|
20357
|
+
_this.showMessageAfterInsert(false, error);
|
|
20358
|
+
return false;
|
|
20359
|
+
})];
|
|
20030
20360
|
});
|
|
20031
20361
|
});
|
|
20032
20362
|
};
|
|
@@ -20037,10 +20367,11 @@
|
|
|
20037
20367
|
};
|
|
20038
20368
|
DataFormBase.prototype.onUpdate = function () {
|
|
20039
20369
|
return __awaiter(this, void 0, void 0, function () {
|
|
20370
|
+
var updatePromise;
|
|
20040
20371
|
var _this = this;
|
|
20041
20372
|
return __generator(this, function (_e) {
|
|
20042
20373
|
this.setDefaultValue(this.model.data);
|
|
20043
|
-
this.getPromiseActionUpdate()
|
|
20374
|
+
updatePromise = this.getPromiseActionUpdate()
|
|
20044
20375
|
.then(function (response) { return __awaiter(_this, void 0, void 0, function () {
|
|
20045
20376
|
return __generator(this, function (_e) {
|
|
20046
20377
|
switch (_e.label) {
|
|
@@ -20051,30 +20382,32 @@
|
|
|
20051
20382
|
return [4 /*yield*/, this.onAfterSave(response)];
|
|
20052
20383
|
case 1:
|
|
20053
20384
|
_e.sent();
|
|
20054
|
-
this.
|
|
20055
|
-
|
|
20056
|
-
|
|
20057
|
-
|
|
20058
|
-
|
|
20059
|
-
|
|
20385
|
+
if (!this._suppressOnSaved) {
|
|
20386
|
+
this.onSaved.emit({
|
|
20387
|
+
id: this.model.data.id,
|
|
20388
|
+
insert: false,
|
|
20389
|
+
isCloseForm: this.isCloseForm
|
|
20390
|
+
});
|
|
20391
|
+
}
|
|
20392
|
+
return [2 /*return*/, true];
|
|
20060
20393
|
case 2:
|
|
20061
20394
|
this.handleUpdateError(response);
|
|
20062
|
-
|
|
20063
|
-
case 3: return [2 /*return*/];
|
|
20395
|
+
return [2 /*return*/, false];
|
|
20064
20396
|
}
|
|
20065
20397
|
});
|
|
20066
20398
|
}); }, function (error) {
|
|
20067
20399
|
if (!error.error.success && error.error.errorCheckExist) {
|
|
20068
20400
|
_this.model.submitting = false;
|
|
20069
|
-
return;
|
|
20401
|
+
return false;
|
|
20070
20402
|
}
|
|
20071
20403
|
_this.model.submitting = false;
|
|
20072
20404
|
_this.showMessageAfterUpdate(false, error);
|
|
20405
|
+
return false;
|
|
20073
20406
|
});
|
|
20074
20407
|
if (this.logSetting.isEnableLog) {
|
|
20075
20408
|
this.logSetting.arrValueAfterUpdate = [];
|
|
20076
20409
|
}
|
|
20077
|
-
return [2 /*return
|
|
20410
|
+
return [2 /*return*/, updatePromise];
|
|
20078
20411
|
});
|
|
20079
20412
|
});
|
|
20080
20413
|
};
|
|
@@ -20192,6 +20525,7 @@
|
|
|
20192
20525
|
parentSetting: [{ type: i0.Input }],
|
|
20193
20526
|
model: [{ type: i0.Input }],
|
|
20194
20527
|
forceOnlyView: [{ type: i0.Input }],
|
|
20528
|
+
crudList: [{ type: i0.Input }],
|
|
20195
20529
|
onSave: [{ type: i0.Output }],
|
|
20196
20530
|
onSaved: [{ type: i0.Output }],
|
|
20197
20531
|
onCancel: [{ type: i0.Output }],
|
|
@@ -22459,192 +22793,6 @@
|
|
|
22459
22793
|
{ type: ModuleConfigService }
|
|
22460
22794
|
]; };
|
|
22461
22795
|
|
|
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
22796
|
var sort_by;
|
|
22649
22797
|
(function () {
|
|
22650
22798
|
var defaultCompareFunc = function (a, b) {
|
|
@@ -26143,6 +26291,7 @@
|
|
|
26143
26291
|
buttonContexts.push({
|
|
26144
26292
|
soThuTu: action.soThuTu,
|
|
26145
26293
|
actionCode: action.code,
|
|
26294
|
+
isActionAllow: true,
|
|
26146
26295
|
icon: _this.sourceIcon[action.icon],
|
|
26147
26296
|
label: action.name,
|
|
26148
26297
|
command: function () { return _this.processWorkflow(crudListSetting, itemWorkflowSetting_1, action); }
|
|
@@ -49186,9 +49335,9 @@
|
|
|
49186
49335
|
EntityPickerDataComponent.decorators = [
|
|
49187
49336
|
{ type: i0.Component, args: [{
|
|
49188
49337
|
selector: 'app-entity-picker-data',
|
|
49189
|
-
template: "<crud-list #crudList [templates]=\"templates\" [menuButtons]=\"getMenuButtons\"
|
|
49338
|
+
template: "<div class=\"entity-picker-data-body\"\n [class.has-left-filter]=\"control.filterHeaderAsLeftPanel && control.templateFilterHeader\">\n <div class=\"left-filter-panel\" *ngIf=\"control.filterHeaderAsLeftPanel && control.templateFilterHeader\">\n <ng-container *ngTemplateOutlet=\"control.templateFilterHeader; context: filterHeaderContext\"></ng-container>\n </div>\n <crud-list class=\"entity-picker-data-list\" #crudList [templates]=\"templates\" [menuButtons]=\"getMenuButtons\"\n [model]=\"model\" [setting]=\"setting\"\n [dataSource]=\"model.dataSource\" [showScrollHorizontal]=\"true\" (onContentInit)=\"onContentInit.emit($event)\"\n (onReload)=\"_triggerProcessData($event)\" (onAdd)=\"_add($event)\" (onRowSelect)=\"handleRowSelect($event)\"\n (onEdit)=\"_edit($event)\" (onView)=\"_view($event)\" (onDelete)=\"_delete($event)\"\n (onDeleteMultiple)=\"_deleteMultiple($event)\" (onReloaded)=\"_unmarkLoading()\">\n <ng-template #customTitle>\n <h1 [innerHTML]=\"dom.bypassSecurityTrustHtml(control.titleUnPicked)\"></h1>\n <div class=\"header-search-box\" *ngIf=\"control.templateFilterHeader && !control.filterHeaderAsLeftPanel\">\n <ng-container *ngTemplateOutlet=\"control.templateFilterHeader; context: filterHeaderContext\">\n </ng-container>\n </div>\n </ng-template>\n\n <ng-template #toolbar let-crudList=\"crudList\" let-selectedItems=\"selectedItems\">\n <button\n *ngIf=\"(isSingleSelection || model.total <= 0) && !model.dataSource.length && setting.hiddenAdvanceSearch\"\n pButton style=\"visibility: hidden\"></button>\n <button *ngIf=\"!isSingleSelection && model.total > 0\" type=\"button\" pButton pRipple\n label=\"L\u1EA5y t\u1EA5t c\u1EA3 ({{model.total}})\" icon=\"pi pi-angle-double-right\" class=\"p-button-text p-button-success\"\n [disabled]=\"model.loading\" (click)=\"pickAll()\"></button>\n <button *ngIf=\"!isSingleSelection && selectedItems.length > 0\" type=\"button\" pButton pRipple\n label=\"L\u1EA5y m\u1EE5c \u0111\u00E3 ch\u1ECDn ({{selectedItems.length}})\" icon=\"pi pi-angle-right\"\n class=\"p-button-text p-button-success\" [disabled]=\"model.loading\"\n (click)=\"pickSelected(selectedItems)\"></button>\n <button *ngIf=\"datasourceFieldFilter.length\" type=\"button\" pButton pRipple label=\"T\u00ECm ki\u1EBFm nhi\u1EC1u ng\u01B0\u1EDDi d\u00F9ng\"\n icon=\"pi pi-search\" class=\"p-button-text p-button-primary\" [disabled]=\"model.loading\"\n (click)=\"handleAdvansearch()\"></button>\n <button *ngIf=\"datasourceFieldFilter.length && searchData\" type=\"button\" pButton pRipple\n label=\"X\u00F3a danh s\u00E1ch t\u00ECm ki\u1EBFm\" pTooltip=\"X\u00F3a t\u1EA5t c\u1EA3 ng\u01B0\u1EDDi d\u00F9ng \u1EDF Danh s\u00E1ch t\u00ECm ki\u1EBFm\" icon=\"pi pi-times\"\n class=\"p-button-text p-button-primary\" [disabled]=\"model.loading\" (click)=\"handleSearch(null)\"></button>\n </ng-template>\n <ng-template let-crudList=\"crudList\" #function let-rowData=\"rowData\">\n <button pButton type=\"button\" class=\"link-or-action p-button-success p-button-text p-button-rounded\"\n icon=\"pi pi-check\" pTooltip=\"Ch\u1ECDn m\u1EE5c n\u00E0y\" tooltipPosition=\"top\" [disabled]=\"rowData.disabled\"\n (click)=\"pickEntity(rowData)\"></button>\n </ng-template>\n</crud-list>\n</div>\n\n\n<tn-dialog *ngIf=\"showFormAdvancedSearch\" #dialog [styleClass]=\"'address-form'\" [header]=\"'T\u00ECm ki\u1EBFm nhi\u1EC1u ng\u01B0\u1EDDi d\u00F9ng'\"\n [popupSize]=\"popupSizeSearchForm\" [maskClass]=\"setting.maskClass\" (onHide)=\"showFormAdvancedSearch = false\">\n <entity-picker-search-form #formBase [parentModel]=\"model\" [parentContext]=\"context\" [parentSetting]=\"setting\"\n [datasourceFieldFilter]=\"datasourceFieldFilter\" [lstDataNotExist]=\"lstDataNotExist\" [model]=\"formModel\"\n (onSearch)=\"handleSearch($event)\" (onCancel)=\"showFormAdvancedSearch = false;\">\n </entity-picker-search-form>\n</tn-dialog>",
|
|
49190
49339
|
providers: [ComponentContextService],
|
|
49191
|
-
styles: ["::ng-deep app-entity-picker-data .custom-card{padding:.5em!important}::ng-deep app-entity-picker-data .header-search-box{padding:1rem 0}::ng-deep app-entity-picker-data .header-search-box p-dropdown .p-dropdown{min-width:300px}"]
|
|
49340
|
+
styles: ["::ng-deep app-entity-picker-data .custom-card{padding:.5em!important}::ng-deep app-entity-picker-data .header-search-box{padding:1rem 0}::ng-deep app-entity-picker-data .header-search-box p-dropdown .p-dropdown{min-width:300px}::ng-deep app-entity-picker-data .entity-picker-data-body{display:contents}::ng-deep app-entity-picker-data .entity-picker-data-body.has-left-filter{display:flex;align-items:stretch;gap:12px;height:72vh}::ng-deep app-entity-picker-data .entity-picker-data-body.has-left-filter .left-filter-panel{flex:0 0 320px;max-width:320px;border-right:1px solid #e5e7eb;padding-right:8px;overflow:hidden}::ng-deep app-entity-picker-data .entity-picker-data-body.has-left-filter .entity-picker-data-list{flex:1 1 auto;min-width:0;height:100%}"]
|
|
49192
49341
|
},] }
|
|
49193
49342
|
];
|
|
49194
49343
|
EntityPickerDataComponent.ctorParameters = function () { return [
|
|
@@ -56795,7 +56944,7 @@
|
|
|
56795
56944
|
TnDialogComponent.decorators = [
|
|
56796
56945
|
{ type: i0.Component, args: [{
|
|
56797
56946
|
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>",
|
|
56947
|
+
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
56948
|
styles: [""]
|
|
56800
56949
|
},] }
|
|
56801
56950
|
];
|