tnx-shared 5.3.289 → 5.3.290

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.
@@ -23765,25 +23765,23 @@ class ListBase extends ComponentBaseWithButton {
23765
23765
  var _a;
23766
23766
  return __awaiter(this, void 0, void 0, function* () {
23767
23767
  const lstData = (_a = (yield this.setting.baseService.getDataCustomRoute(this.plusUrl, this.currentGridInfo.filters, this.currentGridInfo.fields, this.currentGridInfo.sorts, -1, 1)).data) !== null && _a !== void 0 ? _a : [];
23768
- yield this.beforeExportAllData(lstData);
23768
+ const lstVisibleField = this.setting.cols
23769
+ .filter(item => item.visible && item.dataType !== 'trangThaiV5')
23770
+ .map(item => item.field);
23771
+ yield this.beforeExportAllData(lstData, lstVisibleField);
23769
23772
  yield this._crudService.getRefDataInDatasource(lstData, this.setting.fieldNeedGetRef);
23770
- const lstVisibleField = this.setting.cols.filter(item => item.visible && item.dataType != 'trangThaiV5').map(item => {
23771
- if (item.controlType == 'dropdown' && item.field.startsWith('str')) {
23772
- return item.field.slice(3);
23773
- }
23774
- return item.field;
23775
- });
23776
23773
  const lstHeader = ['TT'];
23777
- lstVisibleField.forEach(item => {
23778
- const schema = this.setting.modelSchemas.find(x => x.field == item);
23779
- lstHeader.push((schema === null || schema === void 0 ? void 0 : schema.name) || "");
23774
+ const fieldSchemaMap = new Map(this.setting.modelSchemas.map(schema => [schema.field, schema.name]));
23775
+ lstVisibleField.forEach(field => {
23776
+ const schemaName = fieldSchemaMap.get(field) || fieldSchemaMap.get(field.slice(3)) || "";
23777
+ lstHeader.push(schemaName);
23780
23778
  });
23781
23779
  const printData = [
23782
23780
  lstHeader,
23783
23781
  ...lstData.map((item, index) => {
23784
23782
  const row = [index + 1];
23785
- this.setting.cols.filter(col => col.visible && col.dataType != 'trangThaiV5').forEach(col => {
23786
- row.push(item[col.field]);
23783
+ lstVisibleField.forEach(field => {
23784
+ row.push(item[field]);
23787
23785
  });
23788
23786
  return row;
23789
23787
  })
@@ -23791,7 +23789,7 @@ class ListBase extends ComponentBaseWithButton {
23791
23789
  this._exportService.objectToExcel(printData, 'Danh sách ' + this.setting.objectName, 1);
23792
23790
  });
23793
23791
  }
23794
- beforeExportAllData(dataSource) {
23792
+ beforeExportAllData(dataSource, lstVisibleField) {
23795
23793
  return __awaiter(this, void 0, void 0, function* () {
23796
23794
  });
23797
23795
  }