Browse Source

[完善]处置弹出框完善;今日预警实时更新完善

dev
邵佳豪 3 years ago
parent
commit
7ad2ffb758
  1. 22
      src/app/pages/home/home.component.ts
  2. 16
      src/app/pages/today-warning-admin/today-warning-admin.component.ts
  3. 2
      src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.ts
  4. 16
      src/app/pages/today-warning/today-warning.component.ts
  5. 21
      src/app/pages/warning-statistics-list/disposeequipment/disposeequipment.component.html
  6. 27
      src/app/pages/warning-statistics-list/disposeequipment/disposeequipment.component.ts

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

@ -90,7 +90,11 @@ export class HomeComponent implements OnInit {
reloadPage = (userNotification) => {
console.log('abp.notifications.received收到通知', userNotification);
if (this.router.url.indexOf('todaywarning') != -1) {
this.listRefreshService.sendMessage(userNotification);//发布一条消息
let obj = {
type: 'add',
data: userNotification
}
this.listRefreshService.sendMessage(obj);//发布一条消息
}
this.receiptOfNotification(userNotification)
};
@ -119,7 +123,6 @@ export class HomeComponent implements OnInit {
params: params
}).subscribe((data: any) => {
console.log('推送信息后获取信息', data)
setTimeout(() => {
let copydata = data.result
if (item.notification.data.properties.EventSystemName == '灭火器维护') {
@ -162,6 +165,13 @@ export class HomeComponent implements OnInit {
resolve(data)
this.message.create('success', '报废成功!');
copydata.handleTime = new Date()
if (this.router.url.indexOf('todaywarning') != -1) {
let obj = {
type: 'updatehandleTime',
data: copydata.id
}
this.listRefreshService.sendMessage(obj);//发布一条消息
}
return true
})
})
@ -188,6 +198,13 @@ export class HomeComponent implements OnInit {
resolve(data)
this.message.create('success', '维保成功!');
copydata.handleTime = new Date()
if (this.router.url.indexOf('todaywarning') != -1) {
let obj = {
type: 'updatehandleTime',
data: copydata.id
}
this.listRefreshService.sendMessage(obj);//发布一条消息
}
return true
})
})
@ -223,7 +240,6 @@ export class HomeComponent implements OnInit {
}, 0);
this.messageId.forEach((element) => {
if (element.id == item.notification.entityId) {
this.notificationService.remove(element.messageId)

16
src/app/pages/today-warning-admin/today-warning-admin.component.ts

@ -43,8 +43,20 @@ export class TodayWarningAdminComponent implements OnInit {
this.getAllOrganization()
this.listRefreshService.getMessage().subscribe((message: any) => {
// console.log('需要更新列表了', message);//send a message
this.getEarlyWarningList()
//列表刷新
if (message.type == 'add') {
this.getEarlyWarningList()
}
//更新处置状态
if (message.type == 'updatehandleTime') {
console.log('更新处置状态',message)
console.log(this.list)
this.list.forEach(element => {
if(element.id == message.data){
element.handleTime = new Date()
}
});
}
// let params = {
// id: message.notification.entityId
// }

2
src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.ts

@ -39,6 +39,8 @@ export class GetOutOfLineDetailsComponent implements OnInit {
this.message.create('success', '处置成功!');
this.data.handleTime = new Date()
this.data.handleRecord = this.content
})
}
}

16
src/app/pages/today-warning/today-warning.component.ts

@ -33,8 +33,20 @@ export class TodayWarningComponent implements OnInit {
this.warningType()
this.getEarlyWarningList()
this.listRefreshService.getMessage().subscribe((message: any) => {
// console.log('需要更新列表了', message);//send a message
this.getEarlyWarningList()
//列表刷新
if (message.type == 'add') {
this.getEarlyWarningList()
}
//更新处置状态
if (message.type == 'updatehandleTime') {
// console.log('更新处置状态', message)
// console.log(this.list)
this.list.forEach(element => {
if (element.id == message.data) {
element.handleTime = new Date()
}
});
}
// let params = {
// id: message.notification.entityId
// }

21
src/app/pages/warning-statistics-list/disposeequipment/disposeequipment.component.html

@ -11,12 +11,19 @@
<label nz-radio nzValue="A">维保</label>
<label nz-radio nzValue="B">报废</label>
</nz-radio-group>
<p *ngIf="data2.handleTime && !data2.violatedItemSnapshotObj.isScrap"
style="color: green;text-align: center;margin-top: 12px;">已处置成功</p>
<p *ngIf="data2.handleTime && data2.violatedItemSnapshotObj.isScrap"
style="color: red;text-align: center;margin-top: 12px;">已处置成功</p>
<p *ngIf="data2.handleTime && (isScraped == '维保' || isScraped == '报废')" style="text-align: center;color: #91CCFF;">
<br>
<span>器材名称:{{newdata.name}}</span><br>
<span *ngIf="isScraped == '维保'" style="color: green;">处置方式:维保<br></span>
<span *ngIf="isScraped == '报废'" style="color: red;">处置方式:报废<br></span>
<span>处置时间:{{data2.handleTime | date:"yyyy-MM-dd HH:mm:ss"}}<br></span>
<span>规格:{{newdata.specification}}<br></span>
<span>购入时间:{{newdata.purchaseDate | date:"yyyy-MM-dd"}}<br></span>
<span>生产时间:{{newdata.productionDate | date:"yyyy-MM-dd"}}<br></span>
<span>有效期至:{{newdata.validityEndTime | date:"yyyy-MM-dd"}}</span>
</p>
<form nz-form [formGroup]="validateForm" class="form">
<div *ngIf="!isScrap && !data2.handleTime">
<div *ngIf=" !data2.handleTime && !isScrap">
<p>消防器材名称</p>
<nz-form-item>
<nz-form-control>
@ -38,8 +45,8 @@
<p>购入日期</p>
<nz-form-item>
<nz-form-control>
<nz-date-picker [nzAllowClear]="false" [(ngModel)]="data2.violatedItemSnapshotObj.purchaseDate" formControlName="buytime"
nzPlaceHolder="请输入购入日期">
<nz-date-picker [nzAllowClear]="false" [(ngModel)]="data2.violatedItemSnapshotObj.purchaseDate"
formControlName="buytime" nzPlaceHolder="请输入购入日期">
</nz-date-picker>
</nz-form-control>
</nz-form-item>

27
src/app/pages/warning-statistics-list/disposeequipment/disposeequipment.component.ts

@ -16,12 +16,29 @@ export class DisposeequipmentComponent implements OnInit {
radioValue = "A"
data2
copydata2
ngOnInit(): void {
isScraped
newdata
ngOnInit(): void {
this.data2 = JSON.parse(JSON.stringify(this.data))
this.copydata2 = JSON.parse(JSON.stringify(this.data))
console.log('快照预警数据', this.data2)
if (this.data2.handleTime) {
let params = {
Id: this.data2.violatedItemSnapshotObj.id
}
this.http.get('/api/services/app/FireEquipment/Get', { params: params }).subscribe((data: any) => {
console.log('处置后的设备信息', data)
this.newdata = data.result
if (data.result.isScrapped) {
this.isScraped = '报废'
} else {
this.isScraped = '维保'
}
})
}
this.validateForm = this.fb.group({
name: [null, [Validators.required]],
@ -30,7 +47,8 @@ export class DisposeequipmentComponent implements OnInit {
prodtime: [null, [Validators.required]],
validitytime: [null, [Validators.required]]
});
this.data2 = JSON.parse(JSON.stringify(this.data))
}
destroyModal() {
@ -42,7 +60,6 @@ export class DisposeequipmentComponent implements OnInit {
//是否报废
isScrap = false
ngModelChange(e) {
console.log(e)
if (e == 'A') {
this.isScrap = false
} else {

Loading…
Cancel
Save