This commit is contained in:
Lingzi
2022-03-31 19:21:24 +08:00
parent d34c9f21a8
commit 0fc8b927a1
25 changed files with 319 additions and 357 deletions

View File

@ -32,7 +32,7 @@
<label nz-radio-button nzValue="month"></label> <label nz-radio-button nzValue="month"></label>
</nz-radio-group> </nz-radio-group>
<div class="dateBox"> <div class="dateBox">
<nz-date-picker [(ngModel)]="dateNext" [nzDisabledDate]="disabledDate" [nzMode]="mode" (ngModelChange)="onChangeNext($event)"></nz-date-picker> <nz-date-picker [(ngModel)]="dateNext" [nzDisabledDate]="disabledDate" [nzMode]="modeNext" (ngModelChange)="onChangeNext($event)"></nz-date-picker>
</div> </div>
</div> </div>
</div> </div>
@ -43,9 +43,9 @@
<div class="title"> <div class="title">
<div class="box" style="background-color: #3ba1ff;"></div> 环比(%) <div class="box" style="background-color: #3ba1ff;"></div> 环比(%)
</div> </div>
<g2-custom delay="100" (render)="render($event)"></g2-custom> <!-- <g2-custom delay="100" (render)="render($event)"></g2-custom> -->
<!-- <app-busitable-curve></app-busitable-curve> --> <!-- <app-busitable-curve></app-busitable-curve> -->
<!-- <app-busitable-curve #curve [chartData]="chartData.chainRatio"></app-busitable-curve> --> <app-busitable-curve #curve [chartData]="chartData.chainRatio"></app-busitable-curve>
</div> </div>
<div nz-col class="gutter-row" [nzSpan]="12"> <div nz-col class="gutter-row" [nzSpan]="12">
<div class="title"> <div class="title">
@ -53,7 +53,6 @@
</div> </div>
<app-busitable-pillar #pillar [chartData]="chartData.performance"></app-busitable-pillar> <app-busitable-pillar #pillar [chartData]="chartData.performance"></app-busitable-pillar>
</div> </div>
</div> </div>
</nz-card> </nz-card>

View File

