@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.
@@ -614,6 +614,7 @@ class UCSearchComponent {
614
614
  let IsQueryIn = false;
615
615
  let IsBreak = false;
616
616
  let bodyList = new Array();
617
+ let headerList = new Array();
617
618
  let fileName;
618
619
  let bodyData = new Array();
619
620
  let dataFile = new Array();
@@ -782,11 +783,12 @@ class UCSearchComponent {
782
783
  await this.getJSON(this.searchInput._url).subscribe(data => {
783
784
  bodyList = data.bodyList;
784
785
  fileName = data.title;
786
+ headerList = data.headerList;
785
787
  });
786
788
  this.http.post(apiUrl, request).subscribe((response) => {
787
789
  if (IsExportExcel) {
788
790
  bodyData = response["Data"];
789
- dataFile = this.mapDataFile(bodyList, bodyData);
791
+ dataFile = this.mapDataFile(bodyList, bodyData, headerList);
790
792
  this.excelService.exportAsExcelFile(dataFile, fileName);
791
793
  return;
792
794
  }
@@ -820,19 +822,22 @@ class UCSearchComponent {
820
822
  }
821
823
  return true;
822
824
  }
823
- mapDataFile(bodyListData, bodyDataArr) {
825
+ mapDataFile(bodyListData, bodyDataArr, headerListData) {
824
826
  let dataExcel = new Array();
825
827
  let bodyDataTemp = new Array();
828
+ let headerDataTemp = new Array();
826
829
  for (let i = 0; i < bodyListData.length; i++) {
827
830
  if (bodyListData[i]['type'] != 'action') {
828
831
  bodyDataTemp.push(bodyListData[i]['property']);
832
+ headerDataTemp.push(headerListData[i]['label']);
829
833
  }
830
834
  }
831
835
  for (let i = 0; i < bodyDataArr.length; i++) {
832
836
  let finalData = {};
833
837
  for (const [key, value] of Object.entries(bodyDataArr[i])) {
834
- if (bodyDataTemp.indexOf(key) != -1) {
835
- finalData[key] = value;
838
+ const _idx = bodyDataTemp.indexOf(key);
839
+ if (_idx != -1) {
840
+ finalData[headerDataTemp[_idx]] = value;
836
841
  }
837
842
  }
838
843
  dataExcel.push(finalData);