import { HttpClient } from '@angular/common/http'; import { Component, OnInit, Input } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; @Component({ selector: 'app-get-out-of-line-details', templateUrl: './get-out-of-line-details.component.html', styleUrls: ['./get-out-of-line-details.component.scss'] }) export class GetOutOfLineDetailsComponent implements OnInit { @Input() data: any constructor(private fb: FormBuilder, private http: HttpClient, private message: NzMessageService, private modal: NzModalService, private initialModal: NzModalRef) { } imgUrl: string vedioUrl: string content details isMisinformation: boolean = false//误报按钮的显隐 ngOnInit(): void { console.log(this.data) this.details = this.data.content1 this.imgUrl = this.data.violateImage this.vedioUrl = this.data.violateVideo this.content = this.data.handleRecord let loginUserInfo if (sessionStorage.getItem('isGasStation') == 'true') { loginUserInfo = JSON.parse(sessionStorage.getItem('userdataOfgasstation')) } else { loginUserInfo = JSON.parse(sessionStorage.getItem('userdata')) } if (loginUserInfo.roles.find((item) => { return item.name == 'ViolationPositiveChecker' }) && this.data.violation.eventSystemName != '证照预警') { this.isMisinformation = true } else { this.isMisinformation = false } } selectedType: string = 'img' contentType(type) { this.selectedType = type } submit() { let body = { id: this.data.id, handleRecord: this.content } this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { this.message.create('success', '处置成功!'); this.data.handleTime = new Date() this.data.handleRecord = this.content }) } //误报 misinformation() { this.modal.confirm({ nzTitle: '判定该预警为误报吗?', nzOkText: '确定', nzOkType: 'danger', nzOnOk: () => { let body = { id: this.data.id, positive: false } this.http.post('/api/services/app/ViolateRecord/CheckViolateRecord', body).subscribe(data => { this.message.create('success', '处置成功!'); // this.data.handleTime = new Date() this.initialModal.triggerOk() }, err => { this.message.create('warning', '处置失败,请联系管理员!'); }) }, nzCancelText: '取消', nzOnCancel: () => console.log('Cancel') }) } }