This commit is contained in:
Lingzi
2022-04-02 18:02:29 +08:00
parent be8a1dafb9
commit 7933b1ad54
20 changed files with 126 additions and 48 deletions

View File

@ -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()
}

View File

@ -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 {

View File

@ -38,4 +38,5 @@
</div>
</div>
</ng-template>
<app-busitable-pillar #pillar [chartData]="chartData.performance"></app-busitable-pillar>
</nz-card>

View File

@ -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