From 7ad2ffb7580f3d312775870d5ea758484da3223e Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Fri, 18 Feb 2022 11:37:32 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E5=A4=84=E7=BD=AE=E5=BC=B9?= =?UTF-8?q?=E5=87=BA=E6=A1=86=E5=AE=8C=E5=96=84=EF=BC=9B=E4=BB=8A=E6=97=A5?= =?UTF-8?q?=E9=A2=84=E8=AD=A6=E5=AE=9E=E6=97=B6=E6=9B=B4=E6=96=B0=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/pages/home/home.component.ts | 22 ++++++++++++--- .../today-warning-admin.component.ts | 16 +++++++++-- .../get-out-of-line-details.component.ts | 2 ++ .../today-warning/today-warning.component.ts | 16 +++++++++-- .../disposeequipment.component.html | 21 ++++++++++----- .../disposeequipment.component.ts | 27 +++++++++++++++---- 6 files changed, 85 insertions(+), 19 deletions(-) diff --git a/src/app/pages/home/home.component.ts b/src/app/pages/home/home.component.ts index a5ce07b..35c0af2 100644 --- a/src/app/pages/home/home.component.ts +++ b/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) diff --git a/src/app/pages/today-warning-admin/today-warning-admin.component.ts b/src/app/pages/today-warning-admin/today-warning-admin.component.ts index 3e97be6..b8d15de 100644 --- a/src/app/pages/today-warning-admin/today-warning-admin.component.ts +++ b/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 // } diff --git a/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.ts b/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.ts index ef7348c..179d4c0 100644 --- a/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.ts +++ b/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 + + }) } } diff --git a/src/app/pages/today-warning/today-warning.component.ts b/src/app/pages/today-warning/today-warning.component.ts index 41b9ace..79287a3 100644 --- a/src/app/pages/today-warning/today-warning.component.ts +++ b/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 // } diff --git a/src/app/pages/warning-statistics-list/disposeequipment/disposeequipment.component.html b/src/app/pages/warning-statistics-list/disposeequipment/disposeequipment.component.html index 13c0c35..a22f659 100644 --- a/src/app/pages/warning-statistics-list/disposeequipment/disposeequipment.component.html +++ b/src/app/pages/warning-statistics-list/disposeequipment/disposeequipment.component.html @@ -11,12 +11,19 @@ -

已处置成功

-

已处置成功

+

+
+ 器材名称:{{newdata.name}}
+ 处置方式:维保
+ 处置方式:报废
+ 处置时间:{{data2.handleTime | date:"yyyy-MM-dd HH:mm:ss"}}
+ 规格:{{newdata.specification}}
+ 购入时间:{{newdata.purchaseDate | date:"yyyy-MM-dd"}}
+ 生产时间:{{newdata.productionDate | date:"yyyy-MM-dd"}}
+ 有效期至:{{newdata.validityEndTime | date:"yyyy-MM-dd"}} +

-
+

消防器材名称

@@ -38,8 +45,8 @@

购入日期

- + diff --git a/src/app/pages/warning-statistics-list/disposeequipment/disposeequipment.component.ts b/src/app/pages/warning-statistics-list/disposeequipment/disposeequipment.component.ts index 884fc10..0d850b7 100644 --- a/src/app/pages/warning-statistics-list/disposeequipment/disposeequipment.component.ts +++ b/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 {