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 { DetailsUpdateCategoryComponent } from '../update-category/details-update-category/details-update-category.component'; @Component({ selector: 'app-histories', templateUrl: './histories.component.html', styleUrls: ['./histories.component.scss'] }) export class HistoriesComponent implements OnInit { constructor(private modal: NzModalService, private viewContainerRef: ViewContainerRef, private http: HttpClient, private message: NzMessageService) { } tableSpin = false list = [] 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.getInform() } dispose() { console.log('处置') } //获取当前油站通知 SkipCount = '0' MaxResultCount = '999' getInform() { this.tableSpin = true let data = JSON.parse(sessionStorage.getItem('userdataOfgasstation')); let params: any = { OrganizationUnitId: data.organization.id || "", Active: false, SkipCount: this.SkipCount, MaxResultCount: this.MaxResultCount } this.http.get(`/api/services/app/StationValidityLicenseNotificationRecord/GetAll`, { params: params }).subscribe((data: any) => { this.list = data.result.items this.tableSpin = false console.log(data.result.items) }) } //获取办理类型 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(',') } //处置 details(item) { const modal = this.modal.create({ nzContent: DetailsUpdateCategoryComponent, 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.licenseSnapshot }, nzFooter: null, nzClosable: false, nzOnOk: async () => { } }); const instance = modal.getContentComponent(); modal.afterClose.subscribe(result => { }); } } //办理类型 export class handleType { list: handleTypeList[] = [ { value: 0, name: "无" }, { value: 1, name: "年度公示" }, { value: 2, name: "年检" }, { value: 3, name: "到期换证" }, { value: 4, name: "年度执行报告" }, { value: 5, name: "到期检测" }, { value: 6, name: "年度复训" }, { value: 7, name: "年度检测" }, { value: 8, name: "到期备案" }, { value: 9, name: "到期评价" }, ] } export class handleTypeList { value: number name: string }