fix bug
This commit is contained in:
@ -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()
|
||||
}
|
||||
|
||||
@ -33,7 +33,9 @@ export class BusitableCurveComponent implements OnInit, OnChanges {
|
||||
}
|
||||
render(el: ElementRef<HTMLDivElement>): 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 {
|
||||
|
||||
@ -1 +0,0 @@
|
||||
<g2-custom delay="200" (render)="render($event)"></g2-custom>
|
||||
@ -1,56 +0,0 @@
|
||||
import { Component, ElementRef, Input, NgZone, OnChanges, OnInit, SimpleChanges, ViewChild } from '@angular/core';
|
||||
import { Chart } from '@antv/g2';
|
||||
import { DataService } from 'src/app/routes/datatable/services/data.service';
|
||||
@Component({
|
||||
selector: 'app-busitable-pillar',
|
||||
templateUrl: './pillar.component.html',
|
||||
styleUrls: ['./pillar.component.less']
|
||||
})
|
||||
export class BusitablePillarComponent implements OnInit, OnChanges {
|
||||
el: any;
|
||||
@Input() chartData: any;
|
||||
chart: any;
|
||||
constructor(private service: DataService, private ngZone: NgZone) {
|
||||
|
||||
}
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (this.chartData) {
|
||||
// setTimeout(()=>{
|
||||
// this.chart.render(true)
|
||||
// }, 1000)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
}
|
||||
reRender() {
|
||||
setTimeout(() => {
|
||||
this.chart.data(this.chartData);
|
||||
this.chart.render();
|
||||
}, 500)
|
||||
}
|
||||
render(el: ElementRef<HTMLDivElement>): void {
|
||||
this.el = el.nativeElement
|
||||
this.ngZone.runOutsideAngular(() => this.init(this.el));
|
||||
}
|
||||
|
||||
private init(el: HTMLElement): void {
|
||||
this.chart = new Chart({
|
||||
container: el,
|
||||
autoFit: true,
|
||||
height: 500,
|
||||
});
|
||||
|
||||
this.chart.data(this.chartData);
|
||||
|
||||
this.chart.tooltip({
|
||||
showMarkers: false,
|
||||
});
|
||||
|
||||
this.chart.interval().position('time*number');
|
||||
this.chart.render();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user