Browse Source

[完善]退出组件清除监听

beijing
邵佳豪 3 years ago
parent
commit
8d32ba4f74
  1. 7
      src/app/pages/audit/annual-inspection/annual-inspection.component.ts
  2. 9
      src/app/pages/audit/audit-inform-time/audit-inform-time.component.ts
  3. 2
      src/app/pages/audit/audit-inform-time/edit-inform-time/edit-inform-time.component.ts
  4. 7
      src/app/pages/audit/audit-ing/audit-ing.component.ts
  5. 6
      src/app/pages/audit/audit-record/audit-record.component.ts
  6. 9
      src/app/pages/license/file-category/file-category.component.ts
  7. 7
      src/app/pages/license/histories/histories.component.ts
  8. 8
      src/app/pages/license/inform/inform.component.ts
  9. 7
      src/app/pages/license/update-category/update-category.component.ts
  10. 8
      src/app/pages/plan-admin/file-license-list/file-license-list.component.ts
  11. 7
      src/app/pages/plan-admin/oil-station-list/oil-station-list.component.ts
  12. 8
      src/app/pages/plan-admin/update-license-list/update-license-list.component.ts

7
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 = []

9
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'

2
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

7
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) {

6
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<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'
@ -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()

9
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

7
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('处置')
}

8
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() {

7
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

8
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<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 - 10) + 'px'
});
@ -45,7 +45,9 @@ export class FileLicenseListComponent implements OnInit {
this.getStationLicenses()
}
ngOnDestroy(): void {
this.resizeListener.unsubscribe()
}
//获取所有组织机构
nodes: any = []
async getAllOrganization() {

7
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) {

8
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<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 - 10) + 'px'
});
@ -45,7 +45,9 @@ export class UpdateLicenseListComponent implements OnInit {
this.getStationLicenses()
}
ngOnDestroy(): void {
this.resizeListener.unsubscribe()
}
//获取所有组织机构
nodes: any = []
async getAllOrganization() {

Loading…
Cancel
Save