1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
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',
templateUrl: './intent-report-detail.component.html',
styleUrls: ['../intent-management.component.less']
})
export class IntentReportDetailComponent implements OnInit {
constructor(private http: HttpClient,private datePipe:DatePipe) { }
@Input() showModel: boolean;
@Input() reportData;
@Input() intentInfo;
@Output() modalOpreation = new EventEmitter();
ngOnInit() {
}
ngOnChanges(){
}
handleCancel(): void {
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',
});
});
}
}
|