|
@@ -1,4 +1,6 @@
|
|
|
-import { Component, OnInit } from '@angular/core';
|
|
|
|
|
|
|
+import { Component, Inject, OnInit } from '@angular/core';
|
|
|
|
|
+import { I18NService } from '@core';
|
|
|
|
|
+import { ALAIN_I18N_TOKEN } from '@delon/theme';
|
|
|
import { NzModalService } from 'ng-zorro-antd/modal';
|
|
import { NzModalService } from 'ng-zorro-antd/modal';
|
|
|
import { NzNotificationService } from 'ng-zorro-antd/notification';
|
|
import { NzNotificationService } from 'ng-zorro-antd/notification';
|
|
|
import { NzTableQueryParams } from 'ng-zorro-antd/table';
|
|
import { NzTableQueryParams } from 'ng-zorro-antd/table';
|
|
@@ -12,7 +14,12 @@ import { AlertService } from '../../../service/alert.service';
|
|
|
styles: []
|
|
styles: []
|
|
|
})
|
|
})
|
|
|
export class AlertCenterComponent implements OnInit {
|
|
export class AlertCenterComponent implements OnInit {
|
|
|
- constructor(private notifySvc: NzNotificationService, private modal: NzModalService, private alertSvc: AlertService) {}
|
|
|
|
|
|
|
+ constructor(
|
|
|
|
|
+ private notifySvc: NzNotificationService,
|
|
|
|
|
+ private modal: NzModalService,
|
|
|
|
|
+ private alertSvc: AlertService,
|
|
|
|
|
+ @Inject(ALAIN_I18N_TOKEN) private i18nSvc: I18NService
|
|
|
|
|
+ ) {}
|
|
|
|
|
|
|
|
pageIndex: number = 1;
|
|
pageIndex: number = 1;
|
|
|
pageSize: number = 8;
|
|
pageSize: number = 8;
|
|
@@ -87,13 +94,13 @@ export class AlertCenterComponent implements OnInit {
|
|
|
|
|
|
|
|
onDeleteAlerts() {
|
|
onDeleteAlerts() {
|
|
|
if (this.checkedAlertIds == null || this.checkedAlertIds.size === 0) {
|
|
if (this.checkedAlertIds == null || this.checkedAlertIds.size === 0) {
|
|
|
- this.notifySvc.warning('未选中任何待删除项!', '');
|
|
|
|
|
|
|
+ this.notifySvc.warning(this.i18nSvc.fanyi('alert.center.notify.no-delete'), '');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
this.modal.confirm({
|
|
this.modal.confirm({
|
|
|
- nzTitle: '请确认是否批量删除!',
|
|
|
|
|
- nzOkText: '确定',
|
|
|
|
|
- nzCancelText: '取消',
|
|
|
|
|
|
|
+ nzTitle: this.i18nSvc.fanyi('alert.center.confirm.delete-batch'),
|
|
|
|
|
+ nzOkText: this.i18nSvc.fanyi('common.button.ok'),
|
|
|
|
|
+ nzCancelText: this.i18nSvc.fanyi('common.button.cancel'),
|
|
|
nzOkDanger: true,
|
|
nzOkDanger: true,
|
|
|
nzOkType: 'primary',
|
|
nzOkType: 'primary',
|
|
|
nzOnOk: () => this.deleteAlerts(this.checkedAlertIds)
|
|
nzOnOk: () => this.deleteAlerts(this.checkedAlertIds)
|
|
@@ -102,13 +109,13 @@ export class AlertCenterComponent implements OnInit {
|
|
|
|
|
|
|
|
onMarkReadAlerts() {
|
|
onMarkReadAlerts() {
|
|
|
if (this.checkedAlertIds == null || this.checkedAlertIds.size === 0) {
|
|
if (this.checkedAlertIds == null || this.checkedAlertIds.size === 0) {
|
|
|
- this.notifySvc.warning('未选中任何待标记项!', '');
|
|
|
|
|
|
|
+ this.notifySvc.warning(this.i18nSvc.fanyi('alert.center.notify.no-mark'), '');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
this.modal.confirm({
|
|
this.modal.confirm({
|
|
|
- nzTitle: '请确认是否批量标记已处理!',
|
|
|
|
|
- nzOkText: '确定',
|
|
|
|
|
- nzCancelText: '取消',
|
|
|
|
|
|
|
+ nzTitle: this.i18nSvc.fanyi('alert.center.confirm.mark-done-batch'),
|
|
|
|
|
+ nzOkText: this.i18nSvc.fanyi('common.button.ok'),
|
|
|
|
|
+ nzCancelText: this.i18nSvc.fanyi('common.button.cancel'),
|
|
|
nzOkDanger: true,
|
|
nzOkDanger: true,
|
|
|
nzOkType: 'primary',
|
|
nzOkType: 'primary',
|
|
|
nzOnOk: () => this.updateAlertsStatus(this.checkedAlertIds, 3)
|
|
nzOnOk: () => this.updateAlertsStatus(this.checkedAlertIds, 3)
|
|
@@ -116,13 +123,13 @@ export class AlertCenterComponent implements OnInit {
|
|
|
}
|
|
}
|
|
|
onMarkUnReadAlerts() {
|
|
onMarkUnReadAlerts() {
|
|
|
if (this.checkedAlertIds == null || this.checkedAlertIds.size === 0) {
|
|
if (this.checkedAlertIds == null || this.checkedAlertIds.size === 0) {
|
|
|
- this.notifySvc.warning('未选中任何待标记项!', '');
|
|
|
|
|
|
|
+ this.notifySvc.warning(this.i18nSvc.fanyi('alert.center.notify.no-mark'), '');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
this.modal.confirm({
|
|
this.modal.confirm({
|
|
|
- nzTitle: '请确认是否批量标记未处理!',
|
|
|
|
|
- nzOkText: '确定',
|
|
|
|
|
- nzCancelText: '取消',
|
|
|
|
|
|
|
+ nzTitle: this.i18nSvc.fanyi('alert.center.confirm.mark-no-batch'),
|
|
|
|
|
+ nzOkText: this.i18nSvc.fanyi('common.button.ok'),
|
|
|
|
|
+ nzCancelText: this.i18nSvc.fanyi('common.button.cancel'),
|
|
|
nzOkDanger: true,
|
|
nzOkDanger: true,
|
|
|
nzOkType: 'primary',
|
|
nzOkType: 'primary',
|
|
|
nzOnOk: () => this.updateAlertsStatus(this.checkedAlertIds, 0)
|
|
nzOnOk: () => this.updateAlertsStatus(this.checkedAlertIds, 0)
|
|
@@ -133,9 +140,9 @@ export class AlertCenterComponent implements OnInit {
|
|
|
let alerts = new Set<number>();
|
|
let alerts = new Set<number>();
|
|
|
alerts.add(alertId);
|
|
alerts.add(alertId);
|
|
|
this.modal.confirm({
|
|
this.modal.confirm({
|
|
|
- nzTitle: '请确认是否删除!',
|
|
|
|
|
- nzOkText: '确定',
|
|
|
|
|
- nzCancelText: '取消',
|
|
|
|
|
|
|
+ nzTitle: this.i18nSvc.fanyi('common.confirm.delete'),
|
|
|
|
|
+ nzOkText: this.i18nSvc.fanyi('common.button.ok'),
|
|
|
|
|
+ nzCancelText: this.i18nSvc.fanyi('common.button.cancel'),
|
|
|
nzOkDanger: true,
|
|
nzOkDanger: true,
|
|
|
nzOkType: 'primary',
|
|
nzOkType: 'primary',
|
|
|
nzOnOk: () => this.deleteAlerts(alerts)
|
|
nzOnOk: () => this.deleteAlerts(alerts)
|
|
@@ -146,9 +153,9 @@ export class AlertCenterComponent implements OnInit {
|
|
|
let alerts = new Set<number>();
|
|
let alerts = new Set<number>();
|
|
|
alerts.add(alertId);
|
|
alerts.add(alertId);
|
|
|
this.modal.confirm({
|
|
this.modal.confirm({
|
|
|
- nzTitle: '请确认是否标记已处理!',
|
|
|
|
|
- nzOkText: '确定',
|
|
|
|
|
- nzCancelText: '取消',
|
|
|
|
|
|
|
+ nzTitle: this.i18nSvc.fanyi('alert.center.confirm.mark-done'),
|
|
|
|
|
+ nzOkText: this.i18nSvc.fanyi('common.button.ok'),
|
|
|
|
|
+ nzCancelText: this.i18nSvc.fanyi('common.button.cancel'),
|
|
|
nzOkDanger: true,
|
|
nzOkDanger: true,
|
|
|
nzOkType: 'primary',
|
|
nzOkType: 'primary',
|
|
|
nzOnOk: () => this.updateAlertsStatus(alerts, 3)
|
|
nzOnOk: () => this.updateAlertsStatus(alerts, 3)
|
|
@@ -159,9 +166,9 @@ export class AlertCenterComponent implements OnInit {
|
|
|
let alerts = new Set<number>();
|
|
let alerts = new Set<number>();
|
|
|
alerts.add(alertId);
|
|
alerts.add(alertId);
|
|
|
this.modal.confirm({
|
|
this.modal.confirm({
|
|
|
- nzTitle: '请确认是否标记未处理!',
|
|
|
|
|
- nzOkText: '确定',
|
|
|
|
|
- nzCancelText: '取消',
|
|
|
|
|
|
|
+ nzTitle: this.i18nSvc.fanyi('alert.center.confirm.mark-no'),
|
|
|
|
|
+ nzOkText: this.i18nSvc.fanyi('common.button.ok'),
|
|
|
|
|
+ nzCancelText: this.i18nSvc.fanyi('common.button.cancel'),
|
|
|
nzOkDanger: true,
|
|
nzOkDanger: true,
|
|
|
nzOkType: 'primary',
|
|
nzOkType: 'primary',
|
|
|
nzOnOk: () => this.updateAlertsStatus(alerts, 0)
|
|
nzOnOk: () => this.updateAlertsStatus(alerts, 0)
|
|
@@ -174,17 +181,17 @@ export class AlertCenterComponent implements OnInit {
|
|
|
message => {
|
|
message => {
|
|
|
deleteAlerts$.unsubscribe();
|
|
deleteAlerts$.unsubscribe();
|
|
|
if (message.code === 0) {
|
|
if (message.code === 0) {
|
|
|
- this.notifySvc.success('删除成功!', '');
|
|
|
|
|
|
|
+ this.notifySvc.success(this.i18nSvc.fanyi('common.notify.delete-success'), '');
|
|
|
this.loadAlertsTable();
|
|
this.loadAlertsTable();
|
|
|
} else {
|
|
} else {
|
|
|
this.tableLoading = false;
|
|
this.tableLoading = false;
|
|
|
- this.notifySvc.error('删除失败!', message.msg);
|
|
|
|
|
|
|
+ this.notifySvc.error(this.i18nSvc.fanyi('common.notify.delete-fail'), message.msg);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
error => {
|
|
error => {
|
|
|
this.tableLoading = false;
|
|
this.tableLoading = false;
|
|
|
deleteAlerts$.unsubscribe();
|
|
deleteAlerts$.unsubscribe();
|
|
|
- this.notifySvc.error('删除失败!', error.msg);
|
|
|
|
|
|
|
+ this.notifySvc.error(this.i18nSvc.fanyi('common.notify.delete-fail'), error.msg);
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
@@ -195,17 +202,17 @@ export class AlertCenterComponent implements OnInit {
|
|
|
message => {
|
|
message => {
|
|
|
markAlertsStatus$.unsubscribe();
|
|
markAlertsStatus$.unsubscribe();
|
|
|
if (message.code === 0) {
|
|
if (message.code === 0) {
|
|
|
- this.notifySvc.success('标记成功!', '');
|
|
|
|
|
|
|
+ this.notifySvc.success(this.i18nSvc.fanyi('common.notify.mark-success'), '');
|
|
|
this.loadAlertsTable();
|
|
this.loadAlertsTable();
|
|
|
} else {
|
|
} else {
|
|
|
this.tableLoading = false;
|
|
this.tableLoading = false;
|
|
|
- this.notifySvc.error('标记失败!', message.msg);
|
|
|
|
|
|
|
+ this.notifySvc.error(this.i18nSvc.fanyi('common.notify.mark-fail'), message.msg);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
error => {
|
|
error => {
|
|
|
this.tableLoading = false;
|
|
this.tableLoading = false;
|
|
|
markAlertsStatus$.unsubscribe();
|
|
markAlertsStatus$.unsubscribe();
|
|
|
- this.notifySvc.error('标记失败!', error.msg);
|
|
|
|
|
|
|
+ this.notifySvc.error(this.i18nSvc.fanyi('common.notify.mark-fail'), error.msg);
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|