import { HttpClient } from '@angular/common/http'; import { Component, ElementRef, 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 { EditAnnualInspectionComponent } from './edit-annual-inspection/edit-annual-inspection.component'; @Component({ selector: 'app-annual-inspection', templateUrl: './annual-inspection.component.html', styleUrls: ['./annual-inspection.component.scss'] }) export class AnnualInspectionComponent implements OnInit { constructor(private modal: NzModalService, private viewContainerRef: ViewContainerRef, private http: HttpClient, private message: NzMessageService, private element: ElementRef) { } 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.getAnnualInspectionList() } list = [] totalCount;//列表总数 SkipCount: string = '0'; MaxResultCount: string = '100'; //获取当前油站档案类证照 getAnnualInspectionList() { this.tableSpin = true let data = JSON.parse(sessionStorage.getItem('userdata')); let params = { OrganizationUnitId: data.organization.id || "", IsContainsChildren: "true", SkipCount: this.SkipCount, MaxResultCount: this.MaxResultCount, } this.http.get(`/api/services/app/OrganizationValidityLicenseRule/GetCurOrgYearlyCheckRules`, { params }).subscribe((data: any) => { this.list = data.result this.list = [...this.list] this.tableSpin = false console.log(data) }) } edit(item) { console.log('item', item) if (!item.isYearlyCheck) { this.message.create('warning', '不需要年检'); return } const modal = this.modal.create({ nzContent: EditAnnualInspectionComponent, 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 }, nzFooter: null, nzClosable: false, nzOnOk: async () => { this.getAnnualInspectionList() } }); const instance = modal.getContentComponent(); modal.afterClose.subscribe(result => { }); } }