diff --git a/src/app/pages/audit/annual-inspection/annual-inspection.component.ts b/src/app/pages/audit/annual-inspection/annual-inspection.component.ts index 9cd5035..a1ea706 100644 --- a/src/app/pages/audit/annual-inspection/annual-inspection.component.ts +++ b/src/app/pages/audit/annual-inspection/annual-inspection.component.ts @@ -16,15 +16,18 @@ export class AnnualInspectionComponent implements OnInit { tableSpin = false tableScrollHeight + resizeListener ngOnInit(): void { this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - 42) + 'px' // 页面监听 - fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { + this.resizeListener = fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - 42) + 'px' }); this.getAnnualInspectionList() } - + ngOnDestroy(): void { + this.resizeListener.unsubscribe() + } list = [] diff --git a/src/app/pages/audit/audit-inform-time/audit-inform-time.component.ts b/src/app/pages/audit/audit-inform-time/audit-inform-time.component.ts index fe83c75..b4189c0 100644 --- a/src/app/pages/audit/audit-inform-time/audit-inform-time.component.ts +++ b/src/app/pages/audit/audit-inform-time/audit-inform-time.component.ts @@ -20,16 +20,23 @@ export class AuditInformTimeComponent implements OnInit { list = [] tableScrollHeight + + resizeListener ngOnInit(): void { // 页面监听 this.tableScrollHeight = '0px' - fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { + this.resizeListener = fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { let tableHeader = this.element.nativeElement.querySelector(`.ant-table-header`).clientHeight this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - tableHeader) + 'px' }); this.getTimeList() } + + ngOnDestroy(): void { + this.resizeListener.unsubscribe() + } + SkipCount: string = '0' MaxResultCount: string = '100' diff --git a/src/app/pages/audit/audit-inform-time/edit-inform-time/edit-inform-time.component.ts b/src/app/pages/audit/audit-inform-time/edit-inform-time/edit-inform-time.component.ts index 7f305be..fe1c5f5 100644 --- a/src/app/pages/audit/audit-inform-time/edit-inform-time/edit-inform-time.component.ts +++ b/src/app/pages/audit/audit-inform-time/edit-inform-time/edit-inform-time.component.ts @@ -15,7 +15,7 @@ export class EditInformTimeComponent implements OnInit { @Input() data?: any; validateForm!: FormGroup; - constructor(private message: NzMessageService, private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private objectsSrv: ObjectsSimpleService) { } + constructor(private message: NzMessageService, private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient) { } dateFormat = 'MM/dd'; dataCopy diff --git a/src/app/pages/audit/audit-ing/audit-ing.component.ts b/src/app/pages/audit/audit-ing/audit-ing.component.ts index 55155e1..4f47dc9 100644 --- a/src/app/pages/audit/audit-ing/audit-ing.component.ts +++ b/src/app/pages/audit/audit-ing/audit-ing.component.ts @@ -21,16 +21,19 @@ export class AuditIngComponent implements OnInit { tableSpin = false tableScrollHeight + resizeListener ngOnInit(): void { this.tableScrollHeight = '100px' // 页面监听 - fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { + this.resizeListener = fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { let tableHeader = this.element.nativeElement.querySelector(`.ant-table-header`).clientHeight this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - tableHeader - 30) + 'px' }); this.getStationList() } - + ngOnDestroy(): void { + this.resizeListener.unsubscribe() + } ngAfterViewInit(): void { fromEvent(this.element.nativeElement.querySelector(`.ant-table-body`) as HTMLCanvasElement, 'scroll').pipe(debounceTime(100)).subscribe((event: any) => { //监听 DOM 滚动事件 if (event.target.scrollHeight - (event.target.scrollTop + event.target.clientHeight) <= 10) { diff --git a/src/app/pages/audit/audit-record/audit-record.component.ts b/src/app/pages/audit/audit-record/audit-record.component.ts index 0c92a88..0d8a724 100644 --- a/src/app/pages/audit/audit-record/audit-record.component.ts +++ b/src/app/pages/audit/audit-record/audit-record.component.ts @@ -22,12 +22,13 @@ export class AuditRecordComponent implements OnInit { list = [] tableScrollHeight + resizeListener startdate enddate async ngOnInit(): Promise { this.tableScrollHeight = '100px' // 页面监听 - fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { + this.resizeListener = fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { let tableHeader = this.element.nativeElement.querySelector(`.ant-table-header`).clientHeight this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - tableHeader - 30) + 'px' @@ -59,6 +60,9 @@ export class AuditRecordComponent implements OnInit { this.getRecordList() } + ngOnDestroy(): void { + this.resizeListener.unsubscribe() + } submitForm(): void { if (this.validateForm.value.datePicker[0].toLocaleDateString) { this.validateForm.value.datePicker[0] = this.validateForm.value.datePicker[0].toLocaleDateString() diff --git a/src/app/pages/license/file-category/file-category.component.ts b/src/app/pages/license/file-category/file-category.component.ts index 8d9fc07..7088429 100644 --- a/src/app/pages/license/file-category/file-category.component.ts +++ b/src/app/pages/license/file-category/file-category.component.ts @@ -20,15 +20,22 @@ export class FileCategoryComponent implements OnInit { list = []; //tabelData tableScrollHeight + resizeListener ngOnInit(): void { this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - 42) + 'px' // 页面监听 - fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { + this.resizeListener = fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - 42) + 'px' }); this.getStationList() } + ngOnDestroy(): void { + this.resizeListener.unsubscribe() + } + + + //获取当前油站档案类证照 getStationList() { this.tableSpin = true diff --git a/src/app/pages/license/histories/histories.component.ts b/src/app/pages/license/histories/histories.component.ts index 9cbd2dd..a37dd35 100644 --- a/src/app/pages/license/histories/histories.component.ts +++ b/src/app/pages/license/histories/histories.component.ts @@ -19,17 +19,20 @@ export class HistoriesComponent implements OnInit { list = [] tableScrollHeight + resizeListener ngOnInit(): void { this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - 42) + 'px' // 页面监听 - fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { + this.resizeListener = fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - 42) + 'px' }); this.getInform() } - + ngOnDestroy(): void { + this.resizeListener.unsubscribe() + } dispose() { console.log('处置') } diff --git a/src/app/pages/license/inform/inform.component.ts b/src/app/pages/license/inform/inform.component.ts index 41e6777..4008729 100644 --- a/src/app/pages/license/inform/inform.component.ts +++ b/src/app/pages/license/inform/inform.component.ts @@ -16,19 +16,21 @@ export class InformComponent implements OnInit { tableScrollHeight - fromEvent + resizeListener ngOnInit(): void { this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - 42) + 'px' // 页面监听 - this.fromEvent = fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { + this.resizeListener = fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - 42) + 'px' }); this.getInform() } - + ngOnDestroy(): void { + this.resizeListener.unsubscribe() + } dispose() { diff --git a/src/app/pages/license/update-category/update-category.component.ts b/src/app/pages/license/update-category/update-category.component.ts index 480add9..66e5fed 100644 --- a/src/app/pages/license/update-category/update-category.component.ts +++ b/src/app/pages/license/update-category/update-category.component.ts @@ -21,15 +21,18 @@ export class UpdateCategoryComponent implements OnInit { list = [] tableScrollHeight + resizeListener ngOnInit(): void { this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - 42) + 'px' // 页面监听 - fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { + this.resizeListener = fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - 42) + 'px' }); this.getStationList() } - + ngOnDestroy(): void { + this.resizeListener.unsubscribe() + } //获取当前油站档案类证照 getStationList() { this.tableSpin = true diff --git a/src/app/pages/plan-admin/file-license-list/file-license-list.component.ts b/src/app/pages/plan-admin/file-license-list/file-license-list.component.ts index a9117ef..429b3ba 100644 --- a/src/app/pages/plan-admin/file-license-list/file-license-list.component.ts +++ b/src/app/pages/plan-admin/file-license-list/file-license-list.component.ts @@ -24,11 +24,11 @@ export class FileLicenseListComponent implements OnInit { constructor(private modal: NzModalService, private viewContainerRef: ViewContainerRef, private element: ElementRef, private navChangeService: NavChangeService, private http: HttpClient, private toTree: TreeService, private fb: FormBuilder, private nzContextMenuService: NzContextMenuService, private router: Router, private message: NzMessageService) { } tableScrollHeight - + resizeListener async ngOnInit(): Promise { this.tableScrollHeight = '100px' // 页面监听 - fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { + this.resizeListener = fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { let tableHeader = this.element.nativeElement.querySelector(`.ant-table-header`).clientHeight this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - tableHeader - 10) + 'px' }); @@ -45,7 +45,9 @@ export class FileLicenseListComponent implements OnInit { this.getStationLicenses() } - + ngOnDestroy(): void { + this.resizeListener.unsubscribe() + } //获取所有组织机构 nodes: any = [] async getAllOrganization() { diff --git a/src/app/pages/plan-admin/oil-station-list/oil-station-list.component.ts b/src/app/pages/plan-admin/oil-station-list/oil-station-list.component.ts index 7d81460..de8a9ae 100644 --- a/src/app/pages/plan-admin/oil-station-list/oil-station-list.component.ts +++ b/src/app/pages/plan-admin/oil-station-list/oil-station-list.component.ts @@ -19,13 +19,13 @@ export class OilStationListComponent implements OnInit { constructor(private element: ElementRef, private navChangeService: NavChangeService, private http: HttpClient, private toTree: TreeService, private fb: FormBuilder, private nzContextMenuService: NzContextMenuService, private router: Router) { } tableScrollHeight - + resizeListener ngOnInit(): void { this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - 42) + 'px' console.log('tableScrollHeight', this.tableScrollHeight) // 页面监听 - fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { + this.resizeListener = fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - 42) + 'px' }); this.validateForm = this.fb.group({ @@ -34,6 +34,9 @@ export class OilStationListComponent implements OnInit { this.tableSpin = true } + ngOnDestroy(): void { + this.resizeListener.unsubscribe() + } ngAfterViewInit(): void { fromEvent(this.element.nativeElement.querySelector(`.ant-table-body`) as HTMLCanvasElement, 'scroll').pipe(debounceTime(100)).subscribe(async (event: any) => { //监听 DOM 滚动事件 if (event.target.scrollHeight - (event.target.scrollTop + event.target.clientHeight) <= 10) { diff --git a/src/app/pages/plan-admin/update-license-list/update-license-list.component.ts b/src/app/pages/plan-admin/update-license-list/update-license-list.component.ts index cf7e484..b2c1dac 100644 --- a/src/app/pages/plan-admin/update-license-list/update-license-list.component.ts +++ b/src/app/pages/plan-admin/update-license-list/update-license-list.component.ts @@ -23,13 +23,13 @@ export class UpdateLicenseListComponent implements OnInit { constructor(private modal: NzModalService, private viewContainerRef: ViewContainerRef, private element: ElementRef, private navChangeService: NavChangeService, private http: HttpClient, private toTree: TreeService, private fb: FormBuilder, private nzContextMenuService: NzContextMenuService, private router: Router, private message: NzMessageService) { } tableScrollHeight - + resizeListener async ngOnInit(): Promise { this.tableScrollHeight = '100px' // 页面监听 - fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { + this.resizeListener = fromEvent(window, 'resize').pipe(debounceTime(100)).subscribe((event) => { let tableHeader = this.element.nativeElement.querySelector(`.ant-table-header`).clientHeight this.tableScrollHeight = (document.getElementById('tablebox').clientHeight - tableHeader - 10) + 'px' }); @@ -45,7 +45,9 @@ export class UpdateLicenseListComponent implements OnInit { this.getStationLicenses() } - + ngOnDestroy(): void { + this.resizeListener.unsubscribe() + } //获取所有组织机构 nodes: any = [] async getAllOrganization() {