From 8d32ba4f740e5aac783d12268cf9982abf8584eb Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Wed, 25 May 2022 16:08:09 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E9=80=80=E5=87=BA=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=B8=85=E9=99=A4=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../annual-inspection/annual-inspection.component.ts | 7 +++++-- .../audit-inform-time/audit-inform-time.component.ts | 9 ++++++++- .../edit-inform-time/edit-inform-time.component.ts | 2 +- src/app/pages/audit/audit-ing/audit-ing.component.ts | 7 +++++-- .../pages/audit/audit-record/audit-record.component.ts | 6 +++++- .../license/file-category/file-category.component.ts | 9 ++++++++- src/app/pages/license/histories/histories.component.ts | 7 +++++-- src/app/pages/license/inform/inform.component.ts | 8 +++++--- .../license/update-category/update-category.component.ts | 7 +++++-- .../file-license-list/file-license-list.component.ts | 8 +++++--- .../oil-station-list/oil-station-list.component.ts | 7 +++++-- .../update-license-list/update-license-list.component.ts | 8 +++++--- 12 files changed, 62 insertions(+), 23 deletions(-) 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() {