import { HttpClient } from '@angular/common/http'; import { Component, OnInit, ViewContainerRef } from '@angular/core'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalService } from 'ng-zorro-antd/modal'; import { Observable, fromEvent } from 'rxjs'; import { debounceTime } from 'rxjs/operators'; import { DetailsFileCategoryComponent } from '../../license/file-category/details-file-category/details-file-category.component'; import { DetailsUpdateCategoryComponent } from '../../license/update-category/details-update-category/details-update-category.component'; import { GasBaseInfoComponent } from '../gas-base-info/gas-base-info.component'; import { AuditDisposeComponent } from './audit-dispose/audit-dispose.component'; @Component({ selector: 'app-audit-ing', templateUrl: './audit-ing.component.html', styleUrls: ['./audit-ing.component.scss'] }) export class AuditIngComponent implements OnInit { constructor(private modal: NzModalService, private viewContainerRef: ViewContainerRef,private http: HttpClient,private message: NzMessageService) { } tableSpin = false tableScrollHeight ngOnInit(): void { this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - 42) + 'px' // 页面监听 fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - 42) + 'px' }); this.getStationList() } list = [] SkipCount: string = '0' MaxResultCount: string = '100' //获取当前油站档案类证照 getStationList() { let data = JSON.parse(sessionStorage.getItem('userdata')); let params = { OrganizationUnitId: data.organization.id || "" , IsContainsChildren: "true", AuditStatuses: "1", SkipCount: this.SkipCount, MaxResultCount: this.MaxResultCount, } this.http.get(`/api/services/app/ContentAuditLog/GetAuditting`,{params}).subscribe((info: any)=>{ info.result.items.forEach(element => { element.itemData = JSON.parse(element.itemData) }); this.list = info.result.items || [] console.log(this.list) }) } dispose(item) { // if (item.auditStatus != 1) { // return // } this.getData(item).then(res=>{ item.getData = res const modal = this.modal.create({ nzContent: AuditDisposeComponent, nzViewContainerRef: this.viewContainerRef, nzWidth: item.auditType == 0? 700 : 600, nzBodyStyle: { 'border': '1px solid #91CCFF', 'border-radius': '0px', 'padding': '7px', 'box-shadow': '0 0 8px 0 #fff', 'background-image': 'linear-gradient(#003665, #000f25)' }, nzStyle: { 'top': '50px', }, nzComponentParams: { data: item }, nzFooter: null, nzClosable: false, nzOnOk: async () => { await new Promise(resolve => { let url if (item.auditType == 0) { url = '/api/services/app/GasStation/Audit' } else if (item.auditType == 1) { url = '/api/services/app/OrganizationValidityLicenseRule/Audit' } else if (item.auditType == 2) { url = '/api/services/app/StationValidityLicense/Audit' } else if (item.auditType) { url = '/api/services/app/StationFileLicense/Audit' } let params = { id: item.getData.id, remark: instance.textarea } let body = instance.isPass? 2 : 3; this.http.post(url,body,{params}).subscribe(data => { resolve(data); this.getStationList(); this.message.create('success', '审核完成!'); return true }) }) } }); const instance = modal.getContentComponent(); modal.afterClose.subscribe(result => { }); }) } details(item) { let component if (item.auditType == 0) { component = GasBaseInfoComponent } else if (item.auditType == 1) { } else if (item.auditType == 2) { component = DetailsUpdateCategoryComponent } else if (item.auditType) { component = DetailsFileCategoryComponent } if (item.getData) { const modal = this.modal.create({ nzContent: component, nzViewContainerRef: this.viewContainerRef, nzWidth: item.auditType == 0? 700 : 450, nzBodyStyle: { 'border': '1px solid #91CCFF', 'border-radius': '0px', 'padding': '7px', 'box-shadow': '0 0 8px 0 #fff', 'background-image': 'linear-gradient(#003665, #000f25)' }, nzStyle: { 'top': '50px', }, nzComponentParams: { data: item.getData }, nzFooter: null, nzClosable: false, }); } else { this.getData(item).then(res=>{ item.getData = res const modal = this.modal.create({ nzContent: component, nzViewContainerRef: this.viewContainerRef, nzWidth: 450, nzBodyStyle: { 'border': '1px solid #91CCFF', 'border-radius': '0px', 'padding': '7px', 'box-shadow': '0 0 8px 0 #fff', 'background-image': 'linear-gradient(#003665, #000f25)' }, nzComponentParams: { data: item.getData }, nzFooter: null, nzClosable: false, }); }) } } //获取证照类data getData(item) { let url if (item.auditType == 0) { //油站基本信息 return new Promise((resolve, reject)=>{ let organization = { organizationId: item.organizationId } resolve(organization) }) } else if (item.auditType == 1) { url = '/api/services/app/OrganizationValidityLicenseRule/Get' } else if (item.auditType == 2) { url = '/api/services/app/StationValidityLicense/Get' } else if (item.auditType) { url = '/api/services/app/StationFileLicense/Get' } return new Promise((resolve, reject)=>{ let params = { id: item.itemId } this.http.get(url,{params}).subscribe((data: any)=>{ resolve(data.result) }) }) } }