import { HttpClient } from '@angular/common/http'; import { Component, Input, OnInit } from '@angular/core'; import { NzModalRef } from 'ng-zorro-antd/modal'; import Viewer from 'viewerjs'; @Component({ selector: 'app-gas-base-info', templateUrl: './gas-base-info.component.html', styleUrls: ['./gas-base-info.component.scss'] }) export class GasBaseInfoComponent implements OnInit { constructor(private modal: NzModalRef, private http: HttpClient) { } @Input() data?: any; isDetails: boolean = false; //是否是详情 ngOnInit(): void { if (this.data.id === undefined) { //详情 this.isDetails = true } this.getBaseInfo() } baseInfo: any = { stationType: null, } otherData getBaseInfo() { let params = { organizationUnitId: this.data.organizationId } this.http.get('/api/services/app/GasStation/Get', { params }).subscribe((data: any) => { data.result.govUnitDetail ? data.result.govUnitDetail = JSON.parse(data.result.govUnitDetail) : null; this.baseInfo = data.result this.baseInfo.otherData ? this.otherData = JSON.parse(this.baseInfo.otherData) : null console.log('otherData', this.otherData) }) } //查看图片 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); } destroyModal() { this.modal.destroy({ data: 'this the result data' }); } auditList: any[] = []; //获取审核记录 getAuditLogging() { if (!this.data.organizationId) { return } let params = { orgId: this.data.organizationId } this.http.get(`/api/services/app/GasStation/GetAuditted`, { params }).subscribe((data: any) => { //this.auditList = data.result.actionList || [] console.log(data) }) } //获取审核次数 getVerifyNum(): number { let num = 0 this.auditList.forEach(item => { if (item.auditStatus == 2 || item.auditStatus == 3) { num = num + 1 } }) return num } //获取驳回次数 getRejectNum(): number { let num = 0 this.auditList.forEach(item => { if (item.auditStatus == 3) { num = num + 1 } }) return num } }