From c188d27792b5a3a2d50915d2ae9f0218af3af378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BD=98=E6=99=93=E4=BA=91?= Date: Wed, 11 May 2022 17:44:00 +0800 Subject: [PATCH 1/2] - --- .../dataindex/dataindex.component.html | 14 +++++----- .../dataindex/dataindex.component.ts | 26 +++++++++++-------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/app/routes/datatable/components/dataindex/dataindex.component.html b/src/app/routes/datatable/components/dataindex/dataindex.component.html index f30b8125..b3037220 100644 --- a/src/app/routes/datatable/components/dataindex/dataindex.component.html +++ b/src/app/routes/datatable/components/dataindex/dataindex.component.html @@ -1,5 +1,5 @@ @@ -75,12 +75,12 @@
- +
- + @@ -89,7 +89,7 @@
- + @@ -97,11 +97,11 @@
- +
-
\ No newline at end of file +
diff --git a/src/app/routes/datatable/components/dataindex/dataindex.component.ts b/src/app/routes/datatable/components/dataindex/dataindex.component.ts index d79f23d9..12562a13 100644 --- a/src/app/routes/datatable/components/dataindex/dataindex.component.ts +++ b/src/app/routes/datatable/components/dataindex/dataindex.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectorRef, Component, ElementRef, NgZone, OnInit, ViewChild } from '@angular/core'; +import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, NgZone, OnInit, ViewChild } from '@angular/core'; import { ModalHelper, _HttpClient } from '@delon/theme'; import { G2MiniAreaClickItem, G2MiniAreaData } from '@delon/chart/mini-area'; import { G2PieClickItem, G2PieComponent, G2PieData } from '@delon/chart/pie'; @@ -18,7 +18,7 @@ import { GeometryLabelCfg } from '@antv/g2/lib/interface'; styleUrls: ['./dataindex.component.less'], providers: [CurrencyPipe] }) -export class DatatableDataindexComponent implements OnInit { +export class DatatableDataindexComponent implements OnInit, AfterViewInit { @ViewChild('AdvanceDeposit', { static: false }) AdvanceDeposit!: G2CustomComponent; @ViewChild('g2custom', { static: false }) g2custom!: G2CustomComponent; @ViewChild('RegionalPerforman', { static: false }) RegionalPerforman!: G2CustomComponent; @@ -38,13 +38,16 @@ export class DatatableDataindexComponent implements OnInit { regionalPerformanceCompletion: DataPerformanceTrendVO[] = []; - constructor(private service: DataService, private currency: CurrencyPipe) {} - - ngOnInit(): void { + constructor(private service: DataService, private currency: CurrencyPipe) { } + ngAfterViewInit(): void { this.initMiniAreaData(); this.initOthersData(); } + ngOnInit(): void { + + } + private initMiniAreaData() { // 客户预存款总额 this.service.request(this.service.$api_total_advance_deposit).subscribe((res: DataTotalVO) => { @@ -79,8 +82,8 @@ export class DatatableDataindexComponent implements OnInit { if (res) { const billTypeDatas2 = this.formatCoordinateData(res); console.log(billTypeDatas2); - - this.initBillChart(this.g2custom['el'].nativeElement as any,billTypeDatas2); + + this.initBillChart(this.g2custom['el'].nativeElement as any, billTypeDatas2); } }); // 大区业绩完成情况 @@ -101,7 +104,6 @@ export class DatatableDataindexComponent implements OnInit { if (res) { const billTypeDatas = this.formatCoordinateData(res.map((item: any) => ({ ...item, billType: item.wayBillType }))); console.log(billTypeDatas); - this.initBillChart(this.BillDirectProportion['el'].nativeElement as any, billTypeDatas); } }); @@ -145,7 +147,7 @@ export class DatatableDataindexComponent implements OnInit { chart.scale('percent', { formatter: val => { - val = (val * 100 ).toFixed(0)+ '%'; + val = (val * 100).toFixed(0) + '%'; return val; } }); @@ -202,7 +204,7 @@ export class DatatableDataindexComponent implements OnInit { .label('percent', percent => { return { content: data => { - return (percent * 100).toFixed(0)+`%`; + return (percent * 100).toFixed(0) + `%`; }, style: { fontSize: 14 } }; @@ -351,6 +353,8 @@ export class DatatableDataindexComponent implements OnInit { } return {}; }); + console.log(chart); + chart.render(); } @@ -503,7 +507,7 @@ export class DatatableDataindexComponent implements OnInit { }); }); console.log(rs); - + return rs; } From 28d701a941df8fa9ad0e9a3816fe8c1a21b77ebe Mon Sep 17 00:00:00 2001 From: Taric Xin Date: Wed, 11 May 2022 17:47:26 +0800 Subject: [PATCH 2/2] Optimize structure --- src/app/routes/datatable/datatable.module.ts | 2 +- .../regulatory-data/regulatory-data.module.ts | 2 +- src/app/routes/routes.module.ts | 5 ++--- .../tax-management/taxmanagement.module.ts | 2 +- src/app/shared/basic-module.module.ts | 12 ++++++++++ .../search-drawer/search-drawer.module.ts | 4 +++- src/app/shared/index.ts | 1 + src/app/shared/shared.module.ts | 22 ++++++++----------- src/app/shared/widget/st-widget.module.ts | 12 ++++++---- 9 files changed, 38 insertions(+), 24 deletions(-) create mode 100644 src/app/shared/basic-module.module.ts diff --git a/src/app/routes/datatable/datatable.module.ts b/src/app/routes/datatable/datatable.module.ts index 7a1fe2be..ed285076 100644 --- a/src/app/routes/datatable/datatable.module.ts +++ b/src/app/routes/datatable/datatable.module.ts @@ -86,7 +86,7 @@ const COMPONENTS: Type[] = [ imports: [ SharedModule, DatatableRoutingModule, - SHARED_G2_MODULES + ...SHARED_G2_MODULES ], declarations: COMPONENTS, }) diff --git a/src/app/routes/regulatory-data/regulatory-data.module.ts b/src/app/routes/regulatory-data/regulatory-data.module.ts index c76d3521..c8c090de 100644 --- a/src/app/routes/regulatory-data/regulatory-data.module.ts +++ b/src/app/routes/regulatory-data/regulatory-data.module.ts @@ -9,6 +9,6 @@ const COMPONENTS: any = [DashboardComponent]; const NOTROUTECOMPONENTS: any = []; @NgModule({ declarations: [...COMPONENTS, ...NOTROUTECOMPONENTS], - imports: [CommonModule, RegulatoryDataRoutingModule, SharedModule, SHARED_G2_MODULES] + imports: [CommonModule, RegulatoryDataRoutingModule, SharedModule, ...SHARED_G2_MODULES] }) export class RegulatoryDataModule {} diff --git a/src/app/routes/routes.module.ts b/src/app/routes/routes.module.ts index c3bc2114..89dd3a11 100644 --- a/src/app/routes/routes.module.ts +++ b/src/app/routes/routes.module.ts @@ -1,5 +1,5 @@ import { NgModule, Type } from '@angular/core'; -import { SharedModule, STWidgetModule } from '@shared'; +import { BasicModuleModule, SharedModule, STWidgetModule } from '@shared'; // dashboard pages import { DashboardComponent } from './dashboard/dashboard.component'; @@ -14,9 +14,8 @@ const COMPONENTS_NOROUNT: Array> = []; @NgModule({ imports: [ LayoutModule, - SharedModule, + BasicModuleModule, GlobalConfigModule.forRoot(), - STWidgetModule, RouteRoutingModule ], declarations: [...COMPONENTS, ...COMPONENTS_NOROUNT], diff --git a/src/app/routes/tax-management/taxmanagement.module.ts b/src/app/routes/tax-management/taxmanagement.module.ts index 342b7ae6..fef67141 100644 --- a/src/app/routes/tax-management/taxmanagement.module.ts +++ b/src/app/routes/tax-management/taxmanagement.module.ts @@ -35,7 +35,7 @@ const COMPONENTS: Type[] = [ imports: [ SharedModule, TaxManagementModuleRoutingModule, - SHARED_G2_MODULES + ...SHARED_G2_MODULES ], declarations: COMPONENTS, }) diff --git a/src/app/shared/basic-module.module.ts b/src/app/shared/basic-module.module.ts new file mode 100644 index 00000000..b6ddffcf --- /dev/null +++ b/src/app/shared/basic-module.module.ts @@ -0,0 +1,12 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { HttpClientModule } from '@angular/common/http'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { RouterModule } from '@angular/router'; + +@NgModule({ + declarations: [], + imports: [CommonModule, FormsModule, RouterModule, HttpClientModule, ReactiveFormsModule], + exports: [CommonModule, FormsModule, HttpClientModule, ReactiveFormsModule, RouterModule] +}) +export class BasicModuleModule {} diff --git a/src/app/shared/components/search-drawer/search-drawer.module.ts b/src/app/shared/components/search-drawer/search-drawer.module.ts index 08746cc8..fe146086 100644 --- a/src/app/shared/components/search-drawer/search-drawer.module.ts +++ b/src/app/shared/components/search-drawer/search-drawer.module.ts @@ -5,10 +5,12 @@ import { SHARED_ZORRO_MODULES } from '../../shared-zorro.module'; import { SearchDrawerComponent } from './search-drawer.component'; import { FormsModule } from '@angular/forms'; import { DelonACLModule } from '@delon/acl'; +import { DelonFormModule } from '@delon/form'; +import { STWidgetModule } from '../../widget/st-widget.module'; @NgModule({ declarations: [SearchDrawerComponent], - imports: [CommonModule, FormsModule, DelonACLModule, ...SHARED_DELON_MODULES, ...SHARED_ZORRO_MODULES], + imports: [CommonModule, FormsModule, DelonACLModule, DelonFormModule, STWidgetModule, ...SHARED_DELON_MODULES, ...SHARED_ZORRO_MODULES], exports: [SearchDrawerComponent] }) export class SearchDrawerModule {} diff --git a/src/app/shared/index.ts b/src/app/shared/index.ts index a4df14f5..dfdd3998 100644 --- a/src/app/shared/index.ts +++ b/src/app/shared/index.ts @@ -30,6 +30,7 @@ export * from './services'; export * from './pipes'; // Module +export * from './basic-module.module'; export * from './shared.module'; export * from './shared-delon.module'; export * from './shared-zorro.module'; diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 1cc91d9e..33aebea9 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -41,9 +41,11 @@ import { CaptchaModule } from './components/captcha'; import { rebateTableModule } from './components/rebate-table'; import { SearchDrawerModule } from './components/search-drawer'; import { HttpClientModule } from '@angular/common/http'; +import { BasicModuleModule } from './basic-module.module'; +import { STWidgetModule } from './widget/st-widget.module'; +import { GlobalConfigModule } from '../global-config.module'; // import { SearchDrawerComponent } from './components/search-drawer/search-drawer.component'; - const MODULES = [ AddressModule, DelayModule, @@ -60,20 +62,17 @@ const MODULES = [ rebateTableModule, CaptchaModule, SearchDrawerModule, - + ...PRO_SHARED_MODULES ]; // #endregion -const SHAREDCOMPONENTS = [LogisticsTimeLineComponent, DictSelectComponent, AccountDetailComponent]; +const SHAREDCOMPONENTS = [LogisticsTimeLineComponent, AccountDetailComponent]; @NgModule({ imports: [ - CommonModule, - FormsModule, - RouterModule, - HttpClientModule, - ReactiveFormsModule, + BasicModuleModule, + STWidgetModule, AlainThemeModule.forChild(), DelonACLModule, DelonFormModule, @@ -83,11 +82,8 @@ const SHAREDCOMPONENTS = [LogisticsTimeLineComponent, DictSelectComponent, Accou // third libs ], exports: [ - CommonModule, - FormsModule, - HttpClientModule, - ReactiveFormsModule, - RouterModule, + BasicModuleModule, + STWidgetModule, AlainThemeModule, DelonACLModule, DelonFormModule, diff --git a/src/app/shared/widget/st-widget.module.ts b/src/app/shared/widget/st-widget.module.ts index 9ffee436..5f118335 100644 --- a/src/app/shared/widget/st-widget.module.ts +++ b/src/app/shared/widget/st-widget.module.ts @@ -33,6 +33,9 @@ import { NounWidget } from './noun/noun.widget'; import { PropertyValuesWidget } from './property-values/property-values.widget'; import { SpecValuesWidget } from './spec-values/spec-values.widget'; import { TinymceWidget } from './tinymce/tinymce.widget'; +import { SHARED_ZORRO_MODULES } from '../shared-zorro.module'; +import { SharedThirdModule } from '../shared-third.module'; +import { DictSelectComponent } from '../components/dict-select/dict-select.component'; export const STWIDGET_COMPONENTS = [ EditorWidget, @@ -45,7 +48,8 @@ export const STWIDGET_COMPONENTS = [ PropertyValuesWidget, SLFromToSearchWidget, DictSelectWidget, - STCurrencyCHYWidget + STCurrencyCHYWidget, + DictSelectComponent, ]; @NgModule({ @@ -53,6 +57,8 @@ export const STWIDGET_COMPONENTS = [ imports: [ CommonModule, FormsModule, + ...SHARED_ZORRO_MODULES, + SharedThirdModule, DelonFormModule.forRoot(), AddressModule, EditorModule, @@ -63,8 +69,7 @@ export const STWIDGET_COMPONENTS = [ NzInputModule, NzDatePickerModule, NzInputNumberModule, - NgxTinymceModule, - SharedModule + NgxTinymceModule ], exports: [...STWIDGET_COMPONENTS], entryComponents: STWIDGET_COMPONENTS @@ -82,7 +87,6 @@ export class STWidgetModule { widgetRegistry.register(SLFromToSearchWidget.KEY, SLFromToSearchWidget); widgetRegistry.register(DictSelectWidget.KEY, DictSelectWidget); - sTWidgetRegistry.register(STCurrencyCHYWidget.KEY, STCurrencyCHYWidget); } }