diff options
Diffstat (limited to 'usecaseui-portal/src/app/views')
3 files changed, 55 insertions, 1 deletions
diff --git a/usecaseui-portal/src/app/views/intent-management/intent-management.component.less b/usecaseui-portal/src/app/views/intent-management/intent-management.component.less index 43f61660..8e882a27 100644 --- a/usecaseui-portal/src/app/views/intent-management/intent-management.component.less +++ b/usecaseui-portal/src/app/views/intent-management/intent-management.component.less @@ -115,4 +115,13 @@ } .condition-operator-div{ margin-left: 50px; +} +.container{ + display: flex; + align-items: center; + width: 700px; +} +.container angular2-date-picker{ + margin-right: 10px; + margin-left: 10px; }
\ No newline at end of file diff --git a/usecaseui-portal/src/app/views/intent-management/intent-report-detail/intent-report-detail.component.html b/usecaseui-portal/src/app/views/intent-management/intent-report-detail/intent-report-detail.component.html index 0f263c76..ae516255 100644 --- a/usecaseui-portal/src/app/views/intent-management/intent-report-detail/intent-report-detail.component.html +++ b/usecaseui-portal/src/app/views/intent-management/intent-report-detail/intent-report-detail.component.html @@ -5,6 +5,15 @@ <span class="title" style="margin-right: 30px;">Intent Name: {{intentInfo['intentName']}}</span> <span class="title">ID: {{intentInfo['intentId']}}</span> </p> + <div class = "container"> + <span>{{"i18nTextDefine_startTime" | translate}} :</span> + <angular2-date-picker [(ngModel)]="startDateTime" [settings]="settings"> </angular2-date-picker> + + <span>{{"i18nTextDefine_endTime" | translate}} :</span> + <angular2-date-picker [(ngModel)]="endDateTime" [settings]="settings"> </angular2-date-picker> + <button (click)="exportData()"> {{"i18nTextDefine_exportData" | translate}} </button> + </div> + <br> <div class="intent-table"> <p>ReportTime: {{intentInfo['reportTime']}}</p> <nz-table 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', + }); + }); + } } |