@ -4,7 +4,8 @@ import { DatePipe, _HttpClient } from '@delon/theme';
import { differenceInCalendarDays } from 'date-fns'; import { differenceInCalendarDays } from 'date-fns';
import { DataService } from '../../../services/data.service'; import { DataService } from '../../../services/data.service';
import { Chart } from '@antv/g2'; import { Chart } from '@antv/g2';
import { BusitableCurveComponent } from './curve2/curve.component'; import { BusitablePillarComponent } from './pillar/pillar.component';
import { BusitableCurveComponent } from './curve/curve.component';
@Component({ @Component({
selector: 'app-datatable-busiindex', selector: 'app-datatable-busiindex',
@ -16,6 +17,7 @@ import { BusitableCurveComponent } from './curve2/curve.component';
export class DatatableBusiindexComponent implements OnInit { export class DatatableBusiindexComponent implements OnInit {
@ViewChild('st') private readonly st!: STComponent; @ViewChild('st') private readonly st!: STComponent;
@ViewChild('curve') private readonly curve!: BusitableCurveComponent; @ViewChild('curve') private readonly curve!: BusitableCurveComponent;
@ViewChild('pillar') private readonly pillar!: BusitablePillarComponent;
type = 1; type = 1;
mode = 'year'; mode = 'year';
date: any = null; date: any = null;
@ -26,9 +28,8 @@ export class DatatableBusiindexComponent implements OnInit {
timeNext: any = ['2022-01-01 00:00:00'] timeNext: any = ['2022-01-01 00:00:00']
dateFormat = 'yyyy-MM-dd'; dateFormat = 'yyyy-MM-dd';
today = new Date(); today = new Date();
chainRatio: any = []
chartData: any = {} chartData: any = {}
el: any; flag = false;
columns: STColumn[] = [ columns: STColumn[] = [
{ title: '运营主体', index: 'networkTransporterName', className: 'text-center' }, { title: '运营主体', index: 'networkTransporterName', className: 'text-center' },
@ -80,12 +81,11 @@ export class DatatableBusiindexComponent implements OnInit {
}; };
this.service.request(this.service.$api_performanceReportHistogram, params).subscribe(res => { this.service.request(this.service.$api_performanceReportHistogram, params).subscribe(res => {
if (res) { if (res) {
this.chainRatio = res.chainRatio
this.chartData = res this.chartData = res
setTimeout(() => { if(this.flag) {
this.ngZone.runOutsideAngular(() => this.init(this.el)); this.pillar.reRender()
}, 1000); this.curve.reRender()
}
} }
}) })
} }
@ -124,6 +124,8 @@ export class DatatableBusiindexComponent implements OnInit {
} else if(this.mode === 'month') { } else if(this.mode === 'month') {
this.timeNext = [this.datePipe.transform(this.dateNext, 'yyyy-MM') + '-01 00:00:00'] this.timeNext = [this.datePipe.transform(this.dateNext, 'yyyy-MM') + '-01 00:00:00']
} }
this.flag = true
this.initData()
} }
disabledDate = (current: Date): boolean => disabledDate = (current: Date): boolean =>
// Can not select days before today and today // Can not select days before today and today
@ -131,38 +133,4 @@ export class DatatableBusiindexComponent implements OnInit {
exportFun(){ exportFun(){
} }
render(el: ElementRef<HTMLDivElement>): void {
this.el = el.nativeElement
}
private init(el: HTMLElement): void {
const chart = new Chart({
container: el,
autoFit: true,
height: 500,
});
chart.data(this.chainRatio);
chart.scale({
year: {
range: [0, 1],
},
value: {
min: 0,
nice: true,
},
});
chart.tooltip({
showCrosshairs: true, // 展示 Tooltip 辅助线
shared: true,
});
chart.line().position('time*value').label('value');
chart.point().position('time*value');
chart.render();
}
} }

View File

@ -1 +1 @@
<g2-custom delay="100" (render)="render($event)"></g2-custom> <g2-custom delay="200" (render)="render($event)"></g2-custom>

View File

@ -1,6 +1,4 @@
import { Component, ElementRef, Input, NgZone, OnChanges, OnInit, SimpleChanges, ViewChild } from '@angular/core'; import { Component, ElementRef, Input, NgZone, OnChanges, OnInit, SimpleChanges, ViewChild } from '@angular/core';
import { G2MiniAreaClickItem } from '@delon/chart/mini-area';
import DataSet from '@antv/data-set';
import { Chart } from '@antv/g2'; import { Chart } from '@antv/g2';
import { DataService } from 'src/app/routes/datatable/services/data.service'; import { DataService } from 'src/app/routes/datatable/services/data.service';
@Component({ @Component({
@ -9,43 +7,44 @@ import { DataService } from 'src/app/routes/datatable/services/data.service';
styleUrls: ['./curve.component.less'] styleUrls: ['./curve.component.less']
}) })
export class BusitableCurveComponent implements OnInit, OnChanges { export class BusitableCurveComponent implements OnInit, OnChanges {
@Input() chartData: any;
el: any; el: any;
@Input() chartData: any;
chart: any;
constructor(private service: DataService, private ngZone: NgZone) { constructor(private service: DataService, private ngZone: NgZone) {
} }
ngOnChanges(changes: SimpleChanges): void {
if (this.chartData) {
// setTimeout(()=>{
// this.chart.render(true)
// }, 1000)
}
}
ngOnInit(): void { ngOnInit(): void {
} }
reRender() {
ngOnChanges(changes: SimpleChanges): void { setTimeout(() => {
if (this.chartData) { this.chart.data(this.chartData);
setTimeout(() => { this.chart.render();
this.ngZone.runOutsideAngular(() => this.init(this.el)); }, 500)
}, 2000)
}
} }
handleClick(data: G2MiniAreaClickItem): void {
this.service.msgSrv.info(`${data.item.x} - ${data.item.y}`);
}
render(el: ElementRef<HTMLDivElement>): void { render(el: ElementRef<HTMLDivElement>): void {
this.el = el.nativeElement this.el = el.nativeElement
// this.ngZone.runOutsideAngular(() => this.init(this.el)); this.ngZone.runOutsideAngular(() => this.init(this.el));
} }
private init(el: HTMLElement): void { private init(el: HTMLElement): void {
const chart = new Chart({ this.chart = new Chart({
container: el, container: el,
autoFit: true, autoFit: true,
height: 500, height: 500,
}); });
chart.data(this.chartData); this.chart.data(this.chartData);
chart.scale({ this.chart.scale({
year: { year: {
range: [0, 1], range: [0, 1],
}, },
@ -55,15 +54,15 @@ export class BusitableCurveComponent implements OnInit, OnChanges {
}, },
}); });
chart.tooltip({ this.chart.tooltip({
showCrosshairs: true, // 展示 Tooltip 辅助线 showCrosshairs: true, // 展示 Tooltip 辅助线
shared: true, shared: true,
}); });
chart.line().position('time*value').label('value'); this.chart.line().position('time*value').label('value');
chart.point().position('time*value'); this.chart.point().position('time*value');
chart.render(); this.chart.render();
} }
} }

View File

@ -1,92 +0,0 @@
import { Component, ElementRef, Input, NgZone, OnChanges, OnInit, SimpleChanges, ViewChild } from '@angular/core';
import { G2MiniAreaClickItem } from '@delon/chart/mini-area';
import DataSet from '@antv/data-set';
import { Chart } from '@antv/g2';
import { DataService } from 'src/app/routes/datatable/services/data.service';
@Component({
selector: 'app-busitable-curve',
templateUrl: './curve.component.html',
styleUrls: ['./curve.component.less']
})
export class BusitableCurveComponent implements OnInit, OnChanges {
@Input() chartData: any ;
el: any;
constructor(private service: DataService, private ngZone: NgZone) {
}
ngOnChanges(changes: SimpleChanges): void {
if(this.chartData){
setTimeout(()=>{
this.ngZone.runOutsideAngular(() => this.init(this.el));
}, 3000)
}
}
ngOnInit(): void {
this.initData()
}
initData(){
this.service.request(this.service.$api_operationalReportWaybillStatusDistribution).subscribe(res => {
if (res) {
this.chartData = res
this.ngZone.runOutsideAngular(() => this.init(this.el));
}
})
}
render(el: ElementRef<HTMLDivElement>): void {
this.el = el.nativeElement
}
private init(el: HTMLElement): void {
const ds = new DataSet();
const dv = ds.createView().source(this.chartData);
dv.transform({
type: 'map',
callback: row => {
row.year = parseInt(row.year, 10);
return row;
}
}).transform({
type: 'regression',
method: 'polynomial',
fields: ['year', 'value'],
bandwidth: 0.1,
as: ['Year', 'Value']
});
const chart = new Chart({
container: el,
autoFit: true,
height: 500,
padding: [20, 40],
});
const view1 = chart.createView();
view1.data(this.chartData);
view1.scale('price', {
nice: true,
});
view1.tooltip({
showMarkers: false,
shared: true,
});
view1
.interval()
.position('month*price')
.color('name')
.adjust([
{
type: 'dodge',
marginRatio: 0,
},
]);
// chart.interaction('active-region');
chart.render();
}
}

View File

@ -1 +1 @@
<g2-custom delay="100" (render)="render($event)"></g2-custom> <g2-custom delay="200" (render)="render($event)"></g2-custom>

View File

@ -7,48 +7,50 @@ import { DataService } from 'src/app/routes/datatable/services/data.service';
styleUrls: ['./pillar.component.less'] styleUrls: ['./pillar.component.less']
}) })
export class BusitablePillarComponent implements OnInit, OnChanges { export class BusitablePillarComponent implements OnInit, OnChanges {
el: any; el: any;
@Input() chartData: any ; @Input() chartData: any;
chart: any;
constructor(private service: DataService, private ngZone: NgZone) { constructor(private service: DataService, private ngZone: NgZone) {
} }
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(changes: SimpleChanges): void {
if(this.chartData){ if (this.chartData) {
setTimeout(()=>{ // setTimeout(()=>{
this.ngZone.runOutsideAngular(() => this.init(this.el)); // this.chart.render(true)
}, 1000) // }, 1000)
} }
} }
ngOnInit(): void { ngOnInit(): void {
}
reRender() {
setTimeout(() => {
this.chart.data(this.chartData);
this.chart.render();
}, 500)
} }
render(el: ElementRef<HTMLDivElement>): void { render(el: ElementRef<HTMLDivElement>): void {
this.el = el.nativeElement this.el = el.nativeElement
this.ngZone.runOutsideAngular(() => this.init(this.el));
} }
private init(el: HTMLElement): void { private init(el: HTMLElement): void {
const chart = new Chart({ this.chart = new Chart({
container: el, container: el,
autoFit: true, autoFit: true,
height: 500, height: 500,
}); });
chart.data(this.chartData);
chart.tooltip({ this.chart.data(this.chartData);
this.chart.tooltip({
showMarkers: false, showMarkers: false,
}); });
chart.interval().position('time*number'); this.chart.interval().position('time*number');
this.chart.render();
chart.interaction('element-active');
chart.render();
} }
} }

