tnx-shared 5.1.74 → 5.1.78

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.
Files changed (28) hide show
  1. package/bundles/tnx-shared.umd.js +139 -60
  2. package/bundles/tnx-shared.umd.js.map +1 -1
  3. package/bundles/tnx-shared.umd.min.js +1 -1
  4. package/bundles/tnx-shared.umd.min.js.map +1 -1
  5. package/classes/base/data-form-base.d.ts.map +1 -1
  6. package/classes/base/data-list-base.d.ts.map +1 -1
  7. package/classes/workflow-schema.d.ts +1 -0
  8. package/classes/workflow-schema.d.ts.map +1 -1
  9. package/components/crud/crud-list/crud-list.component.d.ts.map +1 -1
  10. package/components/share-link-by-permission/models/share-link-by-permission.d.ts +3 -0
  11. package/components/share-link-by-permission/models/share-link-by-permission.d.ts.map +1 -1
  12. package/components/share-link-by-permission/share-link-by-permission.component.d.ts.map +1 -1
  13. package/components/workflow/models/const.d.ts +1 -0
  14. package/components/workflow/models/const.d.ts.map +1 -1
  15. package/components/workflow/workflow-setting-new/workflow-setting-new.component.d.ts.map +1 -1
  16. package/esm2015/classes/base/data-form-base.js +23 -13
  17. package/esm2015/classes/base/data-list-base.js +10 -2
  18. package/esm2015/classes/workflow-schema.js +1 -1
  19. package/esm2015/components/crud/crud-list/crud-list.component.js +25 -5
  20. package/esm2015/components/share-link-by-permission/models/share-link-by-permission.js +1 -1
  21. package/esm2015/components/share-link-by-permission/share-link-by-permission.component.js +31 -1
  22. package/esm2015/components/workflow/models/const.js +2 -1
  23. package/esm2015/components/workflow/workflow-setting-new/workflow-setting-new.component.js +17 -3
  24. package/esm2015/congviec/congviec/congviec-dinhkem/congviec-dinhkem.component.js +3 -3
  25. package/fesm2015/tnx-shared.js +106 -25
  26. package/fesm2015/tnx-shared.js.map +1 -1
  27. package/package.json +2 -2
  28. package/tnx-shared.metadata.json +1 -1
@@ -11137,6 +11137,12 @@
11137
11137
  return SearchInfo;
11138
11138
  }());
11139
11139
 
11140
+ var DummyWorkflowCode = 'DummyWorkflowCode';
11141
+ var MaActionBatDauQuyTrinh = '_START_';
11142
+ var ActionThuHoiBase = '__THU_HOI';
11143
+ var ActionChoYKienBase = '__CHO_Y_KIEN';
11144
+ var ActionUpdateModel = '__UPDATE_MODEL';
11145
+
11140
11146
  var CanBo_HoSoService = /** @class */ (function (_super) {
11141
11147
  __extends(CanBo_HoSoService, _super);
11142
11148
  function CanBo_HoSoService(http, injector, _moduleConfigService) {
@@ -16766,10 +16772,14 @@
16766
16772
  displayField: 'title',
16767
16773
  mdWidth: 12,
16768
16774
  hiddenCheck: function (rootModel) { return !rootModel || rootModel.createTaskInstead; }
16769
- }), new TitleSchema({
16770
- text: 'Công việc',
16771
- hiddenCheck: function (rootModel) { return !rootModel || !rootModel.createTaskInstead; }
16772
- }), this.dynamicControl[FieldDefineIsTaskFormControl]);
16775
+ }));
16776
+ if (this.parentSetting.workflowSettingNew
16777
+ && this.parentSetting.workflowSettingNew.taskInsideBusinessForm) {
16778
+ this.setting.schema.push(new TitleSchema({
16779
+ text: 'Công việc',
16780
+ hiddenCheck: function (rootModel) { return !rootModel || !rootModel.createTaskInstead; }
16781
+ }), this.dynamicControl[FieldDefineIsTaskFormControl]);
16782
+ }
16773
16783
  }
16774
16784
  }
16775
16785
  };
@@ -17192,7 +17202,7 @@
17192
17202
  };
