You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
2.9 KiB
102 lines
2.9 KiB
import { Component, OnInit, Input } from '@angular/core'; |
|
import { NzModalRef } from 'ng-zorro-antd/modal'; |
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; |
|
import { HttpClient } from '@angular/common/http'; |
|
import { ObjectsSimpleService } from 'src/app/service/objectsSimple.service'; |
|
import Viewer from 'viewerjs'; |
|
import { NzMessageService } from 'ng-zorro-antd/message'; |
|
import { handleType, handleTypeList } from 'src/app/pages/license/update-category/edit-update-category/edit-update-category.component'; |
|
|
|
|
|
@Component({ |
|
selector: 'app-audit-dispose', |
|
templateUrl: './audit-dispose.component.html', |
|
styleUrls: ['./audit-dispose.component.scss'] |
|
}) |
|
export class AuditDisposeComponent implements OnInit { |
|
|
|
@Input() data?: any; |
|
constructor(private modal: NzModalRef, private message: NzMessageService) { } |
|
|
|
textarea: string = ""; //审批意见 |
|
ngOnInit(): void { |
|
console.log(this.data) |
|
} |
|
|
|
|
|
destroyModal() { |
|
this.modal.destroy(); |
|
} |
|
|
|
isPass: boolean; |
|
ok(isPass: boolean) { |
|
this.isPass = isPass; |
|
this.modal.triggerOk() |
|
} |
|
|
|
//获取办理类型 |
|
getHandleTypes(handleTypes: any[]):string { |
|
if (!handleTypes || !handleTypes.length) { |
|
return |
|
} |
|
let names: string[] = [] |
|
let handleTypeList = JSON.parse(JSON.stringify(handleTypes)); |
|
let list: handleTypeList[] = new handleType().list; |
|
handleTypeList.forEach(item=>{ |
|
list.find(element=>{ |
|
item == element.value? names.push(element.name) : null |
|
}) |
|
}) |
|
return names.join(',') |
|
} |
|
|
|
//获取文件格式 |
|
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 |
|
} |
|
|
|
//查看图片 |
|
viewImg(url) { |
|
let dom = document.getElementById(`viewerjs`) |
|
let pObjs = dom.childNodes; |
|
let node = document.createElement("img") |
|
node.style.display = "none"; |
|
node.src = url; |
|
node.id = 'img' |
|
dom.appendChild(node) |
|
setTimeout(() => { |
|
let viewer = new Viewer(document.getElementById(`viewerjs`), { |
|
hidden: () => { |
|
dom.removeChild(pObjs[0]); |
|
viewer.destroy(); |
|
} |
|
}); |
|
node.click(); |
|
}, 0); |
|
} |
|
|
|
//查看文件 |
|
lookFile(item) { |
|
if (!item) { |
|
return |
|
} |
|
if (this.getFileType(item) == 'word') { |
|
let arr = item.split('.') |
|
arr[arr.length - 1] = 'pdf' |
|
window.open(arr.join('.')) |
|
} else if (this.getFileType(item) == 'pdf') { |
|
window.open(item) |
|
} else { |
|
this.message.create('warning', '暂不支持查看!'); |
|
} |
|
} |
|
|
|
}
|
|
|