Browse Source

[完善]完善接收预警通知

dev
邵佳豪 3 years ago
parent
commit
5dc9e3dee6
  1. 6
      src/app/pages/home/home.component.html
  2. 57
      src/app/pages/home/home.component.ts
  3. BIN
      src/assets/images/warning.png
  4. 39
      src/theme.less

6
src/app/pages/home/home.component.html

@ -64,15 +64,15 @@
<ng-template #warning let-item="data"> <ng-template #warning let-item="data">
<div class="topbox"> <div class="topbox">
<div> <div>
<img src="../assets/images/AnXinQQ.jpg" alt=""> <img src="../assets/images/warning.png" alt="">
</div> </div>
<div class="text"> <div class="text">
<span class="name">您有一条新的预警提醒!</span> <span class="name">您有一条新的预警提醒!</span>
<span class="details">{{item.id}}</span> <span class="details">{{item.notification.data.properties.ViolationName}}</span>
</div> </div>
</div> </div>
<div class="btnbox"> <div class="btnbox">
<div class="look"> <div class="look" (click)="look(item)">
查看 查看
</div> </div>
<div class="lose" (click)="close(item)"> <div class="lose" (click)="close(item)">

57
src/app/pages/home/home.component.ts

@ -1,4 +1,4 @@
import { Component, OnInit, ViewChild, TemplateRef } from '@angular/core'; import { Component, OnInit, ViewChild, TemplateRef, ViewContainerRef } from '@angular/core';
import { Router, NavigationEnd, ActivatedRoute } from '@angular/router'; import { Router, NavigationEnd, ActivatedRoute } from '@angular/router';
import { Title } from '@angular/platform-browser' import { Title } from '@angular/platform-browser'
import { filter } from 'rxjs/operators'; import { filter } from 'rxjs/operators';
@ -8,6 +8,9 @@ import { CookieService } from 'ngx-cookie-service';
import { NzMessageService } from 'ng-zorro-antd/message'; import { NzMessageService } from 'ng-zorro-antd/message';
import { SignalRAspNetCoreHelper } from '../../../shared/helpers/SignalRAspNetCoreHelper'; import { SignalRAspNetCoreHelper } from '../../../shared/helpers/SignalRAspNetCoreHelper';
import { NzNotificationService } from 'ng-zorro-antd/notification'; import { NzNotificationService } from 'ng-zorro-antd/notification';
import { GetOutOfLineDetailsComponent } from '../today-warning/get-out-of-line-details/get-out-of-line-details.component';
import { NzModalService } from 'ng-zorro-antd/modal';
import { HttpClient } from '@angular/common/http';
declare var abp: any declare var abp: any
@Component({ @Component({
@ -17,8 +20,8 @@ declare var abp: any
}) })
export class HomeComponent implements OnInit { export class HomeComponent implements OnInit {
@ViewChild('warning', { static: false }) template?: TemplateRef<{}>; @ViewChild('warning', { static: false }) template?: TemplateRef<{}>;
constructor(private router: Router, private navChangeService: NavChangeService, public token: CacheTokenService, constructor(private http: HttpClient, private router: Router, private navChangeService: NavChangeService, public token: CacheTokenService,
private cookieService: CookieService, private message: NzMessageService, private notificationService: NzNotificationService) { } private cookieService: CookieService, private message: NzMessageService, private notificationService: NzNotificationService, private modal: NzModalService, private viewContainerRef: ViewContainerRef) { }
isGasStationNav: boolean isGasStationNav: boolean
isGasStation: boolean isGasStation: boolean
@ -89,20 +92,54 @@ export class HomeComponent implements OnInit {
this.receiptOfNotification(userNotification) this.receiptOfNotification(userNotification)
}); });
} }
messageId=[] messageId = []
receiptOfNotification(userNotification) { receiptOfNotification(userNotification) {
let obj = { let obj = {
id:'xxx', id: userNotification.notification.entityId,
messageId:this.notificationService.template(this.template!, {nzPlacement: 'bottomRight', nzClass: 'receiptOfNotification', nzDuration: 0, nzData: userNotification}).messageId messageId: this.notificationService.template(this.template!, { nzPlacement: 'bottomRight', nzClass: 'receiptOfNotification', nzDuration: 0, nzData: userNotification }).messageId
} }
this.messageId.push(obj) this.messageId.push(obj)
console.log(99999,this.messageId)
} }
look(item) {
let params = {
id: item.notification.entityId
}
this.http.get('/api/services/app/ViolateRecord/Get', {
params: params
}).subscribe((data: any) => {
const modal = this.modal.create({
nzContent: GetOutOfLineDetailsComponent,
nzViewContainerRef: this.viewContainerRef,
nzWidth: 1200,
nzBodyStyle: {
'border': '1px solid #6d9cc7',
'border-radius': '0px',
'padding': '0px',
'box-shadow': '0 0 8px 0 #fff',
'background': '#000D21',
},
nzComponentParams: {
data: data.result
},
nzFooter: null,
nzOnOk: async () => {
}
});
const instance = modal.getContentComponent();
this.messageId.forEach((element) => {
if (element.id == item.notification.entityId) {
this.notificationService.remove(element.messageId)
}
})
})
close(item){ }
this.messageId.forEach((element)=>{ close(item) {
if(element.id == 'xxx'){ // console.log(item)
this.messageId.forEach((element) => {
if (element.id == item.notification.entityId) {
this.notificationService.remove(element.messageId) this.notificationService.remove(element.messageId)
} }
}) })

BIN
src/assets/images/warning.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

39
src/theme.less

@ -78,23 +78,27 @@
flex: 1; flex: 1;
display: flex; display: flex;
align-items: center; align-items: center;
img { img {
max-width:70px; width: 90px;
max-height: 62px; height: 80px;
margin-left: 10px;
margin-right: 14px;
} }
.text { .text {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
span{
// display: inline-block; .name {
margin: 6px 0;
}
.name{
font-size: 16px; font-size: 16px;
color: #ffaaaa; color: #ffaaaa;
margin-top: 4px;
margin-bottom: 6px;
} }
.details{
.details {
font-size: 14px; font-size: 14px;
color: white; color: white;
} }
@ -108,7 +112,8 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
margin: 12px 0; margin: 12px 0;
div{
div {
width: 80px; width: 80px;
height: 32px; height: 32px;
line-height: 32px; line-height: 32px;
@ -185,7 +190,8 @@
#recordsbox, #recordsbox,
#warningbox, #warningbox,
#warningboxadmin, #warningboxadmin,
#addequipment,#stationPlanBox { #addequipment,
#stationPlanBox {
::-webkit-input-placeholder { ::-webkit-input-placeholder {
/* WebKit browsers */ /* WebKit browsers */
color: #345d85; color: #345d85;
@ -350,20 +356,25 @@
padding: 0; padding: 0;
color: #91CCFF; color: #91CCFF;
} }
.look { .look {
color: #36A2FF; color: #36A2FF;
cursor: pointer; cursor: pointer;
} }
.ant-table-measure-now{
.ant-table-measure-now {
display: none; display: none;
} }
.ant-empty-description{
.ant-empty-description {
color: #23D9FF; color: #23D9FF;
} }
.ant-table-tbody > tr > td{
.ant-table-tbody>tr>td {
border-bottom: none; border-bottom: none;
} }
.ant-table-tbody > tr > td:hover{
.ant-table-tbody>tr>td:hover {
background: none; background: none;
} }
} }

Loading…
Cancel
Save