This commit is contained in:
Taric Xin
2022-05-12 11:48:44 +08:00
parent bba5cfcca8
commit 2d5df21245
6 changed files with 126 additions and 46 deletions

View File

@ -30,15 +30,11 @@ export class BasicTableComponent implements AfterViewInit, OnDestroy, OnReuseDes
sf!: SFComponent;
sfValue: Record<string, any> = {};
drawer: Subscription[] = [];
schema: SFSchema = {};
deviationHeight = 0;
constructor(public searchDrawerService: SearchDrawerService) {}
_onReuseDestroy(): void {
this.drawer.forEach(sub => sub.unsubscribe());
}
ngAfterViewInit(): void {
setTimeout(() => {
@ -51,23 +47,31 @@ export class BasicTableComponent implements AfterViewInit, OnDestroy, OnReuseDes
});
}
_onReuseDestroy(): void {
console.log(1);
// this.drawer.forEach(sub => sub.unsubscribe());
}
ngOnDestroy(): void {
this.drawer.forEach(sub => sub.unsubscribe());
this.searchDrawerService.unsubscribe();
}
openDrawer() {
if (this.drawer?.length > 0) {
console.log(this.sfValue);
if (this.searchDrawerService.drawer?.length > 0) {
this.searchDrawerService.create(this.sfValue, this.schema);
} else {
const drawer = this.searchDrawerService.create(this.sfValue, this.schema);
this.drawer.push(
this.searchDrawerService.drawer.push(
drawer.initEvent.subscribe((sf: SFComponent) => {
if (sf) {
this.sf = sf;
}
})
);
this.drawer.push(
this.searchDrawerService.drawer.push(
drawer.closeEvent.subscribe((res: Record<string, any>) => {
this.sfValue = res;
if (res) {