diff --git a/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.html b/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.html index 1a482a1..46ed29e 100644 --- a/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.html +++ b/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.html @@ -17,7 +17,12 @@
- + + + + + +
@@ -27,13 +32,13 @@
处置内容 - + 已进行误报处置
- 误报 + 误报 提交 已处置
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 ade529f..da32c04 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 @@ -1,6 +1,7 @@ import { HttpClient } from '@angular/common/http'; import { Component, OnInit, Input } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { DomSanitizer } from '@angular/platform-browser'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; @Component({ @@ -11,7 +12,7 @@ import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; export class GetOutOfLineDetailsComponent implements OnInit { @Input() data: any - constructor(private fb: FormBuilder, private http: HttpClient, private message: NzMessageService, private modal: NzModalService, private initialModal: NzModalRef) { } + constructor(private fb: FormBuilder, private http: HttpClient, private message: NzMessageService, private modal: NzModalService, private initialModal: NzModalRef, private sanitizer: DomSanitizer) { } imgUrl: string @@ -21,12 +22,35 @@ export class GetOutOfLineDetailsComponent implements OnInit { isMisinformation: boolean = false//误报按钮的显隐 + + + isImage //传过来的文件是否是图片 + fileUrl 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 + this.imgUrl = this.data.violateImage + + + if (this.getFileType(this.imgUrl) == 'img') { + this.isImage = true + } else { + this.isImage = false + + if (this.getFileType(this.imgUrl) == 'word') { + let arr = this.imgUrl.split('.') + arr[arr.length - 1] = 'pdf' + this.fileUrl = this.sanitizer.bypassSecurityTrustResourceUrl(arr.join('.')); + } else if (this.getFileType(this.imgUrl) == 'pdf') { + this.fileUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.imgUrl); + } + + } + + + let loginUserInfo if (sessionStorage.getItem('isGasStation') == 'true') { @@ -45,6 +69,23 @@ export class GetOutOfLineDetailsComponent implements OnInit { } + //获取文件格式 + getFileType(name: string): string { + let suffix + if (name.substring(name.length - 4).includes('png') || name.substring(name.length - 4).includes('jpg') || name.substring(name.length - 4).includes('jpeg') || name.substring(name.length - 4).includes('webp')) { + suffix = 'img' + } else if (name.substring(name.length - 4).includes('doc') || name.substring(name.length - 4).includes('docx')) { + suffix = 'word' + } else if (name.substring(name.length - 4).includes('pdf')) { + suffix = 'pdf' + } + return suffix + } + + + + + selectedType: string = 'img' contentType(type) { this.selectedType = type