@adins/ucsearch 2.9.18 → 2.9.19

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.
@@ -622,6 +622,7 @@ class UCSearchComponent {
622
622
  let IsQueryIn = false;
623
623
  let IsBreak = false;
624
624
  let bodyList = new Array();
625
+ let headerList = new Array();
625
626
  let fileName;
626
627
  let bodyData = new Array();
627
628
  let dataFile = new Array();
@@ -790,11 +791,12 @@ class UCSearchComponent {
790
791
  yield this.getJSON(this.searchInput._url).subscribe(data => {
791
792
  bodyList = data.bodyList;
792
793
  fileName = data.title;
794
+ headerList = data.headerList;
793
795
  });
794
796
  this.http.post(apiUrl, request).subscribe((response) => {
795
797
  if (IsExportExcel) {
796
798
  bodyData = response["Data"];
797
- dataFile = this.mapDataFile(bodyList, bodyData);
799
+ dataFile = this.mapDataFile(bodyList, bodyData, headerList);
798
800
  this.excelService.exportAsExcelFile(dataFile, fileName);
799
801
  return;
800
802
  }
@@ -829,19 +831,22 @@ class UCSearchComponent {
829
831
  }
830
832
  return true;
831
833
  }
832
- mapDataFile(bodyListData, bodyDataArr) {
834
+ mapDataFile(bodyListData, bodyDataArr, headerListData) {
833
835
  let dataExcel = new Array();
834
836
  let bodyDataTemp = new Array();
837
+ let headerDataTemp = new Array();
835
838
  for (let i = 0; i < bodyListData.length; i++) {
836
839
  if (bodyListData[i]['type'] != 'action') {
837
840
  bodyDataTemp.push(bodyListData[i]['property']);
841
+ headerDataTemp.push(headerListData[i]['label']);
838
842
  }
839
843
  }
840
844
  for (let i = 0; i < bodyDataArr.length; i++) {
841
845
  let finalData = {};
842
846
  for (const [key, value] of Object.entries(bodyDataArr[i])) {
843
- if (bodyDataTemp.indexOf(key) != -1) {
844
- finalData[key] = value;
847
+ const _idx = bodyDataTemp.indexOf(key);
848
+ if (_idx != -1) {
849
+ finalData[headerDataTemp[_idx]] = value;
845
850
  }
846
851
  }
847
852
  dataExcel.push(finalData);