17193
17203
  DataFormBase.prototype.validateFormBase = function () {
17194
17204
  return __awaiter(this, void 0, void 0, function () {
17195
- var resultValidateBase, resultValidate, taskForm, resultValidateFormTask;
17205
+ var resultValidateBase, resultValidate;
17196
17206
  return __generator(this, function (_a) {
17197
17207
  switch (_a.label) {
17198
17208
  case 0: return [4 /*yield*/, this.crudForm.validateForm()];
@@ -17201,15 +17211,15 @@
17201
17211
  return [4 /*yield*/, this.validateForm(resultValidateBase)];
17202
17212
  case 2:
17203
17213
  resultValidate = _a.sent();
17204
- if (!(this.dynamicControl[FieldDefineIsTaskFormControl]
17205
- && this.dynamicControl[FieldDefineIsTaskFormControl]._component)) return [3 /*break*/, 4];
17206
- taskForm = this.dynamicControl[FieldDefineIsTaskFormControl]._component;
17207
- return [4 /*yield*/, taskForm._getResultValidate()];
17208
- case 3:
17209
- resultValidateFormTask = _a.sent();
17210
- resultValidate = resultValidateFormTask && resultValidate;
17211
- _a.label = 4;
17212
- case 4: return [2 /*return*/, resultValidate && resultValidateBase];
17214
+ // Bỏ check valid form công việc. nếu như form công việc không valid thì không tự động tạo công việc
17215
+ // if (this.dynamicControl[FieldDefineIsTaskFormControl]
17216
+ // && this.dynamicControl[FieldDefineIsTaskFormControl]._component
17217
+ // ) {
17218
+ // const taskForm = this.dynamicControl[FieldDefineIsTaskFormControl]._component;
17219
+ // const resultValidateFormTask = await taskForm._getResultValidate();
17220
+ // resultValidate = resultValidateFormTask && resultValidate;
17221
+ // }
17222
+ return [2 /*return*/, resultValidate && resultValidateBase];
17213
17223
  }
17214
17224
  });
17215
17225
  });
@@ -17236,24 +17246,30 @@
17236
17246
  };
