Compare commits
2 Commits
bugfix#ale
...
feature_Ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00d4844a8b | ||
|
|
bf3a516772 |
@@ -1,5 +1,7 @@
|
|||||||
package com.usthe.common.util;
|
package com.usthe.common.util;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public Constant
|
* Public Constant
|
||||||
* 公共常量
|
* 公共常量
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export class HeaderNotifyComponent implements OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
let loadAlerts$ = this.alertSvc.loadAlerts(0, undefined, undefined, 0, 5).subscribe(
|
let loadAlerts$ = this.alertSvc.searchAlerts(0, undefined, undefined, 0, 5).subscribe(
|
||||||
message => {
|
message => {
|
||||||
loadAlerts$.unsubscribe();
|
loadAlerts$.unsubscribe();
|
||||||
if (message.code === 0) {
|
if (message.code === 0) {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
<i nz-icon nzType="sync" nzTheme="outline"></i>
|
<i nz-icon nzType="sync" nzTheme="outline"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button style="margin-right: 25px; float: right" nz-button nzType="primary" (click)="loadAlertsTable()">
|
<button style="margin-right: 25px; float: right" nz-button nzType="primary" (click)="onFilterSearchAlerts()">
|
||||||
{{ 'common.search' | i18n }}
|
{{ 'common.search' | i18n }}
|
||||||
</button>
|
</button>
|
||||||
<input
|
<input
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
type="text"
|
type="text"
|
||||||
[placeholder]="'alert.center.search' | i18n"
|
[placeholder]="'alert.center.search' | i18n"
|
||||||
nzSize="default"
|
nzSize="default"
|
||||||
(keyup.enter)="loadAlertsTable()"
|
(keyup.enter)="onFilterSearchAlerts()"
|
||||||
[(ngModel)]="filterContent"
|
[(ngModel)]="filterContent"
|
||||||
/>
|
/>
|
||||||
<nz-select
|
<nz-select
|
||||||
|
|||||||
@@ -36,16 +36,13 @@ export class AlertCenterComponent implements OnInit {
|
|||||||
this.loadAlertsTable();
|
this.loadAlertsTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
sync() {
|
onFilterSearchAlerts() {
|
||||||
this.loadAlertsTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
loadAlertsTable() {
|
|
||||||
this.tableLoading = true;
|
this.tableLoading = true;
|
||||||
let alertsInit$ = this.alertSvc
|
let filterAlerts$ = this.alertSvc
|
||||||
.loadAlerts(this.filterStatus, this.filterPriority, this.filterContent, this.pageIndex - 1, this.pageSize)
|
.searchAlerts(this.filterStatus, this.filterPriority, this.filterContent, this.pageIndex - 1, this.pageSize)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
message => {
|
message => {
|
||||||
|
filterAlerts$.unsubscribe();
|
||||||
this.tableLoading = false;
|
this.tableLoading = false;
|
||||||
this.checkedAll = false;
|
this.checkedAll = false;
|
||||||
this.checkedAlertIds.clear();
|
this.checkedAlertIds.clear();
|
||||||
@@ -57,16 +54,44 @@ export class AlertCenterComponent implements OnInit {
|
|||||||
} else {
|
} else {
|
||||||
console.warn(message.msg);
|
console.warn(message.msg);
|
||||||
}
|
}
|
||||||
alertsInit$.unsubscribe();
|
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
this.tableLoading = false;
|
this.tableLoading = false;
|
||||||
alertsInit$.unsubscribe();
|
filterAlerts$.unsubscribe();
|
||||||
console.error(error.msg);
|
console.error(error.msg);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sync() {
|
||||||
|
this.loadAlertsTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
loadAlertsTable() {
|
||||||
|
this.tableLoading = true;
|
||||||
|
let alertsInit$ = this.alertSvc.getAlerts(this.pageIndex - 1, this.pageSize).subscribe(
|
||||||
|
message => {
|
||||||
|
this.tableLoading = false;
|
||||||
|
this.checkedAll = false;
|
||||||
|
this.checkedAlertIds.clear();
|
||||||
|
if (message.code === 0) {
|
||||||
|
let page = message.data;
|
||||||
|
this.alerts = page.content;
|
||||||
|
this.pageIndex = page.number + 1;
|
||||||
|
this.total = page.totalElements;
|
||||||
|
} else {
|
||||||
|
console.warn(message.msg);
|
||||||
|
}
|
||||||
|
alertsInit$.unsubscribe();
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
this.tableLoading = false;
|
||||||
|
alertsInit$.unsubscribe();
|
||||||
|
console.error(error.msg);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
onDeleteAlerts() {
|
onDeleteAlerts() {
|
||||||
if (this.checkedAlertIds == null || this.checkedAlertIds.size === 0) {
|
if (this.checkedAlertIds == null || this.checkedAlertIds.size === 0) {
|
||||||
this.notifySvc.warning(this.i18nSvc.fanyi('alert.center.notify.no-delete'), '');
|
this.notifySvc.warning(this.i18nSvc.fanyi('alert.center.notify.no-delete'), '');
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
|||||||
alertsDealLoading: boolean = true;
|
alertsDealLoading: boolean = true;
|
||||||
|
|
||||||
refreshAlertContentList(): void {
|
refreshAlertContentList(): void {
|
||||||
let alertsInit$ = this.alertSvc.loadAlerts(undefined, undefined, undefined, 0, 4).subscribe(
|
let alertsInit$ = this.alertSvc.getAlerts(0, 4).subscribe(
|
||||||
message => {
|
message => {
|
||||||
if (message.code === 0) {
|
if (message.code === 0) {
|
||||||
let page = message.data;
|
let page = message.data;
|
||||||
|
|||||||
@@ -16,7 +16,23 @@ const alerts_status_uri = '/alerts/status';
|
|||||||
export class AlertService {
|
export class AlertService {
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient) {}
|
||||||
|
|
||||||
public loadAlerts(
|
public getAlerts(pageIndex: number, pageSize: number): Observable<Message<Page<Alert>>> {
|
||||||
|
pageIndex = pageIndex ? pageIndex : 0;
|
||||||
|
pageSize = pageSize ? pageSize : 8;
|
||||||
|
// 注意HttpParams是不可变对象 需要保存set后返回的对象为最新对象
|
||||||
|
let httpParams = new HttpParams();
|
||||||
|
httpParams = httpParams.appendAll({
|
||||||
|
sort: 'id',
|
||||||
|
order: 'desc',
|
||||||
|
status: '0',
|
||||||
|
pageIndex: pageIndex,
|
||||||
|
pageSize: pageSize
|
||||||
|
});
|
||||||
|
const options = { params: httpParams };
|
||||||
|
return this.http.get<Message<Page<Alert>>>(alerts_uri, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
public searchAlerts(
|
||||||
status: number | undefined,
|
status: number | undefined,
|
||||||
priority: number | undefined,
|
priority: number | undefined,
|
||||||
content: string | undefined,
|
content: string | undefined,
|
||||||
|
|||||||
Reference in New Issue
Block a user