From 7933b1ad54a2bb22fb4a22f9b4ce29b7229efacd Mon Sep 17 00:00:00 2001 From: Lingzi Date: Sat, 2 Apr 2022 18:02:29 +0800 Subject: [PATCH] fix bug --- proxy.conf.js | 4 +- .../busiindex/busiindex.component.ts | 16 +++--- .../busiindex/curve/curve.component.ts | 4 +- .../mantable/mantable.component.html | 1 + .../busitable/mantable/mantable.component.ts | 53 ++++++++++++++----- .../pillar/pillar.component.html | 0 .../pillar/pillar.component.less | 0 .../pillar/pillar.component.ts | 0 .../compliance/index/index.component.ts | 3 ++ .../customindex/customindex.component.html | 4 +- .../customindex/customindex.component.ts | 46 ++++++++++++---- .../customtable/driver/driver.component.ts | 3 ++ .../customtable/owner/owner.component.ts | 3 ++ .../financetable/financetable.component.ts | 3 ++ .../operationtable/curve/curve.component.ts | 4 +- .../operationtable.component.html | 2 +- .../operationtable.component.ts | 17 +++--- .../operationtable/pillar/pillar.component.ts | 7 ++- src/app/routes/datatable/datatable.module.ts | 2 +- .../routes/partner/partner-routing.module.ts | 2 +- 20 files changed, 126 insertions(+), 48 deletions(-) rename src/app/routes/datatable/components/busitable/{busiindex => }/pillar/pillar.component.html (100%) rename src/app/routes/datatable/components/busitable/{busiindex => }/pillar/pillar.component.less (100%) rename src/app/routes/datatable/components/busitable/{busiindex => }/pillar/pillar.component.ts (100%) diff --git a/proxy.conf.js b/proxy.conf.js index c4946471..fe30b24d 100644 --- a/proxy.conf.js +++ b/proxy.conf.js @@ -20,7 +20,7 @@ module.exports = { // } '//api': { target: { - host: 'tms-api-test.eascs.com', + host: 'tms-api-dev.eascs.com', protocol: 'https:', port: 443 }, @@ -30,7 +30,7 @@ module.exports = { }, '//sascs': { target: { - host: 'sascs-tj-tms-test.obs.cn-south-1.myhuaweicloud.com', + host: 'sascs-tj-tms-dev.obs.cn-south-1.myhuaweicloud.com', protocol: 'https:', port: 443 }, diff --git a/src/app/routes/datatable/components/busitable/busiindex/busiindex.component.ts b/src/app/routes/datatable/components/busitable/busiindex/busiindex.component.ts index 2a15b70e..b413661d 100644 --- a/src/app/routes/datatable/components/busitable/busiindex/busiindex.component.ts +++ b/src/app/routes/datatable/components/busitable/busiindex/busiindex.component.ts @@ -1,10 +1,9 @@ -import { Component, ElementRef, OnInit, ViewChild, NgZone } from '@angular/core'; +import { Component, OnInit, ViewChild, NgZone } from '@angular/core'; import { STColumn, STComponent } from '@delon/abc/st'; import { DatePipe, _HttpClient } from '@delon/theme'; import { differenceInCalendarDays } from 'date-fns'; import { DataService } from '../../../services/data.service'; -import { Chart } from '@antv/g2'; -import { BusitablePillarComponent } from './pillar/pillar.component'; +import { BusitablePillarComponent } from '../pillar/pillar.component'; import { BusitableCurveComponent } from './curve/curve.component'; @Component({ @@ -36,11 +35,11 @@ export class DatatableBusiindexComponent implements OnInit { { title: '合伙人数', index: 'partnerNumber', className: 'text-center' }, { title: '客户数', index: 'enterpriseNumbe', className: 'text-center' }, { title: '订单数', index: 'zsl', className: 'text-center' }, - { title: '客户预存款', index: 'czcgje', className: 'text-center' }, + { title: '客户预存款', index: 'czcgje', className: 'text-right', type: 'widget', widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.czcgje }) } }, { title: '业绩量', index: 'yisje', className: 'text-center' }, - { title: '已收附加费', index: 'yisfjf', className: 'text-center' }, + { title: '已收附加费', index: 'yisfjf', className: 'text-right', type: 'widget', widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.yisfjf }) } }, { title: '平均附加费率', index: 'fjfl', className: 'text-center' }, - { title: '已开票金额', index: 'ykpje', className: 'text-center' } + { title: '已开票金额', index: 'ykpje', className: 'text-right', type: 'widget', widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.ykpje }) } }, ]; /** * 查询参数 @@ -119,11 +118,16 @@ export class DatatableBusiindexComponent implements OnInit { } } onChangeNext(result: any) { + if(result === null) { + return + } if(this.mode === 'year') { this.timeNext = [this.datePipe.transform(this.dateNext, 'yyyy') + '-01-01 00:00:00'] } else if(this.mode === 'month') { this.timeNext = [this.datePipe.transform(this.dateNext, 'yyyy-MM') + '-01 00:00:00'] } + + this.flag = true this.initData() } diff --git a/src/app/routes/datatable/components/busitable/busiindex/curve/curve.component.ts b/src/app/routes/datatable/components/busitable/busiindex/curve/curve.component.ts index 70fd0aad..62220b3d 100644 --- a/src/app/routes/datatable/components/busitable/busiindex/curve/curve.component.ts +++ b/src/app/routes/datatable/components/busitable/busiindex/curve/curve.component.ts @@ -33,7 +33,9 @@ export class BusitableCurveComponent implements OnInit, OnChanges { } render(el: ElementRef): void { this.el = el.nativeElement - this.ngZone.runOutsideAngular(() => this.init(this.el)); + if(!this.service.http.loading){ + this.ngZone.runOutsideAngular(() => this.init(this.el)); + } } private init(el: HTMLElement): void { diff --git a/src/app/routes/datatable/components/busitable/mantable/mantable.component.html b/src/app/routes/datatable/components/busitable/mantable/mantable.component.html index f27c532e..d6117749 100644 --- a/src/app/routes/datatable/components/busitable/mantable/mantable.component.html +++ b/src/app/routes/datatable/components/busitable/mantable/mantable.component.html @@ -38,4 +38,5 @@ + \ No newline at end of file diff --git a/src/app/routes/datatable/components/busitable/mantable/mantable.component.ts b/src/app/routes/datatable/components/busitable/mantable/mantable.component.ts index 61eec620..6e847a3d 100644 --- a/src/app/routes/datatable/components/busitable/mantable/mantable.component.ts +++ b/src/app/routes/datatable/components/busitable/mantable/mantable.component.ts @@ -3,6 +3,7 @@ import { STColumn, STComponent } from '@delon/abc/st'; import { DatePipe, _HttpClient } from '@delon/theme'; import { differenceInCalendarDays } from 'date-fns'; import { DataService } from '../../../services/data.service'; +import { BusitablePillarComponent } from '../pillar/pillar.component'; @Component({ selector: 'app-datatable-mantable', @@ -12,6 +13,7 @@ import { DataService } from '../../../services/data.service'; }) export class DatatableMantableComponent implements OnInit { + @ViewChild('pillar') private readonly pillar!: BusitablePillarComponent; @ViewChild('st') private readonly st!: STComponent; type = 1; mode = 'year'; @@ -22,21 +24,23 @@ export class DatatableMantableComponent implements OnInit { today = new Date(); dateNext: any = null; modeNext = 'year'; + chartData: any = {} timeNext: any = ['2022-01-01 00:00:00'] + flag = false; columns: STColumn[] = [ - { title: '部门', index: 'networkTransporterName', className: 'text-center' }, - { title: '业务员', index: 'zsl', className: 'text-center' }, - { title: '合伙人数', index: 'yingsje', className: 'text-center' }, - { title: '客户数', index: 'cys', className: 'text-center' }, - { title: '客户活跃率', index: 'yingfyf', className: 'text-center' }, - { title: '客户预存款', index: 'yl', className: 'text-center' }, - { title: '订单数', index: 'djd', className: 'text-center' }, - { title: '订单金额', index: 'ysz', className: 'text-center' }, - { title: '业绩量', index: 'yswc', className: 'text-center' }, - { title: '附加费金额', index: 'yisje', className: 'text-center' }, - { title: '平均附加费率', index: 'yifyf', className: 'text-center' }, - { title: '已开票金额', index: 'yifyf', className: 'text-center' } + { title: '部门', index: 'bm', className: 'text-center' }, + { title: '业务员', index: 'ywy', className: 'text-center' }, + { title: '合伙人数', index: 'hhrs', className: 'text-center' }, + { title: '客户数', index: 'khs', className: 'text-center' }, + { title: '客户活跃率', index: 'khhyl', className: 'text-center' }, + { title: '客户预存款', index: 'kfyck', className: 'text-center', type: 'widget', widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.kfyck }) } }, + { title: '订单数', index: 'dds', className: 'text-center' }, + { title: '订单金额', index: 'ddje', className: 'text-center', type: 'widget', widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.ddje }) } }, + { title: '业绩量', index: 'yjl', className: 'text-center' }, + { title: '附加费金额', index: 'fjfje', className: 'text-center', type: 'widget', widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.fjfje }) } }, + { title: '平均附加费率', index: 'pjfjl', className: 'text-center' }, + { title: '已开票金额', index: 'ykpje', className: 'text-center', type: 'widget', widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.ykpje }) } }, ]; /** * 查询参数 @@ -63,6 +67,26 @@ export class DatatableMantableComponent implements OnInit { constructor(public service: DataService, private datePipe: DatePipe) { } ngOnInit(): void { } + initData(){ + let type = 1 + if(this.mode === 'year') { + type = 1 + } else if(this.mode === 'month') { + type = 2 + } + const params: any = { + time: this.timeNext, + type + }; + this.service.request(this.service.$api_performanceReportHistogram, params).subscribe(res => { + if (res) { + this.chartData = res + if(this.flag) { + this.pillar.reRender() + } + } + }) + } changeData(){ if(this.mode === 'year') { this.dateFormat = 'yyyy' @@ -93,11 +117,16 @@ export class DatatableMantableComponent implements OnInit { } } onChangeNext(result: any) { + if(result === null) { + return + } if(this.mode === 'year') { this.timeNext = [this.datePipe.transform(this.dateNext, 'yyyy') + '-01-01 00:00:00'] } else if(this.mode === 'month') { this.timeNext = [this.datePipe.transform(this.dateNext, 'yyyy-MM') + '-01 00:00:00'] } + this.flag = true + this.initData() } disabledDate = (current: Date): boolean => // Can not select days before today and today diff --git a/src/app/routes/datatable/components/busitable/busiindex/pillar/pillar.component.html b/src/app/routes/datatable/components/busitable/pillar/pillar.component.html similarity index 100% rename from src/app/routes/datatable/components/busitable/busiindex/pillar/pillar.component.html rename to src/app/routes/datatable/components/busitable/pillar/pillar.component.html diff --git a/src/app/routes/datatable/components/busitable/busiindex/pillar/pillar.component.less b/src/app/routes/datatable/components/busitable/pillar/pillar.component.less similarity index 100% rename from src/app/routes/datatable/components/busitable/busiindex/pillar/pillar.component.less rename to src/app/routes/datatable/components/busitable/pillar/pillar.component.less diff --git a/src/app/routes/datatable/components/busitable/busiindex/pillar/pillar.component.ts b/src/app/routes/datatable/components/busitable/pillar/pillar.component.ts similarity index 100% rename from src/app/routes/datatable/components/busitable/busiindex/pillar/pillar.component.ts rename to src/app/routes/datatable/components/busitable/pillar/pillar.component.ts diff --git a/src/app/routes/datatable/components/compliance/index/index.component.ts b/src/app/routes/datatable/components/compliance/index/index.component.ts index 97ab6b2b..b545a4f5 100644 --- a/src/app/routes/datatable/components/compliance/index/index.component.ts +++ b/src/app/routes/datatable/components/compliance/index/index.component.ts @@ -91,6 +91,9 @@ export class DatatableComplianceIndexComponent implements OnInit { } onChange(result: any) { + if(result === null) { + return + } if(this.mode === 'year') { this.time = this.datePipe.transform(this.date, 'yyyy') } else if(this.mode === 'month') { diff --git a/src/app/routes/datatable/components/customtable/customindex/customindex.component.html b/src/app/routes/datatable/components/customtable/customindex/customindex.component.html index 336b018c..8816fdf1 100644 --- a/src/app/routes/datatable/components/customtable/customindex/customindex.component.html +++ b/src/app/routes/datatable/components/customtable/customindex/customindex.component.html @@ -42,10 +42,10 @@ [page]="{ show: true, showSize: true, pageSizes: [20, 50, 100] }" [loading]="service.http.loading"> - +
- + diff --git a/src/app/routes/datatable/components/customtable/customindex/customindex.component.ts b/src/app/routes/datatable/components/customtable/customindex/customindex.component.ts index a57fc908..8c2cccab 100644 --- a/src/app/routes/datatable/components/customtable/customindex/customindex.component.ts +++ b/src/app/routes/datatable/components/customtable/customindex/customindex.component.ts @@ -3,6 +3,7 @@ import { STColumn, STComponent } from '@delon/abc/st'; import { DatePipe, _HttpClient } from '@delon/theme'; import { differenceInCalendarDays } from 'date-fns'; import { DataService } from '../../../services/data.service'; +import { OperationCurveComponent } from '../../operationtable/curve/curve.component'; @Component({ selector: 'app-datatable-customindex', @@ -13,6 +14,7 @@ import { DataService } from '../../../services/data.service'; }) export class DatatableCustomindexComponent implements OnInit { @ViewChild('st') private readonly st!: STComponent; + @ViewChild('curve') private readonly curve!: OperationCurveComponent; type = 1; mode = 'year'; date: any = null; @@ -24,7 +26,8 @@ export class DatatableCustomindexComponent implements OnInit { modeNext = 'year'; timeNext: any = ['2022-01-01 00:00:00'] chartData: any; - + flag = false; + columns: STColumn[] = [ { title: '用户类型', index: 'networkTransporterName', className: 'text-center' }, @@ -59,7 +62,30 @@ export class DatatableCustomindexComponent implements OnInit { } constructor(public service: DataService, private datePipe: DatePipe) { } - ngOnInit(): void { } + ngOnInit(): void { + this.initCurveData() + } + initCurveData() { + let type = 1 + if (this.mode === 'year') { + type = 1 + } else if (this.mode === 'month') { + type = 2 + } + const params: any = { + time: this.timeNext, + type + }; + this.flag = true + this.service.request(this.service.$api_operationalReportHistogram, params).subscribe(res => { + if (res) { + this.chartData = res + if (this.flag) { + this.curve.reRender() + } + } + }) + } changeData() { if (this.mode === 'year') { @@ -86,22 +112,24 @@ export class DatatableCustomindexComponent implements OnInit { // Can not select days before today and today differenceInCalendarDays(current, this.today) > 0; + changeDataNext() { - if (this.mode === 'year') { + if(this.mode === 'year') { this.dateFormat = 'yyyy' - } else if (this.mode === 'month') { + } else if(this.mode === 'month') { this.dateFormat = 'yyyy-MM' } } onChangeNext(result: any) { - if (this.mode === 'year') { + if(result === null) { + return + } + if(this.mode === 'year') { this.timeNext = [this.datePipe.transform(this.dateNext, 'yyyy') + '-01-01 00:00:00'] - } else if (this.mode === 'month') { + } else if(this.mode === 'month') { this.timeNext = [this.datePipe.transform(this.dateNext, 'yyyy-MM') + '-01 00:00:00'] } - } - exportFun() { - + this.initCurveData() } } diff --git a/src/app/routes/datatable/components/customtable/driver/driver.component.ts b/src/app/routes/datatable/components/customtable/driver/driver.component.ts index efb5bb8a..330ac567 100644 --- a/src/app/routes/datatable/components/customtable/driver/driver.component.ts +++ b/src/app/routes/datatable/components/customtable/driver/driver.component.ts @@ -127,6 +127,9 @@ export class DatatableDriverComponent implements OnInit { } } onChange(result: any) { + if(result === null) { + return + } if (this.mode === 'year') { this.queryTime = [this.datePipe.transform(this.date, 'yyyy')] } else if (this.mode === 'month') { diff --git a/src/app/routes/datatable/components/customtable/owner/owner.component.ts b/src/app/routes/datatable/components/customtable/owner/owner.component.ts index 578fc8bb..73833dff 100644 --- a/src/app/routes/datatable/components/customtable/owner/owner.component.ts +++ b/src/app/routes/datatable/components/customtable/owner/owner.component.ts @@ -146,6 +146,9 @@ export class DatatableOwnerComponent implements OnInit { } } onChange(result: any) { + if(result === null) { + return + } if(this.mode === 'year') { this.time = [this.datePipe.transform(this.date, 'yyyy') + '-01-01 00:00:00'] } else if(this.mode === 'month') { diff --git a/src/app/routes/datatable/components/financetable/financetable.component.ts b/src/app/routes/datatable/components/financetable/financetable.component.ts index 92464349..a5eb59de 100644 --- a/src/app/routes/datatable/components/financetable/financetable.component.ts +++ b/src/app/routes/datatable/components/financetable/financetable.component.ts @@ -145,6 +145,9 @@ export class DatatableFinancetableComponent implements OnInit { } } onChangeNext(result: any) { + if(result === null) { + return + } if(this.mode === 'year') { this.timeNext = [this.datePipe.transform(this.dateNext, 'yyyy') + '-01-01 00:00:00'] } else if(this.mode === 'month') { diff --git a/src/app/routes/datatable/components/operationtable/curve/curve.component.ts b/src/app/routes/datatable/components/operationtable/curve/curve.component.ts index 44a3a28e..ce105bbc 100644 --- a/src/app/routes/datatable/components/operationtable/curve/curve.component.ts +++ b/src/app/routes/datatable/components/operationtable/curve/curve.component.ts @@ -33,9 +33,9 @@ export class OperationCurveComponent implements OnInit, OnChanges { } render(el: ElementRef): void { this.el = el.nativeElement - setTimeout(() => { + if(!this.service.http.loading){ this.ngZone.runOutsideAngular(() => this.init(this.el)); - }, 1000) + } } private init(el: HTMLElement): void { diff --git a/src/app/routes/datatable/components/operationtable/operationtable.component.html b/src/app/routes/datatable/components/operationtable/operationtable.component.html index 532ed1b3..bb830dfa 100644 --- a/src/app/routes/datatable/components/operationtable/operationtable.component.html +++ b/src/app/routes/datatable/components/operationtable/operationtable.component.html @@ -28,7 +28,7 @@
- +
diff --git a/src/app/routes/datatable/components/operationtable/operationtable.component.ts b/src/app/routes/datatable/components/operationtable/operationtable.component.ts index e94ec542..bce8f525 100644 --- a/src/app/routes/datatable/components/operationtable/operationtable.component.ts +++ b/src/app/routes/datatable/components/operationtable/operationtable.component.ts @@ -31,19 +31,19 @@ export class DatatableOperationtableComponent implements OnInit { interManlist: any = [] chartData: any = {} - flag = false; + flag: boolean = false; columns: STColumn[] = [ { title: '运营主体', index: 'networkTransporterName', className: 'text-center' }, { title: '订单数', index: 'zsl', className: 'text-center' }, - { title: '应收金额', index: 'yingsje', className: 'text-center' }, + { title: '应收金额', index: 'yingsje', className: 'text-center', type: 'widget', widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.yingsje }) } }, { title: '承运数', index: 'cys', className: 'text-center' }, - { title: '应付运费', index: 'yingfyf', className: 'text-center' }, + { title: '应付运费', index: 'yingfyf', className: 'text-center', type: 'widget', widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.yingfyf }) } }, { title: '运量(吨)', index: 'yl', className: 'text-center' }, { title: '待接单数', index: 'djd', className: 'text-center' }, { title: '在途数', index: 'ysz', className: 'text-center' }, { title: '运输完成', index: 'yswc', className: 'text-center' }, - { title: '已收金额', index: 'yisje', className: 'text-center' }, - { title: '已付运费', index: 'yifyf', className: 'text-center' } + { title: '已收金额', index: 'yisje', className: 'text-center', type: 'widget', widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.yisje }) } }, + { title: '已付运费', index: 'yifyf', className: 'text-center', type: 'widget', widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.yifyf }) } }, ]; /** * 查询参数 @@ -72,7 +72,7 @@ export class DatatableOperationtableComponent implements OnInit { this.initData() this.initPillarData() } - initPillarData(){ + initPillarData(flag?: boolean){ let type = 1 if(this.mode === 'year') { type = 1 @@ -84,7 +84,7 @@ export class DatatableOperationtableComponent implements OnInit { type, enterpriseInfoId: this.enterpriseInfoId }; - this.flag = true + this.flag = flag ? flag : false this.service.request(this.service.$api_operationalReportHistogram, params).subscribe(res => { if (res) { this.chartData = res @@ -144,6 +144,9 @@ export class DatatableOperationtableComponent implements OnInit { } } onChangeNext(result: any) { + if(result === null) { + return + } if(this.mode === 'year') { this.timeNext = [this.datePipe.transform(this.dateNext, 'yyyy') + '-01-01 00:00:00'] } else if(this.mode === 'month') { diff --git a/src/app/routes/datatable/components/operationtable/pillar/pillar.component.ts b/src/app/routes/datatable/components/operationtable/pillar/pillar.component.ts index 54a3b4d4..3f056a81 100644 --- a/src/app/routes/datatable/components/operationtable/pillar/pillar.component.ts +++ b/src/app/routes/datatable/components/operationtable/pillar/pillar.component.ts @@ -28,15 +28,14 @@ export class OperationPillarComponent implements OnInit, OnChanges { reRender() { setTimeout(() => { this.chart.data(this.chartData); - console.log(this.chartData) this.chart.render(); }, 1000) } render(el: ElementRef): void { this.el = el.nativeElement - setTimeout(() => { - this.ngZone.runOutsideAngular(() => this.init(this.el)); - },1000) + if(!this.service.http.loading){ + this.ngZone.runOutsideAngular(() => this.init(this.el)); + } } private init(el: HTMLElement): void { diff --git a/src/app/routes/datatable/datatable.module.ts b/src/app/routes/datatable/datatable.module.ts index 1e5c3d6e..8a679d45 100644 --- a/src/app/routes/datatable/datatable.module.ts +++ b/src/app/routes/datatable/datatable.module.ts @@ -20,7 +20,7 @@ import { DatatableMancustomtableComponent } from './components/customtable/mancu import { DatatablePartnertableComponent } from './components/customtable/partnertable/partnertable.component'; import { DatatableBusiindexComponent } from './components/busitable/busiindex/busiindex.component'; import { DatatableMantableComponent } from './components/busitable/mantable/mantable.component'; -import { BusitablePillarComponent } from './components/busitable/busiindex/pillar/pillar.component'; +import { BusitablePillarComponent } from './components/busitable/pillar/pillar.component'; import { DatatableReportingFundInfoComponent } from './reporting/components/fund-info/fund-info.component'; import { BusitableCurveComponent } from './components/busitable/busiindex/curve/curve.component'; import { OperationPillarComponent } from './components/operationtable/pillar/pillar.component'; diff --git a/src/app/routes/partner/partner-routing.module.ts b/src/app/routes/partner/partner-routing.module.ts index afcd8d41..8c979b66 100644 --- a/src/app/routes/partner/partner-routing.module.ts +++ b/src/app/routes/partner/partner-routing.module.ts @@ -130,7 +130,7 @@ const routes: Routes = [ ] }, { - path: 'scroll-img', + path: 'scrollimg', children: [ { path: '', component: ScrollImgComponentsListComponent }, { path: 'list', component: ScrollImgComponentsListComponent },