View File

@ -38,5 +38,4 @@
</div> </div>
</div> </div>
</ng-template> </ng-template>
<app-datatable-curve></app-datatable-curve>
</nz-card> </nz-card>

View File

@ -55,5 +55,4 @@
</div> </div>
</div> </div>
</ng-template> </ng-template>
<app-datatable-curve></app-datatable-curve>
</nz-card> </nz-card>

View File

@ -23,6 +23,7 @@ export class DatatableCustomindexComponent implements OnInit {
dateNext: any = null; dateNext: any = null;
modeNext = 'year'; modeNext = 'year';
timeNext: any = ['2022-01-01 00:00:00'] timeNext: any = ['2022-01-01 00:00:00']
columns: STColumn[] = [ columns: STColumn[] = [
{ title: '用户类型', index: 'networkTransporterName', className: 'text-center' }, { title: '用户类型', index: 'networkTransporterName', className: 'text-center' },

View File

@ -52,7 +52,8 @@ export class DatatableDriverComponent implements OnInit {
} }
let params: any = { let params: any = {
time: this.time, time: this.time,
type: this.type type: this.type,
...this.sf?.value
}; };
delete params._$expand; delete params._$expand;

View File

@ -38,7 +38,7 @@
</div> </div>
</div> </div>
</ng-template> </ng-template>
<st #st multiSort [columns]="columns" [ps]="20" [data]="service.$api_listOperationalReportPage" <st #st multiSort [columns]="columns" [ps]="20" [data]="service.$api_listShipperReportPage"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }" [req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
[scroll]="{ x: '1200px' }" [res]="{ reName: { list: 'data.records', total: 'data.total' } }" [scroll]="{ x: '1200px' }" [res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[page]="{ show: true, showSize: true, pageSizes: [20, 50, 100] }" [loading]="false"></st> [page]="{ show: true, showSize: true, pageSizes: [20, 50, 100] }" [loading]="false"></st>

View File

@ -26,23 +26,33 @@ export class DatatableOwnerComponent implements OnInit {
schema: SFSchema = {}; schema: SFSchema = {};
columns: STColumn[] = [ columns: STColumn[] = [
{ title: '货主名称', index: 'networkTransporterName', className: 'text-center' }, { title: '货主名称', index: 'enterpriseName', className: 'text-center' },
{ title: '注册时间', index: 'zsl', className: 'text-center' }, { title: '注册时间', index: 'registerTime', className: 'text-center' },
{ title: '客户类型', index: 'yingsje', className: 'text-center' }, { title: '客户类型', index: 'customerType', className: 'text-center', type: 'enum', enum: {
{ title: '业务员', index: 'cys', className: 'text-center' }, 1: '平台客户',
{ title: '合伙人', index: 'yingfyf', className: 'text-center' }, 2: '直客',
{ title: '客户状态', index: 'yl', className: 'text-center' }, 3: '渠道客户'
{ title: '订单数', index: 'djd', className: 'text-center' }, }
{ title: '订单金额', index: 'ysz', className: 'text-center' }, },
{ title: '应收订单数', index: 'yswc', className: 'text-center' }, { title: '业务员', index: 'salesmanName', className: 'text-center' },
{ title: '应收金额', index: 'yisje', className: 'text-center' }, { title: '合伙人', index: 'partnerName', className: 'text-center' },
{ title: '客户状态', index: 'customerStatus', className: 'text-center', type: 'enum', enum: {
1: '未激活',
2: '沉默',
3: '流失',
4: '活跃'
} },
{ title: '订单数', index: 'zsl', className: 'text-center' },
{ title: '订单金额', index: 'ddje', className: 'text-center' },
{ title: '应收订单数', index: 'ysdds', className: 'text-center' },
{ title: '应收金额', index: 'yingsje', className: 'text-center' },
{ title: '待开票订单数', index: 'yifyf', className: 'text-center' }, { title: '待开票订单数', index: 'yifyf', className: 'text-center' },
{ title: '待开票金额', index: 'yifyf', className: 'text-center' }, { title: '待开票金额', index: 'dkpdds', className: 'text-center' },
{ title: '已收金额', render: 'yifyf', className: 'text-center' }, { title: '已收金额', render: 'yisje', className: 'text-center' },
{ title: '附加费金额', index: 'yifyf', className: 'text-center' }, { title: '应收附加费', index: 'yingsfjf', className: 'text-center' },
{ title: '已收附加费', index: 'yifyf', className: 'text-center' }, { title: '已收附加费', index: 'yisfjf', className: 'text-center' },
{ title: '附加费率', index: 'yifyf', className: 'text-center' }, { title: '附加费率', index: 'fjfl', className: 'text-center' },
{ title: '已开票金额', index: 'yifyf', className: 'text-center' } { title: '已开票金额', index: 'ykpje', className: 'text-center' }
]; ];
/** /**
* 查询参数 * 查询参数
@ -59,7 +69,8 @@ export class DatatableOwnerComponent implements OnInit {
} }
let params: any = { let params: any = {
time: this.time, time: this.time,
type: this.type type: this.type,
...this.sf?.value
}; };
delete params._$expand; delete params._$expand;
@ -76,28 +87,41 @@ export class DatatableOwnerComponent implements OnInit {
this.schema = { this.schema = {
properties: { properties: {
_$expand: { type: 'boolean', ui: { hidden: true } }, _$expand: { type: 'boolean', ui: { hidden: true } },
billCode: { enterpriseName: {
type: 'string', type: 'string',
title: '货主名称', title: '货主名称',
ui: { ui: {
placeholder: '请输入', placeholder: '请输入',
} }
}, },
resourceCode: { customerType: {
type: 'string', type: 'string',
title: '客户类型', title: '客户类型',
ui: { ui: {
widget: 'select',
placeholder: '请选择', placeholder: '请选择',
} },
enum: [
{label: '直客', value: 2},
{label: '渠道客户', value: 3},
{label: '平台客户', value: 1},
]
}, },
loadingPlace: { customerStatus: {
type: 'string', type: 'string',
title: '客户状态', title: '客户状态',
ui: { ui: {
widget: 'select',
placeholder: '请选择', placeholder: '请选择',
} },
enum: [
{label: '未激活', value: 1},
{label: '沉默', value: 2},
{label: '流失', value: 3},
{label: '活跃', value: 4},
]
}, },
createTime: { registerTime: {
title: '注册时间', title: '注册时间',
type: 'string', type: 'string',
ui: { ui: {

View File

@ -1,24 +0,0 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { DatatableDataindexComponent } from './dataindex.component';
describe('DatatableDataindexComponent', () => {
let component: DatatableDataindexComponent;
let fixture: ComponentFixture<DatatableDataindexComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ DatatableDataindexComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DatatableDataindexComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,131 +1,81 @@
import { Component, ElementRef, NgZone, OnInit, ViewChild } from '@angular/core'; import { Component, ElementRef, Input, NgZone, OnChanges, OnInit, SimpleChanges, ViewChild } from '@angular/core';
import { G2MiniAreaClickItem } from '@delon/chart/mini-area';
import { DataService } from '../../../services/data.service';
import DataSet from '@antv/data-set';
import { Chart } from '@antv/g2'; import { Chart } from '@antv/g2';
import { DataService } from 'src/app/routes/datatable/services/data.service';
@Component({ @Component({
selector: 'app-datatable-curve', selector: 'app-operation-curve',
templateUrl: './curve.component.html', templateUrl: './curve.component.html',
styleUrls: ['./curve.component.less'] styleUrls: ['./curve.component.less']
}) })
export class OperationtableCurveComponent implements OnInit { export class OperationCurveComponent implements OnInit, OnChanges {
el: any;
@Input() chartData: any;
chart: any;
constructor(private service: DataService, private ngZone: NgZone) { constructor(private service: DataService, private ngZone: NgZone) {
} }
ngOnChanges(changes: SimpleChanges): void {
if (this.chartData) {
// setTimeout(()=>{
// this.chart.render(true)
// }, 1000)
}
}
ngOnInit(): void { ngOnInit(): void {
} }
reRender() {
setTimeout(() => {
this.chart.data(this.chartData);
this.chart.render();
handleClick(data: G2MiniAreaClickItem): void { }, 1000)
this.service.msgSrv.info(`${data.item.x} - ${data.item.y}`);
} }
render(el: ElementRef<HTMLDivElement>): void { render(el: ElementRef<HTMLDivElement>): void {
this.ngZone.runOutsideAngular(() => this.init(el.nativeElement)); this.el = el.nativeElement
setTimeout(() => {
this.ngZone.runOutsideAngular(() => this.init(this.el));
}, 1000)
} }
private init(el: HTMLElement): void {
const data = [
{ name: '订单数', month: '01', count: 150, },
{ name: '订单数', month: '02', count: 288 },
{ name: '订单数', month: '03', count: 393 },
{ name: '订单数', month: '04', count: 814 },
{ name: '订单数', month: '05', count: 47 },
{ name: '承运数', month: '05', count: 124 },
{ name: '订单数', month: '06', count: 203 },
{ name: '承运数', month: '06', count: 203 },
{ name: '订单数', month: '07', count: 24 },
{ name: '订单数', month: '08', count: 356 },
{ name: '承运数', month: '09', count: 124 },
{ name: '承运数', month: '10', count: 232 },
{ name: '承运数', month: '11', count: 345 },
{ name: '承运数', month: '12', count: 997 }
];
const dataPillar = [
{ name: '应收金额(元)', month: '01', price: 18.9, },
{ name: '应收金额(元)', month: '02', price: 28.8 },
{ name: '应收金额(元)', month: '03', price: 39.3 },
{ name: '应收金额(元)', month: '04', price: 81.4 },
{ name: '应收金额(元)', month: '05', price: 47 },
{ name: '应付金额(元)', month: '05', price: 12.4 },
{ name: '应收金额(元)', month: '06', price: 20.3 },
{ name: '应付金额(元)', month: '06', price: 20.3 },
{ name: '应收金额(元)', month: '07', price: 24 },
{ name: '应收金额(元)', month: '08', price: 35.6 },
{ name: '应付金额(元)', month: '09', price: 12.4 },
{ name: '应付金额(元)', month: '10', price: 23.2 },
{ name: '应付金额(元)', month: '11', price: 34.5 },
{ name: '应付金额(元)', month: '12', price: 99.7 }
];
const ds = new DataSet();
const dv = ds.createView().source(data);
dv.transform({
type: 'map',
callback: row => {
row.year = parseInt(row.year, 10);
return row;
}
}).transform({
type: 'regression',
method: 'polynomial',
fields: ['year', 'value'],
bandwidth: 0.1,
as: ['Year', 'Value']
});
const chart = new Chart({ private init(el: HTMLElement): void {
this.chart = new Chart({
container: el, container: el,
autoFit: true, autoFit: true,
height: 500, height: 500,
padding: [20, 40],
}); });
const view1 = chart.createView(); this.chart.data(this.chartData);
view1.data(dataPillar); this.chart.scale({
view1.scale('price', { time: {
nice: true, range: [0, 1],
},
number: {
nice: true,
},
}); });
view1.tooltip({
showMarkers: false, this.chart.tooltip({
showCrosshairs: true,
shared: true, shared: true,
}); });
view1 this.chart.axis('number', {
.interval() label: {
.position('month*price') formatter: (val: any) => {
.color('name') return val;
.adjust([
{
type: 'dodge',
marginRatio: 0,
}, },
]); },
});
const view2 = chart.createView();
// view2.axis('count', { this.chart
// label: {
// formatter: (val) => {
// return val + ' °C';
// },
// },
// });
view2.data(data);
view2
.line() .line()
.position('month*count') .position('time*number')
.color('name') .color('name')
this.chart.render();
// chart.interaction('active-region');
chart.render();
} }
}
}

View File

@ -28,7 +28,7 @@
<nz-card nzTitle="运营报表" [nzExtra]="extraTemplate01"> <nz-card nzTitle="运营报表" [nzExtra]="extraTemplate01">
<ng-template #extraTemplate01> <ng-template #extraTemplate01>
<div class="chooseBox"> <div class="chooseBox">
<nz-select [(ngModel)]="enterpriseInfoId" style="width: 200px" (ngModelChange)="changeCurve()"> <nz-select [(ngModel)]="enterpriseInfoId" style="width: 200px" (ngModelChange)="initPillarData()">
<nz-option [nzValue]="item.value" [nzLabel]="item.label" *ngFor="let item of interManlist"></nz-option> <nz-option [nzValue]="item.value" [nzLabel]="item.label" *ngFor="let item of interManlist"></nz-option>
</nz-select> </nz-select>
<div class="timeBox"> <div class="timeBox">
@ -42,11 +42,22 @@
</div> </div>
</div> </div>
</ng-template> </ng-template>
<app-datatable-curve></app-datatable-curve> <div nz-row [nzGutter]="64">
<div nz-col class="gutter-row" [nzSpan]="12">
<!-- <div class="title">
<div class="box" style="background-color: #3ba1ff;"></div> 环比(%)
</div> -->
<!-- <g2-custom delay="100" (render)="render($event)"></g2-custom> -->
<!-- <app-busitable-curve></app-busitable-curve> -->
<app-operation-curve #curve [chartData]="chartData.lineChart"></app-operation-curve>
</div>
<div nz-col class="gutter-row" [nzSpan]="12">
<!-- <div class="title">
<div class="box" style="background-color: #f59a23;"></div> 业绩量(元)
</div> -->
<app-operation-pillar #pillar [chartData]="chartData.histogram"></app-operation-pillar>
</div>
</div>
</nz-card> </nz-card>
<nz-card nzTitle="运单状态分布">
<nz-select [(ngModel)]="enterpriseInfoIdPie" style="width: 200px" (ngModelChange)="changeCurve()"> <app-opeationtable-pie #pie></app-opeationtable-pie>
<nz-option [nzValue]="item.value" [nzLabel]="item.label" *ngFor="let item of interManlist"></nz-option>
</nz-select>
<app-opeationtable-pie></app-opeationtable-pie>
</nz-card>

View File

@ -3,6 +3,8 @@ import { STColumn, STComponent } from '@delon/abc/st';
import { DatePipe, _HttpClient } from '@delon/theme'; import { DatePipe, _HttpClient } from '@delon/theme';
import { DataService } from '../../services/data.service'; import { DataService } from '../../services/data.service';
import { differenceInCalendarDays } from 'date-fns'; import { differenceInCalendarDays } from 'date-fns';
import { OperationCurveComponent } from './curve/curve.component';
import { OperationPillarComponent } from './pillar/pillar.component';
@Component({ @Component({
selector: 'app-datatable-operationtable', selector: 'app-datatable-operationtable',
@ -12,6 +14,8 @@ import { differenceInCalendarDays } from 'date-fns';
}) })
export class DatatableOperationtableComponent implements OnInit { export class DatatableOperationtableComponent implements OnInit {
@ViewChild('curve') private readonly curve!: OperationCurveComponent;
@ViewChild('pillar') private readonly pillar!: OperationPillarComponent;
@ViewChild('st') private readonly st!: STComponent; @ViewChild('st') private readonly st!: STComponent;
type = 1; type = 1;
mode = 'year'; mode = 'year';
@ -24,8 +28,10 @@ export class DatatableOperationtableComponent implements OnInit {
timeNext: any = ['2022-01-01 00:00:00'] timeNext: any = ['2022-01-01 00:00:00']
today = new Date(); today = new Date();
enterpriseInfoId = '' enterpriseInfoId = ''
enterpriseInfoIdPie = ''
interManlist: any = [] interManlist: any = []
chartData: any = {}
flag = false;
columns: STColumn[] = [ columns: STColumn[] = [
{ title: '运营主体', index: 'networkTransporterName', className: 'text-center' }, { title: '运营主体', index: 'networkTransporterName', className: 'text-center' },
{ title: '订单数', index: 'zsl', className: 'text-center' }, { title: '订单数', index: 'zsl', className: 'text-center' },
@ -64,12 +70,36 @@ export class DatatableOperationtableComponent implements OnInit {
constructor(public service: DataService, private datePipe: DatePipe) { } constructor(public service: DataService, private datePipe: DatePipe) { }
ngOnInit(): void { ngOnInit(): void {
this.initData() this.initData()
this.initPillarData()
}
initPillarData(){
let type = 1
if(this.mode === 'year') {
type = 1
} else if(this.mode === 'month') {
type = 2
}
const params: any = {
time: this.timeNext,
type,
enterpriseInfoId: this.enterpriseInfoId
};
this.flag = true
this.service.request(this.service.$api_operationalReportHistogram, params).subscribe(res => {
if (res) {
this.chartData = res
if(this.flag) {
this.pillar.reRender()
this.curve.reRender()
}
}
})
} }
initData() { initData() {
this.service.getNetworkFreightForwarder().subscribe(res => { this.service.getNetworkFreightForwarder().subscribe(res => {
this.interManlist = res this.interManlist = res
this.enterpriseInfoId = res[0].value this.enterpriseInfoId = res[0].value
this.enterpriseInfoIdPie = res[0].value
}) })
} }

View File

@ -1,3 +1,6 @@
<div class="box"> <nz-card nzTitle="运单状态分布">
<nz-select [(ngModel)]="enterpriseInfoIdPie" style="width: 200px" (ngModelChange)="initData()">
<nz-option [nzValue]="item.value" [nzLabel]="item.label" *ngFor="let item of interManlist"></nz-option>
</nz-select>
<g2-custom delay="100" (render)="render($event)"></g2-custom> <g2-custom delay="100" (render)="render($event)"></g2-custom>
</div> </nz-card>

View File

@ -1,5 +1,5 @@
.box{ .box{
width: 50%; width: 50%;
overflow: hidden;
margin:0 auto; margin:0 auto;
overflow: hidden;
} }

View File

@ -13,21 +13,30 @@ export class OperationtablePieComponent implements OnInit {
@ViewChild('pie', { static: false }) pie!: G2PieComponent; @ViewChild('pie', { static: false }) pie!: G2PieComponent;
chartData: any = []; chartData: any = [];
el: any; el: any;
enterpriseInfoIdPie = ''
interManlist: any = []
constructor(private service: DataService, private ngZone: NgZone) { constructor(private service: DataService, private ngZone: NgZone) {
} }
ngOnInit(): void { ngOnInit(): void {
this.initData() this.initData()
this.initManData()
} }
initData(){ initData(){
this.service.request(this.service.$api_operationalReportWaybillStatusDistribution).subscribe(res => { this.service.request(this.service.$api_operationalReportWaybillStatusDistribution, {id: this.enterpriseInfoIdPie}).subscribe(res => {
if (res) { if (res) {
this.chartData = res this.chartData = res
this.ngZone.runOutsideAngular(() => this.init(this.el)); this.ngZone.runOutsideAngular(() => this.init(this.el));
} }
}) })
} }
initManData() {
this.service.getNetworkFreightForwarder().subscribe(res => {
this.interManlist = res
this.enterpriseInfoIdPie = res[0].value
})
}
render(el: ElementRef<HTMLDivElement>): void { render(el: ElementRef<HTMLDivElement>): void {
this.el = el.nativeElement this.el = el.nativeElement
} }

View File

@ -0,0 +1,75 @@
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-operation-pillar',
templateUrl: './pillar.component.html',
styleUrls: ['./pillar.component.less']
})
export class OperationPillarComponent 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);
console.log(this.chartData)
this.chart.render();
}, 1000)
}
render(el: ElementRef<HTMLDivElement>): void {
this.el = el.nativeElement
setTimeout(() => {
this.ngZone.runOutsideAngular(() => this.init(this.el));
},1000)
}
private init(el: HTMLElement): void {
this.chart = new Chart({
container: el,
autoFit: true,
height: 500,
});
this.chart.data(this.chartData);
this.chart.scale('number', {
nice: true,
});
this.chart.tooltip({
showMarkers: false,
shared: true,
});
this.chart
.interval()
.position('time*number')
.color('name')
.adjust([
{
type: 'dodge',
marginRatio: 0,
},
]);
this.chart.interaction('active-region');
this.chart.render();
}
}

View File

@ -8,7 +8,6 @@ import { DatatableOperationtableComponent } from './components/operationtable/op
import { OperationtablePieComponent } from './components/operationtable/pie/pie.component'; import { OperationtablePieComponent } from './components/operationtable/pie/pie.component';
import { DatatableOrderReportingComponent } from './reporting/components/order-reporting/order-reporting.component'; import { DatatableOrderReportingComponent } from './reporting/components/order-reporting/order-reporting.component';
import { DatatableDataindexComponent } from './components/dataindex/dataindex.component'; import { DatatableDataindexComponent } from './components/dataindex/dataindex.component';
import { OperationtableCurveComponent } from './components/operationtable/curve/curve.component';
import { DatatableComplianceIndexComponent } from './components/compliance/index/index.component'; import { DatatableComplianceIndexComponent } from './components/compliance/index/index.component';
import { DatatableFinancetableComponent } from './components/financetable/financetable.component'; import { DatatableFinancetableComponent } from './components/financetable/financetable.component';
import { DatatableInvoicetableComponent } from './components/invoicetable/invoicetable.component'; import { DatatableInvoicetableComponent } from './components/invoicetable/invoicetable.component';
@ -23,7 +22,9 @@ import { DatatableBusiindexComponent } from './components/busitable/busiindex/bu
import { DatatableMantableComponent } from './components/busitable/mantable/mantable.component'; import { DatatableMantableComponent } from './components/busitable/mantable/mantable.component';
import { BusitablePillarComponent } from './components/busitable/busiindex/pillar/pillar.component'; import { BusitablePillarComponent } from './components/busitable/busiindex/pillar/pillar.component';
import { DatatableReportingFundInfoComponent } from './reporting/components/fund-info/fund-info.component'; import { DatatableReportingFundInfoComponent } from './reporting/components/fund-info/fund-info.component';
import { BusitableCurveComponent } from './components/busitable/busiindex/curve2/curve.component'; import { BusitableCurveComponent } from './components/busitable/busiindex/curve/curve.component';
import { OperationPillarComponent } from './components/operationtable/pillar/pillar.component';
import { OperationCurveComponent } from './components/operationtable/curve/curve.component';
const COMPONENTS: Type<void>[] = [ const COMPONENTS: Type<void>[] = [
DatatableDataindexComponent, DatatableDataindexComponent,
@ -33,7 +34,6 @@ const COMPONENTS: Type<void>[] = [
DatatableOperationtableComponent, DatatableOperationtableComponent,
OperationtablePieComponent, OperationtablePieComponent,
DatatableOrderReportingComponent, DatatableOrderReportingComponent,
OperationtableCurveComponent,
DatatableComplianceIndexComponent, DatatableComplianceIndexComponent,
DatatableFinancetableComponent, DatatableFinancetableComponent,
DatatableInvoicetableComponent, DatatableInvoicetableComponent,
@ -48,8 +48,11 @@ const COMPONENTS: Type<void>[] = [
DatatableMantableComponent, DatatableMantableComponent,
BusitablePillarComponent, BusitablePillarComponent,
DatatableFundReportingComponent, DatatableFundReportingComponent,
DatatableReportingFundInfoComponent,
BusitableCurveComponent, BusitableCurveComponent,
DatatableReportingFundInfoComponent] OperationPillarComponent,
OperationCurveComponent
]
@NgModule({ @NgModule({

View File

@ -27,6 +27,8 @@ export class DataService extends BaseService {
$api_listPerformanceReportPage = `/api/sdc/report/listPerformanceReportPage`; $api_listPerformanceReportPage = `/api/sdc/report/listPerformanceReportPage`;
// 运营报表运单状态分布 // 运营报表运单状态分布
$api_operationalReportWaybillStatusDistribution = `/api/sdc/report/operationalReportWaybillStatusDistribution`; $api_operationalReportWaybillStatusDistribution = `/api/sdc/report/operationalReportWaybillStatusDistribution`;
// 运营报表柱状图
$api_operationalReportHistogram = `/api/sdc/report/operationalReportHistogram`;
// 获取网络货运人 // 获取网络货运人
$api_get_network_freight_forwarder_list = `/api/mdc/cuc/networkTransporter/findAll`; $api_get_network_freight_forwarder_list = `/api/mdc/cuc/networkTransporter/findAll`;
// 业绩报表柱状图 // 业绩报表柱状图
@ -35,6 +37,9 @@ export class DataService extends BaseService {
// 查询开票数据报表 // 查询开票数据报表
$api_findInvoiceReport = `/api/fcc/invoiceReport/findInvoiceReport`; $api_findInvoiceReport = `/api/fcc/invoiceReport/findInvoiceReport`;
// 查询货主报表
$api_listShipperReportPage = `/api/sdc/report/listShipperReportPage`;
constructor(public injector: Injector) { constructor(public injector: Injector) {
super(injector); super(injector);
} }
@ -43,7 +48,7 @@ export class DataService extends BaseService {
* 获取网络货运人 * 获取网络货运人
* @returns * @returns
*/ */
getNetworkFreightForwarder(params = {}, containerAll = false) { getNetworkFreightForwarder(params = {}, containerAll = false) {
return this.request(this.$api_get_network_freight_forwarder_list, params).pipe( return this.request(this.$api_get_network_freight_forwarder_list, params).pipe(
map((res: any) => { map((res: any) => {
if (!res) { if (!res) {
@ -64,7 +69,7 @@ export class DataService extends BaseService {
); );
} }
getPerformanceReportHistogram(params = {}){ getPerformanceReportHistogram(params = {}) {
return this.request(this.$api_performanceReportHistogram, params) return this.request(this.$api_performanceReportHistogram, params)
} }
} }