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 { 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) { } imgUrl: string vedioUrl: string content details 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 } 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, handleRecord: this.content ? this.content : '此条预警为误报', isFalsePositive: true } this.http.post('/api/services/app/ViolateRecord/HandleViolateRecord', body).subscribe(data => { this.message.create('success', '处置成功!'); this.data.handleTime = new Date() if (this.content) { this.data.handleRecord = this.content } else { this.data.handleRecord = '此条预警为误报' this.content = '此条预警为误报' } }) }, nzCancelText: '取消', nzOnCancel: () => console.log('Cancel') }) } }