From a848784fafe8485becfa546bdd8f813167e9272c Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Thu, 17 Feb 2022 13:46:29 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E5=AE=8C=E5=96=84=E6=B6=88?= =?UTF-8?q?=E9=98=B2=E8=AE=BE=E6=96=BD=E7=9A=84=E5=A4=84=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../criminal-records-admin.component.ts | 34 ++-- .../criminal-records.component.ts | 33 ++-- .../pages/home-page/home-page.component.ts | 151 ++++++++++++---- src/app/pages/home/home.component.ts | 161 +++++++++--------- .../oil-station-info.component.html | 2 +- .../oil-station-info.component.ts | 3 + .../today-warning-admin.component.ts | 34 ++-- .../today-warning/today-warning.component.ts | 34 ++-- .../disposeequipment.component.html | 4 +- .../disposeequipment.component.ts | 6 + .../warning-statistics-list.component.ts | 40 +++-- 11 files changed, 323 insertions(+), 179 deletions(-) diff --git a/src/app/pages/criminal-records-admin/criminal-records-admin.component.ts b/src/app/pages/criminal-records-admin/criminal-records-admin.component.ts index 6113888..c38b226 100644 --- a/src/app/pages/criminal-records-admin/criminal-records-admin.component.ts +++ b/src/app/pages/criminal-records-admin/criminal-records-admin.component.ts @@ -608,23 +608,31 @@ export class CriminalRecordsAdminComponent implements OnInit { nzClosable: false, nzOnOk: async () => { if (instance.isScrap) { - let body = { - id: item.violatedItemSnapshotObj.id, - isScrapped: true, - organizationUnitId: item.violatedItemSnapshotObj.organizationUnitId - } - this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => { - // item.violatedItemSnapshotObj = data.result + await new Promise(resolve => { let body = { - id: item.id, - handleRecord: '报废成功!' + id: item.violatedItemSnapshotObj.id, + name: instance.copydata2.violatedItemSnapshotObj.name, + specification: instance.copydata2.violatedItemSnapshotObj.specification, + productionDate: moment(instance.copydata2.violatedItemSnapshotObj.prodtime).format('yyyy-MM-DD'), + purchaseDate: moment(instance.copydata2.violatedItemSnapshotObj.buytime).format('yyyy-MM-DD'), + validityEndTime: moment(instance.copydata2.violatedItemSnapshotObj.validitytime).format('yyyy-MM-DD'), + isScrapped: true, + organizationUnitId: item.violatedItemSnapshotObj.organizationUnitId } - this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { - this.message.create('success', '报废成功!'); - item.handleTime = new Date() - return true + this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => { + let body = { + id: item.id, + handleRecord: '报废成功!' + } + this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { + resolve(data) + this.message.create('success', '报废成功!'); + item.handleTime = new Date() + return true + }) }) }) + } else { if (instance.validateForm.valid) { await new Promise(resolve => { diff --git a/src/app/pages/criminal-records/criminal-records.component.ts b/src/app/pages/criminal-records/criminal-records.component.ts index 5434fb8..d369560 100644 --- a/src/app/pages/criminal-records/criminal-records.component.ts +++ b/src/app/pages/criminal-records/criminal-records.component.ts @@ -553,21 +553,28 @@ export class CriminalRecordsComponent implements OnInit { nzClosable: false, nzOnOk: async () => { if (instance.isScrap) { - let body = { - id: item.violatedItemSnapshotObj.id, - isScrapped: true, - organizationUnitId: item.violatedItemSnapshotObj.organizationUnitId - } - this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => { - // item.violatedItemSnapshotObj = data.result + await new Promise(resolve => { let body = { - id: item.id, - handleRecord: '报废成功!' + id: item.violatedItemSnapshotObj.id, + name: instance.copydata2.violatedItemSnapshotObj.name, + specification: instance.copydata2.violatedItemSnapshotObj.specification, + productionDate: moment(instance.copydata2.violatedItemSnapshotObj.prodtime).format('yyyy-MM-DD'), + purchaseDate: moment(instance.copydata2.violatedItemSnapshotObj.buytime).format('yyyy-MM-DD'), + validityEndTime: moment(instance.copydata2.violatedItemSnapshotObj.validitytime).format('yyyy-MM-DD'), + isScrapped: true, + organizationUnitId: item.violatedItemSnapshotObj.organizationUnitId } - this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { - this.message.create('success', '报废成功!'); - item.handleTime = new Date() - return true + this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => { + let body = { + id: item.id, + handleRecord: '报废成功!' + } + this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { + resolve(data) + this.message.create('success', '报废成功!'); + item.handleTime = new Date() + return true + }) }) }) } else { diff --git a/src/app/pages/home-page/home-page.component.ts b/src/app/pages/home-page/home-page.component.ts index db26b09..3366345 100644 --- a/src/app/pages/home-page/home-page.component.ts +++ b/src/app/pages/home-page/home-page.component.ts @@ -6,6 +6,7 @@ import * as moment from 'moment'; import { NzModalService } from 'ng-zorro-antd/modal'; import { GetOutOfLineDetailsComponent } from '../today-warning/get-out-of-line-details/get-out-of-line-details.component'; import { NzMessageService } from 'ng-zorro-antd/message'; +import { DisposeequipmentComponent } from '../warning-statistics-list/disposeequipment/disposeequipment.component'; declare var tools @Component({ @@ -668,36 +669,128 @@ export class HomePageComponent implements OnInit { isOpenModel: boolean = false look(item) { - console.log('消息item', item) - this.isOpenModel = true - item.notification.data.id = item.notification.entityId - let data = item.notification.data - const modal = this.modal.create({ - nzContent: GetOutOfLineDetailsComponent, - nzWrapClassName: "vertical-center-modal", - nzViewContainerRef: this.viewContainerRef, - nzWidth: (document.documentElement.clientHeight < 650 || document.documentElement.clientWidth < 1400) ? 1000 : 1200, - nzBodyStyle: { - 'border': '1px solid #6d9cc7', - 'border-radius': '0px', - 'padding': '0px', - 'box-shadow': '0 0 8px 0 #fff', - 'background': '#000D21', - }, - nzComponentParams: { - data: data - }, - nzFooter: null, - nzOnOk: async () => { + console.log('消息item', item) + if (item.notification.data.eventSystemName == '灭火器维护') { + this.isOpenModel = true + let copydata = item.notification.data + copydata.violatedItemSnapshotObj = JSON.parse(copydata.violatedItemSnapshot) + const modal = this.modal.create({ + nzContent: DisposeequipmentComponent, + nzViewContainerRef: this.viewContainerRef, + nzWidth: 380, + nzBodyStyle: { + 'border': '1px solid #91CCFF', + 'border-radius': '0px', + 'padding': '7px', + 'box-shadow': '0 0 8px 0 #fff', + 'background-image': 'linear-gradient(#003665, #000f25)' + }, + nzComponentParams: { + data: copydata + }, + nzFooter: null, + nzClosable: false, + nzOnOk: async () => { + if (instance.isScrap) { + await new Promise(resolve => { + let body = { + id: copydata.violatedItemSnapshotObj.id, + isScrapped: true, + organizationUnitId: copydata.violatedItemSnapshotObj.organizationUnitId, + name: instance.copydata2.violatedItemSnapshotObj.name, + specification: instance.copydata2.violatedItemSnapshotObj.specification, + productionDate: moment(instance.copydata2.violatedItemSnapshotObj.prodtime).format('yyyy-MM-DD'), + purchaseDate: moment(instance.copydata2.violatedItemSnapshotObj.buytime).format('yyyy-MM-DD'), + validityEndTime: moment(instance.copydata2.violatedItemSnapshotObj.validitytime).format('yyyy-MM-DD') + } + this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => { + let body = { + id: item.notification.entityId, + handleRecord: '报废成功!' + } + this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { + resolve(data) + this.message.create('success', '报废成功!'); + copydata.handleTime = new Date() + return true + }) + }) + }) + + } else { + if (instance.validateForm.valid) { + await new Promise(resolve => { + let body = { + id: copydata.violatedItemSnapshotObj.id, + name: instance.validateForm.value.name, + specification: instance.validateForm.value.specification, + productionDate: moment(instance.validateForm.value.prodtime).format('yyyy-MM-DD'), + purchaseDate: moment(instance.validateForm.value.buytime).format('yyyy-MM-DD'), + validityEndTime: moment(instance.validateForm.value.validitytime).format('yyyy-MM-DD'), + organizationUnitId: copydata.violatedItemSnapshotObj.organizationUnitId + } + this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => { + let body = { + id: item.notification.entityId, + handleRecord: '维保成功!' + } + this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { + resolve(data) + this.message.create('success', '维保成功!'); + copydata.handleTime = new Date() + return true + }) + }) + }) + } else { + this.message.create('warning', '请填写完整!'); + return false + } + } + } + }); + const instance = modal.getContentComponent(); + + + modal.afterClose.subscribe(result => { + this.isOpenModel = false + this.rollStart() + }); + this.readMess(item.notification.id) + } else { + this.isOpenModel = true + item.notification.data.id = item.notification.entityId + let data = item.notification.data + const modal = this.modal.create({ + nzContent: GetOutOfLineDetailsComponent, + nzWrapClassName: "vertical-center-modal", + nzViewContainerRef: this.viewContainerRef, + nzWidth: (document.documentElement.clientHeight < 650 || document.documentElement.clientWidth < 1400) ? 1000 : 1200, + nzBodyStyle: { + 'border': '1px solid #6d9cc7', + 'border-radius': '0px', + 'padding': '0px', + 'box-shadow': '0 0 8px 0 #fff', + 'background': '#000D21', + }, + nzComponentParams: { + data: data + }, + nzFooter: null, + nzOnOk: async () => { + + } + }); + const instance = modal.getContentComponent(); + modal.afterClose.subscribe(result => { + this.isOpenModel = false + this.rollStart() + }); + this.readMess(item.notification.id) + } + + - } - }); - const instance = modal.getContentComponent(); - modal.afterClose.subscribe(result => { - this.isOpenModel = false - this.rollStart() - }); - this.readMess(item.notification.id) } diff --git a/src/app/pages/home/home.component.ts b/src/app/pages/home/home.component.ts index 6b6a367..a5ce07b 100644 --- a/src/app/pages/home/home.component.ts +++ b/src/app/pages/home/home.component.ts @@ -119,101 +119,108 @@ export class HomeComponent implements OnInit { params: params }).subscribe((data: any) => { console.log('推送信息后获取信息', data) - let copydata = data.result - - if (item.notification.data.properties.EventSystemName == '灭火器维护') { - copydata.violatedItemSnapshotObj = JSON.parse(copydata.violatedItemSnapshot) - const modal = this.modal.create({ - nzContent: DisposeequipmentComponent, - nzViewContainerRef: this.viewContainerRef, - nzWidth: 380, - nzBodyStyle: { - 'border': '1px solid #91CCFF', - 'border-radius': '0px', - 'padding': '7px', - 'box-shadow': '0 0 8px 0 #fff', - 'background-image': 'linear-gradient(#003665, #000f25)' - }, - nzComponentParams: { - data: copydata - }, - nzFooter: null, - nzClosable: false, - nzOnOk: async () => { - if (instance.isScrap) { - let body = { - id: copydata.violatedItemSnapshotObj.id, - isScrapped: true, - organizationUnitId: copydata.violatedItemSnapshotObj.organizationUnitId - } - this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => { - // item.violatedItemSnapshotObj = data.result - let body = { - id: copydata.id, - handleRecord: '报废成功!' - } - this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { - this.message.create('success', '报废成功!'); - item.handleTime = new Date() - return true - }) - }) - } else { - if (instance.validateForm.valid) { + + setTimeout(() => { + let copydata = data.result + if (item.notification.data.properties.EventSystemName == '灭火器维护') { + copydata.violatedItemSnapshotObj = JSON.parse(copydata.violatedItemSnapshot) + const modal = this.modal.create({ + nzContent: DisposeequipmentComponent, + nzViewContainerRef: this.viewContainerRef, + nzWidth: 380, + nzBodyStyle: { + 'border': '1px solid #91CCFF', + 'border-radius': '0px', + 'padding': '7px', + 'box-shadow': '0 0 8px 0 #fff', + 'background-image': 'linear-gradient(#003665, #000f25)' + }, + nzComponentParams: { + data: copydata + }, + nzFooter: null, + nzClosable: false, + nzOnOk: async () => { + if (instance.isScrap) { await new Promise(resolve => { let body = { id: copydata.violatedItemSnapshotObj.id, - name: instance.validateForm.value.name, - specification: instance.validateForm.value.specification, - productionDate: moment(instance.validateForm.value.prodtime).format('yyyy-MM-DD'), - purchaseDate: moment(instance.validateForm.value.buytime).format('yyyy-MM-DD'), - validityEndTime: moment(instance.validateForm.value.validitytime).format('yyyy-MM-DD'), - organizationUnitId: copydata.violatedItemSnapshotObj.organizationUnitId + isScrapped: true, + organizationUnitId: copydata.violatedItemSnapshotObj.organizationUnitId, + name: instance.copydata2.violatedItemSnapshotObj.name, + specification: instance.copydata2.violatedItemSnapshotObj.specification, + productionDate: moment(instance.copydata2.violatedItemSnapshotObj.prodtime).format('yyyy-MM-DD'), + purchaseDate: moment(instance.copydata2.violatedItemSnapshotObj.buytime).format('yyyy-MM-DD'), + validityEndTime: moment(instance.copydata2.violatedItemSnapshotObj.validitytime).format('yyyy-MM-DD') } this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => { let body = { id: copydata.id, - handleRecord: '维保成功!' + handleRecord: '报废成功!' } this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { resolve(data) - this.message.create('success', '维保成功!'); + this.message.create('success', '报废成功!'); copydata.handleTime = new Date() return true }) }) }) + } else { - this.message.create('warning', '请填写完整!'); - return false + if (instance.validateForm.valid) { + await new Promise(resolve => { + let body = { + id: copydata.violatedItemSnapshotObj.id, + name: instance.validateForm.value.name, + specification: instance.validateForm.value.specification, + productionDate: moment(instance.validateForm.value.prodtime).format('yyyy-MM-DD'), + purchaseDate: moment(instance.validateForm.value.buytime).format('yyyy-MM-DD'), + validityEndTime: moment(instance.validateForm.value.validitytime).format('yyyy-MM-DD'), + organizationUnitId: copydata.violatedItemSnapshotObj.organizationUnitId + } + this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => { + let body = { + id: copydata.id, + handleRecord: '维保成功!' + } + this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { + resolve(data) + this.message.create('success', '维保成功!'); + copydata.handleTime = new Date() + return true + }) + }) + }) + } else { + this.message.create('warning', '请填写完整!'); + return false + } } } - } - }); - const instance = modal.getContentComponent(); - } else { - const modal = this.modal.create({ - nzContent: GetOutOfLineDetailsComponent, - nzWrapClassName: "vertical-center-modal", - nzViewContainerRef: this.viewContainerRef, - nzWidth: (document.documentElement.clientHeight < 650 || document.documentElement.clientWidth < 1400) ? 1000 : 1200, - nzBodyStyle: { - 'border': '1px solid #6d9cc7', - 'border-radius': '0px', - 'padding': '0px', - 'box-shadow': '0 0 8px 0 #fff', - 'background': '#000D21', - }, - nzComponentParams: { - data: copydata - }, - nzFooter: null, - }); - const instance = modal.getContentComponent(); - } - - - + }); + const instance = modal.getContentComponent(); + } else { + const modal = this.modal.create({ + nzContent: GetOutOfLineDetailsComponent, + nzWrapClassName: "vertical-center-modal", + nzViewContainerRef: this.viewContainerRef, + nzWidth: (document.documentElement.clientHeight < 650 || document.documentElement.clientWidth < 1400) ? 1000 : 1200, + nzBodyStyle: { + 'border': '1px solid #6d9cc7', + 'border-radius': '0px', + 'padding': '0px', + 'box-shadow': '0 0 8px 0 #fff', + 'background': '#000D21', + }, + nzComponentParams: { + data: copydata + }, + nzFooter: null, + }); + const instance = modal.getContentComponent(); + } + }, 0); diff --git a/src/app/pages/oil-station-info/oil-station-info.component.html b/src/app/pages/oil-station-info/oil-station-info.component.html index f8faf68..8180c8e 100644 --- a/src/app/pages/oil-station-info/oil-station-info.component.html +++ b/src/app/pages/oil-station-info/oil-station-info.component.html @@ -322,7 +322,7 @@ diff --git a/src/app/pages/oil-station-info/oil-station-info.component.ts b/src/app/pages/oil-station-info/oil-station-info.component.ts index c97cfed..052e721 100644 --- a/src/app/pages/oil-station-info/oil-station-info.component.ts +++ b/src/app/pages/oil-station-info/oil-station-info.component.ts @@ -217,14 +217,17 @@ export class OilStationInfoComponent implements OnInit { submitForm() { let valid = true + console.log(this.httpBody.licenses) this.httpBody.licenses.forEach(element => { if (!element.startTime || !element.endTime || !element.firstWarnTime || !element.secondWarnTime || !element.code) { valid = false + console.log('普通拦截') return } if (element.hasAnnualInspection) { if (!element.annualInspectionWarnTime || !element.annualInspectionOrganizationName || !element.annualInspectionTime) { valid = false + console.log('年检拦截') return } } 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 d366cb3..3e97be6 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 @@ -213,23 +213,31 @@ export class TodayWarningAdminComponent implements OnInit { nzClosable: false, nzOnOk: async () => { if (instance.isScrap) { - let body = { - id: item.violatedItemSnapshotObj.id, - isScrapped: true, - organizationUnitId: item.violatedItemSnapshotObj.organizationUnitId - } - this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => { - // item.violatedItemSnapshotObj = data.result + await new Promise(resolve => { let body = { - id: item.id, - handleRecord: '报废成功!' + id: item.violatedItemSnapshotObj.id, + name: instance.copydata2.violatedItemSnapshotObj.name, + specification: instance.copydata2.violatedItemSnapshotObj.specification, + productionDate: moment(instance.copydata2.violatedItemSnapshotObj.prodtime).format('yyyy-MM-DD'), + purchaseDate: moment(instance.copydata2.violatedItemSnapshotObj.buytime).format('yyyy-MM-DD'), + validityEndTime: moment(instance.copydata2.violatedItemSnapshotObj.validitytime).format('yyyy-MM-DD'), + isScrapped: true, + organizationUnitId: item.violatedItemSnapshotObj.organizationUnitId } - this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { - this.message.create('success', '报废成功!'); - item.handleTime = new Date() - return true + this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => { + let body = { + id: item.id, + handleRecord: '报废成功!' + } + this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { + resolve(data) + this.message.create('success', '报废成功!'); + item.handleTime = new Date() + return true + }) }) }) + } else { if (instance.validateForm.valid) { await new Promise(resolve => { diff --git a/src/app/pages/today-warning/today-warning.component.ts b/src/app/pages/today-warning/today-warning.component.ts index b164462..41b9ace 100644 --- a/src/app/pages/today-warning/today-warning.component.ts +++ b/src/app/pages/today-warning/today-warning.component.ts @@ -160,23 +160,31 @@ export class TodayWarningComponent implements OnInit { nzClosable: false, nzOnOk: async () => { if (instance.isScrap) { - let body = { - id: item.violatedItemSnapshotObj.id, - isScrapped: true, - organizationUnitId: item.violatedItemSnapshotObj.organizationUnitId - } - this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => { - // item.violatedItemSnapshotObj = data.result + await new Promise(resolve => { let body = { - id: item.id, - handleRecord: '报废成功!' + id: item.violatedItemSnapshotObj.id, + name: instance.copydata2.violatedItemSnapshotObj.name, + specification: instance.copydata2.violatedItemSnapshotObj.specification, + productionDate: moment(instance.copydata2.violatedItemSnapshotObj.prodtime).format('yyyy-MM-DD'), + purchaseDate: moment(instance.copydata2.violatedItemSnapshotObj.buytime).format('yyyy-MM-DD'), + validityEndTime: moment(instance.copydata2.violatedItemSnapshotObj.validitytime).format('yyyy-MM-DD'), + isScrapped: true, + organizationUnitId: item.violatedItemSnapshotObj.organizationUnitId } - this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { - this.message.create('success', '报废成功!'); - item.handleTime = new Date() - return true + this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => { + let body = { + id: item.id, + handleRecord: '报废成功!' + } + this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { + resolve(data) + this.message.create('success', '报废成功!'); + item.handleTime = new Date() + return true + }) }) }) + } else { if (instance.validateForm.valid) { await new Promise(resolve => { 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 91046aa..13c0c35 100644 --- a/src/app/pages/warning-statistics-list/disposeequipment/disposeequipment.component.html +++ b/src/app/pages/warning-statistics-list/disposeequipment/disposeequipment.component.html @@ -12,9 +12,9 @@

已处置成功(维保)

+ style="color: green;text-align: center;margin-top: 12px;">已处置成功

已处置成功(报废)

+ style="color: red;text-align: center;margin-top: 12px;">已处置成功

消防器材名称

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 f474da1..884fc10 100644 --- a/src/app/pages/warning-statistics-list/disposeequipment/disposeequipment.component.ts +++ b/src/app/pages/warning-statistics-list/disposeequipment/disposeequipment.component.ts @@ -16,7 +16,13 @@ export class DisposeequipmentComponent implements OnInit { radioValue = "A" data2 + + copydata2 ngOnInit(): void { + + this.copydata2 = JSON.parse(JSON.stringify(this.data)) + + this.validateForm = this.fb.group({ name: [null, [Validators.required]], specification: [null, [Validators.required]], diff --git a/src/app/pages/warning-statistics-list/warning-statistics-list.component.ts b/src/app/pages/warning-statistics-list/warning-statistics-list.component.ts index 8b51c92..6622146 100644 --- a/src/app/pages/warning-statistics-list/warning-statistics-list.component.ts +++ b/src/app/pages/warning-statistics-list/warning-statistics-list.component.ts @@ -637,6 +637,7 @@ export class WarningStatisticsListComponent implements OnInit { } //处置消防设施 dispose(item) { + console.log(item) const modal = this.modal.create({ nzContent: DisposeequipmentComponent, nzViewContainerRef: this.viewContainerRef, @@ -655,27 +656,31 @@ export class WarningStatisticsListComponent implements OnInit { nzClosable: false, nzOnOk: async () => { if (instance.isScrap) { - let body = { - id: item.violatedItemSnapshotObj.id, - name: instance.validateForm.value.name, - specification: instance.validateForm.value.specification, - productionDate: moment(instance.validateForm.value.prodtime).format('yyyy-MM-DD'), - purchaseDate: moment(instance.validateForm.value.buytime).format('yyyy-MM-DD'), - validityEndTime: moment(instance.validateForm.value.validitytime).format('yyyy-MM-DD'), - isScrapped: true, - organizationUnitId: item.violatedItemSnapshotObj.organizationUnitId - } - this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => { + await new Promise(resolve => { let body = { - id: item.id, - handleRecord: '报废成功!' + id: item.violatedItemSnapshotObj.id, + name: instance.copydata2.violatedItemSnapshotObj.name, + specification: instance.copydata2.violatedItemSnapshotObj.specification, + productionDate: moment(instance.copydata2.violatedItemSnapshotObj.prodtime).format('yyyy-MM-DD'), + purchaseDate: moment(instance.copydata2.violatedItemSnapshotObj.buytime).format('yyyy-MM-DD'), + validityEndTime: moment(instance.copydata2.violatedItemSnapshotObj.validitytime).format('yyyy-MM-DD'), + isScrapped: true, + organizationUnitId: item.violatedItemSnapshotObj.organizationUnitId } - this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { - this.message.create('success', '报废成功!'); - item.handleTime = new Date() - return true + this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => { + let body = { + id: item.id, + handleRecord: '报废成功!' + } + this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { + resolve(data) + this.message.create('success', '报废成功!'); + item.handleTime = new Date() + return true + }) }) }) + } else { if (instance.validateForm.valid) { await new Promise(resolve => { @@ -689,7 +694,6 @@ export class WarningStatisticsListComponent implements OnInit { organizationUnitId: item.violatedItemSnapshotObj.organizationUnitId } this.http.put('/api/services/app/FireEquipment/Update', body).subscribe((data: any) => { - // item.violatedItemSnapshotObj = data.result let body = { id: item.id, handleRecord: '维保成功!'