This commit is contained in:
Taric Xin
2022-03-23 11:06:24 +08:00
parent d2c350f6d1
commit 8d31f21547
3 changed files with 47 additions and 30 deletions

View File

@ -0,0 +1,40 @@
import { AfterViewInit, Component, OnInit } from '@angular/core';
import { fromEvent } from 'rxjs';
import { debounceTime } from 'rxjs/operators';
@Component({
template: ''
})
export class BasicTableComponent implements AfterViewInit {
scrollY = '400px';
constructor() {}
ngAfterViewInit(): void {
setTimeout(() => {
this.getScrollY();
}, 100);
fromEvent(window, 'resize')
.pipe(debounceTime(100))
.subscribe(event => {
this.getScrollY();
});
}
getScrollY() {
const windowHeight = window.innerHeight || Math.max(document.documentElement.clientHeight, document.body.clientHeight);
const header = document.getElementsByTagName('layout-pro-header')?.[0];
if (windowHeight && header) {
let scrollY = windowHeight - header.clientHeight - 35 - 49;
const headerWrapper = document.getElementsByTagName('page-header-wrapper')?.[0];
if (headerWrapper) {
scrollY -= headerWrapper.clientHeight;
}
const tabset = document.getElementsByTagName('nz-tabset')?.[0];
if (tabset) {
scrollY -= tabset.clientHeight;
}
this.scrollY = scrollY + 'px';
}
}
}

View File

@ -6,6 +6,7 @@ import { ShipperBaseService } from '@shared';
import { NzModalService } from 'ng-zorro-antd/modal'; import { NzModalService } from 'ng-zorro-antd/modal';
import { fromEvent, of } from 'rxjs'; import { fromEvent, of } from 'rxjs';
import { debounceTime, map } from 'rxjs/operators'; import { debounceTime, map } from 'rxjs/operators';
import { BasicTableComponent } from 'src/app/routes/commom/components/basic-table/basic-table.component';
import { OneCarOrderCancelConfirmComponent } from '../../modal/vehicle/cancel-confirm/cancel-confirm.component'; import { OneCarOrderCancelConfirmComponent } from '../../modal/vehicle/cancel-confirm/cancel-confirm.component';
import { VehicleConfirReceiptComponent } from '../../modal/vehicle/confir-receipt/confir-receipt.component'; import { VehicleConfirReceiptComponent } from '../../modal/vehicle/confir-receipt/confir-receipt.component';
import { VehicleFreightPeopleComponent } from '../../modal/vehicle/freight-people/freight-people.component'; import { VehicleFreightPeopleComponent } from '../../modal/vehicle/freight-people/freight-people.component';
@ -20,7 +21,7 @@ import { OrderManagementService } from '../../services/order-management.service'
templateUrl: './vehicle.component.html', templateUrl: './vehicle.component.html',
styleUrls: ['../../../commom/less/commom-table.less'] styleUrls: ['../../../commom/less/commom-table.less']
}) })
export class OrderManagementVehicleComponent implements OnInit { export class OrderManagementVehicleComponent extends BasicTableComponent implements OnInit {
ui: SFUISchema = {}; ui: SFUISchema = {};
schema: SFSchema = {}; schema: SFSchema = {};
auditMany = false; auditMany = false;
@ -67,7 +68,6 @@ export class OrderManagementVehicleComponent implements OnInit {
}; };
resourceStatus: any; resourceStatus: any;
scrollY = '400px';
visible = false; visible = false;
constructor( constructor(
public service: OrderManagementService, public service: OrderManagementService,
@ -75,7 +75,9 @@ export class OrderManagementVehicleComponent implements OnInit {
public shipperservice: ShipperBaseService, public shipperservice: ShipperBaseService,
public router: Router, public router: Router,
public ar: ActivatedRoute public ar: ActivatedRoute
) {} ) {
super();
}
/** /**
* 查询参数 * 查询参数
@ -145,32 +147,6 @@ export class OrderManagementVehicleComponent implements OnInit {
this.initST(); this.initST();
this.initSTFloat(); this.initSTFloat();
this.initSTFloatView(); this.initSTFloatView();
setTimeout(() => {
this.getScrollY();
}, 100);
fromEvent(window, 'resize')
.pipe(debounceTime(100))
.subscribe(event => {
this.getScrollY();
});
}
getScrollY() {
const windowHeight = window.innerHeight || Math.max(document.documentElement.clientHeight, document.body.clientHeight);
const header = document.getElementsByTagName('layout-pro-header')?.[0];
if (windowHeight && header) {
let scrollY = windowHeight - header.clientHeight - 35 - 49;
const headerWrapper = document.getElementsByTagName('page-header-wrapper')?.[0];
if (headerWrapper) {
scrollY -= headerWrapper.clientHeight;
}
const tabset = document.getElementsByTagName('nz-tabset')?.[0];
if (tabset) {
scrollY -= tabset.clientHeight;
}
this.scrollY = scrollY + 'px';
}
} }
search() { search() {

View File

@ -4,13 +4,14 @@ import { SharedModule } from '@shared';
// dashboard pages // dashboard pages
import { DashboardComponent } from './dashboard/dashboard.component'; import { DashboardComponent } from './dashboard/dashboard.component';
import { RouteRoutingModule } from './routes-routing.module'; import { RouteRoutingModule } from './routes-routing.module';
import { BasicTableComponent } from './commom/components/basic-table/basic-table.component';
const COMPONENTS = [DashboardComponent]; const COMPONENTS = [DashboardComponent];
const COMPONENTS_NOROUNT: Array<Type<void>> = []; const COMPONENTS_NOROUNT: Array<Type<void>> = [];
@NgModule({ @NgModule({
imports: [SharedModule, RouteRoutingModule], imports: [SharedModule, RouteRoutingModule],
declarations: [...COMPONENTS, ...COMPONENTS_NOROUNT], declarations: [...COMPONENTS, ...COMPONENTS_NOROUNT, BasicTableComponent],
entryComponents: COMPONENTS_NOROUNT entryComponents: COMPONENTS_NOROUNT
}) })
export class RoutesModule {} export class RoutesModule {}