###1使用的primeNG自带的导出 详情https://www.primefaces.org/primeng/table/export
###2 自定义方法
表头 exportTransportList = [ 'Region', 'Account', 'VIN', 'Status', 'Auction', 'Vehicle Year', 'Vehicle Make', 'Vehicle Model', 'Repo Date', ]
方法 private exportTransportCSVData() { let options = { fieldSeparator: ',', quoteStrings: '"', decimalseparator: '.', showLabels: true, useBom: true, noDownload: false, headers: this.exportTransportList }; this.http.getTransportAll(this.region, this.orderBy, this.asc).subscribe(data => { this.TransportListAllData = []; data.items.forEach(e => { this.TransportListAllData.push({ region: e.region, accountNumber: e.accountNumber, referenceNumber: e.referenceNumber, auctionStatus: e.auctionStatus, auctionName: e.auctionName, year: e.year, make: e.make, model: e.model, repoDate: this.dateFormat(e.repoDate) }) }) this.transportFileNameMethod(); new ngxCsv(this.TransportListAllData, this.transportFileName, options); }) }
transportFileNameMethod() {
this.region == undefined ? this.transportFileName = "TransportQueue_" + this.rpcorvox + "_" + new Date().toLocaleDateString() : this.transportFileName = "TransportRegion_" + this.rpcorvox + "_" + this.region + "_" + new Date().toLocaleDateString()
}