diff --git a/src/app/layout/pro/components/menu/menu.component.ts b/src/app/layout/pro/components/menu/menu.component.ts index 06d338fe..b26cf8ae 100644 --- a/src/app/layout/pro/components/menu/menu.component.ts +++ b/src/app/layout/pro/components/menu/menu.component.ts @@ -3,6 +3,7 @@ import { NavigationEnd, Router } from '@angular/router'; import { ReuseTabService } from '@delon/abc/reuse-tab'; import { MenuService } from '@delon/theme'; import { InputBoolean } from '@delon/util'; +import { SearchDrawerService } from '@shared'; import { NzMenuModeType } from 'ng-zorro-antd/menu'; import { Subject } from 'rxjs'; import { filter, takeUntil } from 'rxjs/operators'; @@ -31,7 +32,8 @@ export class LayoutProMenuComponent implements OnInit, OnDestroy { private router: Router, public pro: BrandService, private cdr: ChangeDetectorRef, - private reuseService: ReuseTabService + private reuseService: ReuseTabService, + private searchDrawerService: SearchDrawerService ) {} private cd(): void { @@ -132,6 +134,7 @@ export class LayoutProMenuComponent implements OnInit, OnDestroy { routeTo(link: string | undefined) { if (link) { this.reuseService.clear(); + this.searchDrawerService.unsubscribe(); this.router.navigate([link]); } } diff --git a/src/app/routes/commom/components/basic-table/basic-table.component.ts b/src/app/routes/commom/components/basic-table/basic-table.component.ts index 011c8590..f58d7dde 100644 --- a/src/app/routes/commom/components/basic-table/basic-table.component.ts +++ b/src/app/routes/commom/components/basic-table/basic-table.component.ts @@ -30,15 +30,11 @@ export class BasicTableComponent implements AfterViewInit, OnDestroy, OnReuseDes sf!: SFComponent; sfValue: Record = {}; - 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) => { this.sfValue = res; if (res) { diff --git a/src/app/routes/ticket-management/components/etc-blacklist/etc-blacklist.component.ts b/src/app/routes/ticket-management/components/etc-blacklist/etc-blacklist.component.ts index d8b6406d..77f69e5b 100644 --- a/src/app/routes/ticket-management/components/etc-blacklist/etc-blacklist.component.ts +++ b/src/app/routes/ticket-management/components/etc-blacklist/etc-blacklist.component.ts @@ -67,8 +67,6 @@ export class ETCBlacklistComponent extends BasicTableComponent { item.isActived = !item.isActived; // this.st.load(1); this.st.resetColumns(); - console.log(this.st); - }, 500); } diff --git a/src/app/routes/usercenter/components/freight/enterprise-audit/enterprise-audit.component.html b/src/app/routes/usercenter/components/freight/enterprise-audit/enterprise-audit.component.html index 5e2b9238..ea77cea8 100644 --- a/src/app/routes/usercenter/components/freight/enterprise-audit/enterprise-audit.component.html +++ b/src/app/routes/usercenter/components/freight/enterprise-audit/enterprise-audit.component.html @@ -28,10 +28,44 @@
- - -
+ + + + + + + + + +
+ +
+ +

+
+
+
+
+ + + + + + + + +
+ +
+

+
+
+
+
+
@@ -41,23 +75,6 @@ [acl-ability]="['USERCENTER-FREIGHT-ENTERPRISE-export']"> 导出
- - - - - - - - -
- -
- -

-
-
-
diff --git a/src/app/routes/usercenter/components/freight/enterprise-audit/enterprise-audit.component.ts b/src/app/routes/usercenter/components/freight/enterprise-audit/enterprise-audit.component.ts index c204d864..a5299d7d 100644 --- a/src/app/routes/usercenter/components/freight/enterprise-audit/enterprise-audit.component.ts +++ b/src/app/routes/usercenter/components/freight/enterprise-audit/enterprise-audit.component.ts @@ -1,5 +1,5 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; -import { Router } from '@angular/router'; +import { ChangeDetectionStrategy, Component, OnInit, ViewChild } from '@angular/core'; +import { Router } from '@angular/router'; import { STChange, STColumn, STComponent, STData, STRequestOptions } from '@delon/abc/st'; import { SFComponent, SFDateWidgetSchema, SFSchema, SFUISchema } from '@delon/form'; import { SearchDrawerService } from '@shared'; @@ -11,13 +11,15 @@ import { AuditAdminComponent } from './audit-admin/audit-admin.component'; @Component({ selector: 'app-Freight-components-enterprise-audit', templateUrl: './enterprise-audit.component.html', - styleUrls: ['../../../../commom/less/commom-table.less'] + styleUrls: ['../../../../commom/less/commom-table.less'], + changeDetection: ChangeDetectionStrategy.OnPush }) export class FreightComponentsEnterpriseAuditComponent extends BasicTableComponent implements OnInit { enterColumns: STColumn[] = this.initEnterST(); adminColumns: STColumn[] = this.initAdminST(); schema = this.initSF(); - @ViewChild('st', { static: false }) st!: STComponent; + @ViewChild('entst', { static: false }) entst!: STComponent; + @ViewChild('adminst', { static: false }) adminst!: STComponent; tabType = 1; tabs = [ { @@ -44,6 +46,7 @@ export class FreightComponentsEnterpriseAuditComponent extends BasicTableCompone networkTransporter = null; roleId = null; customerServiceId = null; + deviationHeight = 30; constructor( public service: UsermanageService, private router: Router, @@ -54,7 +57,11 @@ export class FreightComponentsEnterpriseAuditComponent extends BasicTableCompone } search() { - this.st?.load(1); + if (this.tabType === 1) { + this.entst?.load(1); + } else { + this.adminst?.load(1); + } } beforeReq = (requestOptions: STRequestOptions) => { @@ -205,7 +212,7 @@ export class FreightComponentsEnterpriseAuditComponent extends BasicTableCompone if (res) { this.service.msgSrv.success(status === 20 ? '审核通过' : '驳回成功'); } - this.st.load(1); + this.entst.load(1); }); } @@ -214,13 +221,14 @@ export class FreightComponentsEnterpriseAuditComponent extends BasicTableCompone } // 切换Tab - changeTab(item: any) { - this.tabType = item.type; - this.sf?.reset(); - this.st.data = this.tabType === 1 ? this.service.$api_get_freight_list : this.service.$api_get_enterprise_admin_list; - setTimeout(() => { - this.st.load(1); - }, 100); + changeTab(type: number) { + this.tabType = type; + if (this.tabType === 1) { + this.schema = this.initSF(); + } else { + this.schema = this.initAdminSF(); + } + this.search(); } private adminAuditUser(params: any, modal: any) { @@ -228,7 +236,7 @@ export class FreightComponentsEnterpriseAuditComponent extends BasicTableCompone if (res) { this.service.msgSrv.success('审核成功'); modal.destroy(); - this.st.load(1); + this.adminst.load(1); } }); } @@ -507,4 +515,48 @@ export class FreightComponentsEnterpriseAuditComponent extends BasicTableCompone } }; } + + initAdminSF(): SFSchema { + return { + properties: { + enterpriseName: { + title: '企业名称', + type: 'string', + ui: { + placeholder: '请输入' + } + }, + contactName: { + title: '管理员', + type: 'string', + ui: { + placeholder: '请输入' + } + }, + mobile: { + title: '手机号', + type: 'string', + maxLength: 11, + ui: { + placeholder: '请输入' + } + }, + approvalStatus: { + type: 'string', + title: '审核状态', + enum: [ + { label: '全部', value: '' }, + { label: '待审核', value: 10 }, + { label: '已撤销', value: 15 }, + { label: '已成功', value: 20 }, + { label: '审核失败', value: 30 } + ], + default: '', + ui: { + widget: 'select' + } + } + } + }; + } } diff --git a/src/app/shared/components/search-drawer/search-drawer.service.ts b/src/app/shared/components/search-drawer/search-drawer.service.ts index 6201c006..4e9ad19b 100644 --- a/src/app/shared/components/search-drawer/search-drawer.service.ts +++ b/src/app/shared/components/search-drawer/search-drawer.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { SFComponent, SFSchema, SFUISchema } from '@delon/form'; -import { Subject } from 'rxjs'; +import { Subject, Subscription } from 'rxjs'; @Injectable({ providedIn: 'root' @@ -11,10 +11,16 @@ export class SearchDrawerService { initEvent = new Subject(); visible = false; + + drawer: Subscription[] = []; constructor() {} create(defaultValue: Record, newSchema?: SFSchema, newUI?: SFUISchema) { this.createEvent.next({ defaultValue, newSchema, newUI }); return this; } + + unsubscribe() { + this.drawer.forEach(sub => sub.unsubscribe()); + } }