diff options
Diffstat (limited to 'usecaseui-portal/src/app/views/intent-management/intent-report-detail/intent-report-detail.component.ts')
-rw-r--r-- | usecaseui-portal/src/app/views/intent-management/intent-report-detail/intent-report-detail.component.ts | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/usecaseui-portal/src/app/views/intent-management/intent-report-detail/intent-report-detail.component.ts b/usecaseui-portal/src/app/views/intent-management/intent-report-detail/intent-report-detail.component.ts index aa65d9fe..01a246a9 100644 --- a/usecaseui-portal/src/app/views/intent-management/intent-report-detail/intent-report-detail.component.ts +++ b/usecaseui-portal/src/app/views/intent-management/intent-report-detail/intent-report-detail.component.ts @@ -1,4 +1,7 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; +import { HttpClient, HttpHeaders,HttpParams } from '@angular/common/http'; +import { DatePipe} from '@angular/common'; +import Swal from 'sweetalert2'; @Component({ selector: 'app-intent-report-detail', @@ -7,7 +10,7 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; }) export class IntentReportDetailComponent implements OnInit { - constructor() { } + constructor(private http: HttpClient,private datePipe:DatePipe) { } @Input() showModel: boolean; @Input() reportData; @@ -22,4 +25,37 @@ export class IntentReportDetailComponent implements OnInit { this.showModel = false; this.modalOpreation.emit({ "cancel": false }); } + startDateTime: Date = new Date(); + endDateTime: Date = new Date(); + settings = { + bigBanner: true, + format: 'yyyy-MM-dd HH:mm', + defaultOpen: false, + timePicker: true, + closeOnSelect: true + } + params: Object={ + intentId:'', + startDate:'', + endData: '' + }; + exportData() { + this.params['startDate'] = this.datePipe.transform(this.startDateTime,'yyyy-MM-dd HH:mm'); + this.params['endData'] = this.datePipe.transform(this.endDateTime,'yyyy-MM-dd HH:mm'); + this.params['intentId']=this.intentInfo['intentId'] + this.http + .post('/api/usecaseui-intent-analysis/v1/intentReport/export', this.params,{responseType:'blob'}) + .subscribe((data) => { + const link = document.createElement('a'); + link.href = window.URL.createObjectURL(data); + link.setAttribute('download', 'Report.csv'); + link.click(); + }, (error) => { + console.error('export failed:', error); + Swal.fire({ + icon: 'error', + title: 'export failed', + }); + }); + } } |