diff options
author | zhen1234 <liz779@chinatelecom.cn> | 2024-06-13 11:45:49 +0800 |
---|---|---|
committer | zhen1234 <liz779@chinatelecom.cn> | 2024-06-13 11:45:59 +0800 |
commit | 83810e924f6eb18bb7a0771da25c7649026bd255 (patch) | |
tree | d3340a1b865a4499553cf01084e5d7dcc2723647 /usecaseui-portal | |
parent | 57db84f8ee501e78df8805e3f8c607a6f2007e12 (diff) |
addexport14.0.0
Issue-ID: USECASEUI-837
Signed-off-by: zhen1234 <liz779@chinatelecom.cn>
Change-Id: Ib550bd47b32cddd08d99859aabfae2c8ec5f6264
Diffstat (limited to 'usecaseui-portal')
3 files changed, 59 insertions, 20 deletions
diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.html b/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.html index ee71be03..4509730a 100644 --- a/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.html +++ b/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.html @@ -1,4 +1,14 @@ <div class="intent-resource_tab"> + <div nz-row class="header-row"> + <button + nz-button + nzType="primary" + class="buy-button" + (click)="exportData()" + > + exportData + </button> + </div> <div class="intent-resource-table-list"> <nz-table #basicTable [nzData]="listOfData" diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.less b/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.less index f665fdb0..b2b59b7a 100644 --- a/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.less +++ b/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.less @@ -32,7 +32,14 @@ nz-select { margin-right: 5%; } } - +.header-row{ + margin-top:16px; + margin-bottom:-10px; +} +.buy-button { + float: right; + margin-right: 2%; +} .action-icon { display: inline-block; vertical-align: top; diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.ts b/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.ts index d13b9d7e..597719b8 100644 --- a/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.ts +++ b/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.ts @@ -1,7 +1,9 @@ import { Component, OnInit } from "@angular/core"; import { Router } from "@angular/router"; +import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; import { NzMessageService } from "ng-zorro-antd"; import { intentBaseService } from "../../../../core/services/intentBase.service"; +import Swal from 'sweetalert2'; @Component({ selector: 'app-intent-instance', @@ -11,41 +13,42 @@ import { intentBaseService } from "../../../../core/services/intentBase.service" export class IntentInstanceComponent implements OnInit { constructor( - private router:Router, + private router: Router, + private http: HttpClient, private myHttp: intentBaseService, - private nzMessage: NzMessageService - ) {} + private nzMessage: NzMessageService + ) { } - ngOnChanges() {} + ngOnChanges() { } - ngOnInit() { + ngOnInit() { this.pageIndex = 1; this.pageSize = 10; this.getIntentionInstanceList(); } - ngOnDestroy() {} + ngOnDestroy() { } // table lists - listOfData: any[] = []; + listOfData: any[] = []; // pageSize or pageNum - pageIndex: number = 1; - pageSize: number = 10; - total: number = 0; - loading = false; - + pageIndex: number = 1; + pageSize: number = 10; + total: number = 0; + loading = false; + // init source data - getIntentionInstanceList(): void { + getIntentionInstanceList(): void { this.myHttp.getIntentInstanceList({ currentPage: this.pageIndex, pageSize: this.pageSize }).subscribe((response) => { - const { code, message, data:{ totalRecords, list } } = response; + const { code, message, data: { totalRecords, list } } = response; if (code !== 200) { this.nzMessage.error(message); - return; + return; } - + this.total = totalRecords; this.listOfData = list; }, (err) => { @@ -65,7 +68,7 @@ export class IntentInstanceComponent implements OnInit { const { code, message, data } = response; if (code !== 200) { this.nzMessage.error(message); - return; + return; } this.nzMessage.success(data); this.resetParam2Query(); @@ -79,7 +82,7 @@ export class IntentInstanceComponent implements OnInit { const { code, message } = response; if (code !== 200) { this.nzMessage.error(message); - return; + return; } this.nzMessage.success('Delete IntentionInstance Success'); this.resetParam2Query(); @@ -87,7 +90,26 @@ export class IntentInstanceComponent implements OnInit { console.log(err); }); } - + params: Object = { + intentId: '', + startDate: '', + endData: '' + }; + exportData() { + this.http.post('/api/usecaseui-server/v1/intent/exportIntentContent', {}, { responseType: 'blob' }) + .subscribe((data) => { + const link = document.createElement('a'); + link.href = window.URL.createObjectURL(data); + link.setAttribute('download', 'excelData'); + link.click(); + }, (error) => { + console.error('export failed:', error); + Swal.fire({ + icon: 'error', + title: 'export failed', + }); + }); + } resetParam2Query() { this.pageIndex = 1; this.pageSize = 10; |