diff options
author | kaixiliu <liukaixi@chinamobile.com> | 2023-10-09 16:07:48 +0800 |
---|---|---|
committer | kaixiliu <liukaixi@chinamobile.com> | 2023-10-09 16:08:09 +0800 |
commit | 10c164a4bc94aad3a8179f0c4abcb6ce3866522e (patch) | |
tree | babd33b6757fdfbe0270d8df4b55794918e6e029 | |
parent | a2f73d5ef40ef0d72a0651ecbaf1b01546cf0648 (diff) |
uui add report export function
Issue-ID: USECASEUI-819
Change-Id: I34009ad477485a337e934cc49ebc7c44fd976a4d
Signed-off-by: kaixiliu <liukaixi@chinamobile.com>
8 files changed, 91 insertions, 5 deletions
diff --git a/usecaseui-portal/package-lock.json b/usecaseui-portal/package-lock.json index 384fc12d..15f4d218 100644 --- a/usecaseui-portal/package-lock.json +++ b/usecaseui-portal/package-lock.json @@ -511,6 +511,14 @@ } } }, + "angular2-datetimepicker": { + "version": "1.1.1", + "resolved": "https://registry.npm.taobao.org/angular2-datetimepicker/-/angular2-datetimepicker-1.1.1.tgz", + "integrity": "sha512-AqukMP8EVziBcyaBe47/aGudw8DGlI6dI6oA2hC5qpiElcYt+H97CuYXRhDRAn0OKw0IX70x8DOkNC5Anu8Ugg==", + "requires": { + "font-awesome": "*" + } + }, "ansi-align": { "version": "3.0.0", "resolved": "https://registry.npm.taobao.org/ansi-align/download/ansi-align-3.0.0.tgz", @@ -12036,6 +12044,21 @@ "has-flag": "2.0.0" } }, + "sweetalert2": { + "version": "4.3.3", + "resolved": "https://registry.npm.taobao.org/sweetalert2/-/sweetalert2-4.3.3.tgz", + "integrity": "sha512-C/gckR4tLR4lmGHTYRVxCiXwn/7DNxPCD24UqYNLQyJaWI1s9/MPfBm5/XuTIYZ1idw5WoHQaJMP859WYEhyiw==", + "requires": { + "es6-promise": "^4.2.8" + }, + "dependencies": { + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmmirror.com/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + } + } + }, "symbol-observable": { "version": "1.0.1", "resolved": "https://registry.npm.taobao.org/symbol-observable/download/symbol-observable-1.0.1.tgz?cache=0&sync_timestamp=1604338077306&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsymbol-observable%2Fdownload%2Fsymbol-observable-1.0.1.tgz", diff --git a/usecaseui-portal/package.json b/usecaseui-portal/package.json index 4149df61..c7e2089d 100644 --- a/usecaseui-portal/package.json +++ b/usecaseui-portal/package.json @@ -43,7 +43,9 @@ "ngx-echarts": "^2.2.0", "rxjs": "^5.5.12", "vis": "^4.21.0", - "zone.js": "^0.8.19" + "zone.js": "^0.8.19", + "angular2-datetimepicker": "^1.1.1", + "sweetalert2": "^4.3.3" }, "devDependencies": { "@angular/cli": "~1.7.4", diff --git a/usecaseui-portal/src/app/app.module.ts b/usecaseui-portal/src/app/app.module.ts index 2b9506b3..965ffa10 100644 --- a/usecaseui-portal/src/app/app.module.ts +++ b/usecaseui-portal/src/app/app.module.ts @@ -115,6 +115,7 @@ import { InputIntentExpectationComponent } from './views/intent-management/input import { InputIntentStateComponent } from './views/intent-management/input-intent-state/input-intent-state.component'; import { InputIntentConditionComponent } from './views/intent-management/input-intent-condition/input-intent-condition.component'; import { IntentReportDetailComponent } from './views/intent-management/intent-report-detail/intent-report-detail.component'; +import { AngularDateTimePickerModule } from 'angular2-datetimepicker'; export function HttpLoaderFactory(httpClient: HttpClient) { return new TranslateHttpLoader(httpClient, "./assets/i18n/", ".json"); @@ -238,6 +239,7 @@ registerLocaleData(en); NgZorroAntdModule.forRoot(), NgxEchartsModule, AppRoutingModule, + AngularDateTimePickerModule ], bootstrap: [AppComponent], entryComponents: [ 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', + }); + }); + } } diff --git a/usecaseui-portal/src/assets/i18n/cn.json b/usecaseui-portal/src/assets/i18n/cn.json index 09d7d716..bce7dc0e 100644 --- a/usecaseui-portal/src/assets/i18n/cn.json +++ b/usecaseui-portal/src/assets/i18n/cn.json @@ -184,6 +184,8 @@ "i18nTextDefine_ResourceVersion": "资源版本", "i18nTextDefine_NearEnd": "近端", "i18nTextDefine_FarEnd": "远端", - "i18nTextDefine_ExternalNetworkMessage":"注意:两个端点都将更改为ENNI。" - + "i18nTextDefine_ExternalNetworkMessage":"注意:两个端点都将更改为ENNI。", + "i18nTextDefine_exportData": "导出", + "i18nTextDefine_startTime": "起始时间", + "i18nTextDefine_endTime": "终止时间" } diff --git a/usecaseui-portal/src/assets/i18n/en.json b/usecaseui-portal/src/assets/i18n/en.json index ba2f37ff..cc533c1c 100644 --- a/usecaseui-portal/src/assets/i18n/en.json +++ b/usecaseui-portal/src/assets/i18n/en.json @@ -183,5 +183,8 @@ "i18nTextDefine_CreateTime": "Upload Time", "i18nTextDefine_Activated": "Activated", "i18nTextDefine_Operation": "Opreation", - "i18nTextDefine_Size":"Size" + "i18nTextDefine_Size":"Size", + "i18nTextDefine_exportData": "Export Data", + "i18nTextDefine_startTime": "Start Time", + "i18nTextDefine_endTime": "End Time" } |