17237
17247
  DataFormBase.prototype.onInsert = function () {
17238
17248
  return __awaiter(this, void 0, void 0, function () {
17239
- var confirmed;
17249
+ var taskForm, resultValidateFormTask, confirmed;
17240
17250
  return __generator(this, function (_a) {
17241
17251
  switch (_a.label) {
17242
17252
  case 0:
17243
17253
  this.setDefaultValue(this.model.data);
17244
- if (this.dynamicControl[FieldDefineIsTaskFormControl]
17245
- && this.dynamicControl[FieldDefineIsTaskFormControl]._component) {
17246
- this.model.data.itemCongViec = this.dynamicControl[FieldDefineIsTaskFormControl]._component.model.data;
17247
- // reset field _WorkflowCode để backend biết được chạy quy trình theo kiểu nào
17248
- this.model.data._WorkflowCode = null;
17249
- }
17250
- return [4 /*yield*/, this.createConfirmIfRequire()];
17254
+ if (!(this.dynamicControl[FieldDefineIsTaskFormControl]
17255
+ && this.dynamicControl[FieldDefineIsTaskFormControl]._component)) return [3 /*break*/, 2];
17256
+ taskForm = this.dynamicControl[FieldDefineIsTaskFormControl]._component;
17257
+ return [4 /*yield*/, taskForm._getResultValidate()];
17251
17258
  case 1:
17259
+ resultValidateFormTask = _a.sent();
17260
+ if (resultValidateFormTask) {
17261
+ this.model.data.itemCongViec = taskForm.model.data;
17262
+ }
17263
+ // reset field _WorkflowCode để backend biết được chạy quy trình theo kiểu nào
17264
+ this.model.data._WorkflowCode = null;
17265
+ _a.label = 2;
17266
+ case 2: return [4 /*yield*/, this.createConfirmIfRequire()];
17267
+ case 3:
17252
17268
  confirmed = _a.sent();
17253
17269
  if (!confirmed)
17254
17270
  return [2 /*return*/];
17255
17271
  return [4 /*yield*/, this._insert()];
17256
- case 2:
17272
+ case 4:
17257
17273
  _a.sent();
17258
17274
  return [2 /*return*/];
17259
17275
  }
@@ -19643,7 +19659,7 @@
19643
19659
  };
19644
19660
  CrudListComponent.prototype.showFormStartWorkflow = function (rowData) {
19645
19661
  return __awaiter(this, void 0, void 0, function () {
19646
- var workflowSetting;
19662
+ var workflowSetting, resultCheckExist;
19647
19663
  return __generator(this, function (_b) {
19648
19664
  switch (_b.label) {
19649
19665
  case 0: return [4 /*yield*/, this.getItemWorkflowSetting(rowData)];
@@ -19651,31 +19667,44 @@
19651
19667
  workflowSetting = _b.sent();
19652
19668
  if (!workflowSetting)
19653
19669
  return [2 /*return*/];
19654
- // Nếu create task thay vì chạy quy trình với đối tượng chính thì mở form thêm công việc
19655
- if (workflowSetting.createTaskInstead) {
19656
- this.congViecModel.data.congViecSetting.isWorkflowTree = true;
19657
- this.congViecModel.data.model = {
19658
- formState: exports.FormState.ADD,
19659
- data: {
19660
- idLoaiCongViec: workflowSetting.idLoaiCongViecDefault,
19661
- serviceCode: this.setting.baseService.serviceCode,
19662
- entity: this.setting.baseService.entityName,
19663
- entityKey: rowData.id,
19664
- ten: this.getTenCongViec(workflowSetting.templateTaskName, rowData)
19665
- }
19666
- };
19667
- this.congViecModel.showEditForm = true;
19670
+ if (!workflowSetting.createTaskInstead) return [3 /*break*/, 3];
19671
+ return [4 /*yield*/, this._congViecService.checkExistByFilter([
19672
+ this.newFilter('serviceCode', exports.Operator.equal, this.setting.baseService.serviceCode),
19673
+ this.newFilter('entity', exports.Operator.equal, this.setting.baseService.entityName),
19674
+ this.newFilter('entityKey', exports.Operator.equal, rowData.id)
19675
+ ])];
19676
+ case 2:
19677
+ resultCheckExist = (_b.sent());
19678
+ if (!resultCheckExist.success) {
19679
+ return [2 /*return*/, this._notifierService.showWarning('Có lỗi xảy ra khi kiểm tra trạng thái đã tạo công việc hay chưa')];
19668
19680
  }
19669
- else {
19670
- if (workflowSetting.workflows.length == 1) {
19671
- return [2 /*return*/, this.startWorkflow(rowData, workflowSetting.workflows[0])];
19681
+ if (resultCheckExist.data) {
19682
+ return [2 /*return*/, this._notifierService.showWarning('Bản ghi đã được tạo công việc')];
19683
+ }
19684
+ this.congViecModel.data.congViecSetting.isWorkflowTree = true;
19685
+ this.congViecModel.data.model = {
19686
+ formState: exports.FormState.ADD,
19687
+ data: {
19688
+ checkUniqueTaskForEntity: true,
19689
+ idLoaiCongViec: workflowSetting.idLoaiCongViecDefault,
19690
+ serviceCode: this.setting.baseService.serviceCode,
19691
+ entity: this.setting.baseService.entityName,
19692
+ entityKey: rowData.id,
19693
+ ten: this.getTenCongViec(workflowSetting.templateTaskName, rowData)
19672
19694
  }
19673
- this.startWorkflowModel.data.workflows = workflowSetting.workflows;
19674
- this.startWorkflowModel.data.defaultWorkflow = workflowSetting.workflowCode;
19675
- this.startWorkflowModel.data.item = rowData;
19676
- this.startWorkflowModel.showEditForm = true;
19695
+ };
19696
+ this.congViecModel.showEditForm = true;
19697
+ return [3 /*break*/, 4];
19698
+ case 3:
19699
+ if (workflowSetting.workflows.length == 1) {
19700
+ return [2 /*return*/, this.startWorkflow(rowData, workflowSetting.workflows[0])];
19677
19701
  }
19678
- return [2 /*return*/];
19702
+ this.startWorkflowModel.data.workflows = workflowSetting.workflows;
19703
+ this.startWorkflowModel.data.defaultWorkflow = workflowSetting.workflowCode;
19704
+ this.startWorkflowModel.data.item = rowData;
19705
+ this.startWorkflowModel.showEditForm = true;
19706
+ _b.label = 4;
19707
+ case 4: return [2 /*return*/];
19679
19708
  }
19680
19709
  });
19681
19710
  });
@@ -19712,13 +19741,15 @@
19712
19741
  label: "Xem chi ti\u1EBFt c\u00F4ng vi\u1EC7c",
19713
19742
  icon: 'pi pi-list',
19714
19743
  command: function () { return _this.viewTaskDetail(rowData); }
19715
- },
19716
- {
19744
+ }
19745
+ ];
19746
+ if (rowData.__workflowCode != DummyWorkflowCode) {
19747
+ this.buttonContexts.unshift({
19717
19748
  label: "Xem l\u1ECBch s\u1EED",
19718
19749
  icon: 'pi pi-calendar',
19719
19750
  command: function () { return _this.viewTaskHistory(rowData); }
19720
- }
19721
- ];
19751
+ });
19752
+ }
19722
19753
  this._showContextMenu(evt);
19723
19754
  _c.label = 3;
19724
19755
  case 3: return [2 /*return*/];
@@ -20289,6 +20320,9 @@
20289
20320
  return __awaiter(this, void 0, void 0, function () {
20290
20321
  var rowData;
20291
20322
  return __generator(this, function (_b) {
20323
+ if (!this.setting.checkReadyToTrinhKy()) {
20324
+ return [2 /*return*/, this._notifierService.showWarning('Đang tải dữ liệu danh sách, chờ một lúc rồi thử lại')];
20325
+ }
20292
20326
  rowData = this.rowDataCurrent;
20293
20327
  this.showShareLinkForm([rowData]);
20294
20328
  return [2 /*return*/];
@@ -22864,8 +22898,9 @@
22864
22898
  textTrangThai: 'Chưa chạy quy trình'
22865
22899
  };
22866
22900
  var itemId = rowItem.id;
22901
+ var itemTask = null;
22867
22902
  if (!_this.setting.isWorkflowTree && _this.setting.workflowSettingNew.createTaskInstead) {
22868
- var itemTask = dataTask_1.find(function (q) { return q.entityKey == rowItem.id; });
22903
+ itemTask = dataTask_1.find(function (q) { return q.entityKey == rowItem.id; });
22869
22904
  if (itemTask) {
22870
22905
  itemId = itemTask.id;
22871
22906
  }
@@ -22880,6 +22915,12 @@
22880
22915
  }
22881
22916
  }
22882
22917
  }
22918
+ // Nếu không có bản ghi trạng thái
22919
+ // 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
22920
+ if (!itemStatus.trangThai && itemTask) {
22921
+ itemStatus.workflowCode = DummyWorkflowCode;
22922
+ itemStatus.textTrangThai = 'Đã tạo công việc';
22923
+ }
22883
22924
  rowItem.__trangThai = itemStatus.trangThai;
22884
22925
  rowItem.__textTrangThai = itemStatus.textTrangThai;
22885
22926
  rowItem.__workflowCode = itemStatus.workflowCode;
@@ -45809,11 +45850,6 @@
45809
45850
  { type: i0.Injector }
45810
45851
  ]; };
45811
45852
 
45812
- var MaActionBatDauQuyTrinh = '_START_';
45813
- var ActionThuHoiBase = '__THU_HOI';
45814
- var ActionChoYKienBase = '__CHO_Y_KIEN';
45815
- var ActionUpdateModel = '__UPDATE_MODEL';
45816
-
45817
45853
  var WorkflowHistoryNewComponent = /** @class */ (function (_super) {
45818
45854
  __extends(WorkflowHistoryNewComponent, _super);
45819
45855
  function WorkflowHistoryNewComponent(_injector, _workflowHistoryService, _coCauToChucService, _userGroupService, _roleService, _fileDataService) {
@@ -46611,7 +46647,11 @@
46611
46647
  field: 'createTaskInstead',
46612
46648
  label: 'Tạo công việc',
46613
46649
  showLabel: false,
46614
- mdWidth: 12
46650
+ mdWidth: 2
46651
+ }),
46652
+ new LabelSchema({
46653
+ mdWidth: 10,
46654
+ hiddenCheck: function (rootModel) { return _this.checkIfCreateTaskInstead(rootModel, true); }
46615
46655
  }),
46616
46656
  new CustomControlSchema({
46617
46657
  field: 'workflowPicker',
@@ -46619,6 +46659,13 @@
46619
46659
  hiddenCheck: function (rootModel) { return _this.checkIfCreateTaskInstead(rootModel, true); },
46620
46660
  mdWidth: 12
46621
46661
  }),
46662
+ new CheckboxControlSchema({
46663
+ field: 'taskInsideBusinessForm',
46664
+ label: 'Hiển thị giao diện tạo công việc trên giao diện thêm mới',
46665
+ showLabel: false,
46666
+ mdWidth: 10,
46667
+ hiddenCheck: function (rootModel) { return _this.checkIfCreateTaskInstead(rootModel, false); }
46668
+ }),
46622
46669
  new TextControlSchema({
46623
46670
  field: 'templateTaskName',
46624
46671
  label: 'Template tên công việc',
@@ -46682,6 +46729,9 @@
46682
46729
  if (this.model.data.createTaskInstead === undefined) {
46683
46730
  this.model.data.createTaskInstead = false;
46684
46731
  }
46732
+ if (this.model.data.taskInsideBusinessForm === undefined) {
46733
+ this.model.data.taskInsideBusinessForm = false;
46734
+ }
46685
46735
  this.readyCrudForm = true;
46686
46736
  };
46687
46737
  WorkflowSettingNewComponent.prototype.handleCancelWorkflow = function (event) {
@@ -47035,8 +47085,8 @@
47035
47085
  this.setting.hiddenPageSetting = true;
47036
47086
  this.setting.hiddenAdvanceSearch = true;
47037
47087
  this.setting.hiddenFilterRow = true;
47038
- this.setting.hiddenCheckbox = this.formState == exports.FormState.VIEW;
47039
- this.setting.hiddenFunctionColumn = this.formState == exports.FormState.VIEW;
47088
+ // this.setting.hiddenCheckbox = this.formState == FormState.VIEW;
47089
+ // this.setting.hiddenFunctionColumn = this.formState == FormState.VIEW;
47040
47090
  this.setting.fixHeightTypeInDialog = false;
47041
47091
  this.setting.heightType = exports.HeightType.dynamic;
47042
47092
  this.setting.showExportSelectedItems = false;
@@ -50621,7 +50671,8 @@
50621
50671
  };
50622
50672
  ShareLinkByPermissionComponent.prototype.createShareLink = function () {
50623
50673
  return __awaiter(this, void 0, void 0, function () {
50624
- var permission, dicState, itemShares, dicPermissionId, content;
50674
+ var permission, dicState, itemShares, firstItem, colShowEditLink, fieldHienThi, value, dicPermissionId, content;
50675
+ var _this = this;
50625
50676
  return __generator(this, function (_a) {
50626
50677
  switch (_a.label) {
50627
50678
  case 0:
@@ -50649,6 +50700,27 @@
50649
50700
  dicState = _a.sent();
50650
50701
  itemShares = new ModelShareLinkByPermission();
50651
50702
  itemShares.linkToMenu = "" + top.location.origin + top.location.pathname;
50703
+ itemShares.sourcePath = "" + encodeURIComponent(top.location.href);
50704
+ itemShares.objectDisplayName = "" + encodeURIComponent(this.setting.objectName);
50705
+ if (typeof this.setting.displayField == 'string') {
50706
+ itemShares.displayField = "" + this.setting.displayField;
50707
+ }
50708
+ else {
50709
+ firstItem = this.lstItem[0];
50710
+ colShowEditLink = this.setting.cols.find(function (q) { return q.showEditLink; });
50711
+ fieldHienThi = null;
50712
+ if (colShowEditLink) {
50713
+ value = firstItem[colShowEditLink.field];
50714
+ // Nếu có value của `str${colShowEditLink.field}` thì là trường reference
50715
+ // => Chỉ lấy trường hợp trường gốc có dữ liệu và trường reference k có dữ liệu
50716
+ if (value && !firstItem["str" + colShowEditLink.field]) {
50717
+ fieldHienThi = colShowEditLink.field;
50718
+ }
50719
+ }
50720
+ if (fieldHienThi) {
50721
+ itemShares.displayField = "" + fieldHienThi;
50722
+ }
50723
+ }
50652
50724
  itemShares.lstItemData = [];
50653
50725
  this.lstItem.forEach(function (item) {
50654
50726
  itemShares.lstItemData.push({
@@ -50656,6 +50728,13 @@
50656
50728
  permission: permission,
50657
50729
  state: encodeURIComponent(JSON.stringify(dicState[item.id]))
50658
50730
  });
50731
+ if (!itemShares.displayField) {
50732
+ var rowItem = _this.lstItem.find(function (q) { return q.id == item.id; });
50733
+ if (typeof _this.setting.displayField != 'string') {
50734
+ var tenDayDu = _this.setting.displayField(rowItem);
50735
+ content += "&displayField=&tenDayDu=" + encodeURIComponent(tenDayDu);
50736
+ }
50737
+ }
50659
50738
  });
50660
50739
  return [4 /*yield*/, this.setting.baseService.getSharedKey(itemShares)];
50661
50740
  case 2: