This commit is contained in:
Taric Xin
2022-04-22 14:42:08 +08:00
parent 1a0ba55ea0
commit 29789d20ab
8 changed files with 145 additions and 52 deletions

View File

@ -30,7 +30,7 @@ module.exports = {
// }, // },
'//api': { '//api': {
target: { target: {
host: 'tms-api-test.eascs.com', host: 'tms-api-dev.eascs.com',
protocol: 'https:', protocol: 'https:',
port: 443 port: 443
}, },

View File

@ -25,7 +25,7 @@
<g2-card [title]="'司机应付总额'" [bordered]="true" [total]="totalFreight?.totalAmount || '¥ 0.00万'" [footer]="footer" <g2-card [title]="'司机应付总额'" [bordered]="true" [total]="totalFreight?.totalAmount || '¥ 0.00万'" [footer]="footer"
contentHeight="46"> contentHeight="46">
<ng-template #footer> <ng-template #footer>
<g2-mini-area line color="#cceafe" height="45" [data]="totalFreight?.list || []" <g2-mini-area line borderColor="#E60012" color="#F09896" height="45" [data]="totalFreight?.list || []"
(clickItem)="handleClick($event)"> (clickItem)="handleClick($event)">
</g2-mini-area> </g2-mini-area>
</ng-template> </ng-template>
@ -35,7 +35,7 @@
<g2-card [title]="'附加费总额'" [bordered]="true" [total]="totalSurcharge?.totalAmount || '¥ 0.00万'" <g2-card [title]="'附加费总额'" [bordered]="true" [total]="totalSurcharge?.totalAmount || '¥ 0.00万'"
[footer]="SurchargeFooter" contentHeight="46"> [footer]="SurchargeFooter" contentHeight="46">
<ng-template #SurchargeFooter> <ng-template #SurchargeFooter>
<g2-mini-area line color="#cceafe" height="45" [data]="totalSurcharge?.list || []" <g2-mini-area line borderColor="#E60012" color="#F09896" height="45" [data]="totalSurcharge?.list || []"
(clickItem)="handleClick($event)"> (clickItem)="handleClick($event)">
</g2-mini-area> </g2-mini-area>
</ng-template> </ng-template>
@ -43,13 +43,13 @@
</div> </div>
</div> </div>
<div nz-row [nzGutter]="16"> <div nz-row [nzGutter]="16">
<div nz-col class="gutter-row" [nzSpan]="9"> <div nz-col class="gutter-row" [nzSpan]="7">
<nz-card [nzTitle]="'订单类型比例'"> <nz-card><label class="chart_title">订单类型比例</label>
<g2-custom #g2custom delay="100"></g2-custom> <g2-custom #g2custom delay="100"></g2-custom>
</nz-card> </nz-card>
</div> </div>
<div nz-col class="gutter-row" [nzSpan]="15"> <div nz-col class="gutter-row" [nzSpan]="17">
<nz-card [nzTitle]="'大区业绩完成情况'"> <nz-card><label class="chart_title">大区业绩完成情况</label>
<!-- <g2-timeline [data]="chartData" [titleMap]="{ y1: '订单金额(元)', y2: '' }" [height]="200" mask="MM月DD日" <!-- <g2-timeline [data]="chartData" [titleMap]="{ y1: '订单金额(元)', y2: '' }" [height]="200" mask="MM月DD日"
[slider]="false"></g2-timeline> --> [slider]="false"></g2-timeline> -->
<g2-custom #RegionalPerforman delay="100"></g2-custom> <g2-custom #RegionalPerforman delay="100"></g2-custom>
@ -57,16 +57,17 @@
</div> </div>
</div> </div>
<div nz-row [nzGutter]="16"> <div nz-row [nzGutter]="16">
<div nz-col class="gutter-row" [nzSpan]="9"> <div nz-col class="gutter-row" [nzSpan]="7">
<nz-card [nzTitle]="'运单直付比例'"> <nz-card> <label class="chart_title">运单直付比例</label>
<!-- <g2-pie #pie title="销售额" subTitle="销售额" [total]="total" [valueFormat]="format" [data]="salesPieData" height="294" <!-- <g2-pie #pie title="销售额" subTitle="销售额" [total]="total" [valueFormat]="format" [data]="salesPieData" height="294"
(clickItem)="handleClick($event)" [lineWidth]="10"> (clickItem)="handleClick($event)" [lineWidth]="10">
</g2-pie> --> </g2-pie> -->
<g2-custom #BillDirectProportion delay="100"></g2-custom> <g2-custom #BillDirectProportion delay="100"></g2-custom>
</nz-card> </nz-card>
</div> </div>
<div nz-col class="gutter-row" [nzSpan]="15"> <div nz-col class="gutter-row" [nzSpan]="17">
<nz-card [nzTitle]="'业绩完成情况'"> <nz-card>
<label class="chart_title">业绩完成情况</label>
<!-- <g2-bar [data]="salesData" (clickItem)="handleClick($event)" height="400"></g2-bar> --> <!-- <g2-bar [data]="salesData" (clickItem)="handleClick($event)" height="400"></g2-bar> -->
<g2-custom #SaleProportion delay="100"></g2-custom> <g2-custom #SaleProportion delay="100"></g2-custom>

View File

@ -0,0 +1,9 @@
.chart_title {
font-size : 16px;
font-weight : 500;
color : #1D2129;
line-height : 24px;
background-clip : text;
-webkit-background-clip: text;
position : absolute;
}

View File

@ -82,8 +82,14 @@ export class DatatableDataindexComponent implements OnInit {
// 大区业绩完成情况 // 大区业绩完成情况
this.service.request(this.service.$api_getBillAmount).subscribe((res: DataPerformanceTrendVO[]) => { this.service.request(this.service.$api_getBillAmount).subscribe((res: DataPerformanceTrendVO[]) => {
if (res) { if (res) {
this.regionalPerformanceCompletion = res.map(item => ({ ...item, time: new Date(item.time)?.getTime() })); // this.regionalPerformanceCompletion = res.map(item => ({ ...item, time: new Date(item.time)?.getTime() }));
this.initRegionalPerformanceChart(this.RegionalPerforman['el'].nativeElement as any, this.regionalPerformanceCompletion); // this.initRegionalPerformanceChart(this.RegionalPerforman['el'].nativeElement as any, this.regionalPerformanceCompletion);
this.regionalPerformanceCompletion = this.formatBarData(res);
this.initBiaxialChart(this.RegionalPerforman['el'].nativeElement as any, this.regionalPerformanceCompletion, {
y1Title: '业绩量(万)',
y2Title: '业绩完成率',
y3Title: '同期业绩完成率'
});
} }
}); });
// 订单类型比例 // 订单类型比例
@ -97,7 +103,11 @@ export class DatatableDataindexComponent implements OnInit {
this.service.request(this.service.$api_get_bill_payment_amount).subscribe(res => { this.service.request(this.service.$api_get_bill_payment_amount).subscribe(res => {
if (res) { if (res) {
this.salesData = this.formatBarData(res); this.salesData = this.formatBarData(res);
this.initBiaxialChart(this.SaleProportion['el'].nativeElement as any, this.salesData); this.initBiaxialChart(this.SaleProportion['el'].nativeElement as any, this.salesData, {
y1Title: '业绩量(万)',
y2Title: '业绩完成率',
y3Title: '同期业绩完成率'
});
} }
}); });
} }
@ -121,8 +131,8 @@ export class DatatableDataindexComponent implements OnInit {
// 新建一个 view 用来单独渲染Annotation // 新建一个 view 用来单独渲染Annotation
const innerView = chart.createView(); const innerView = chart.createView();
chart.coordinate('theta', { chart.coordinate('theta', {
radius: 0.6, radius: 0.65,
innerRadius: 0.7 innerRadius: 0.6
}); });
chart.data(data); chart.data(data);
@ -138,17 +148,17 @@ export class DatatableDataindexComponent implements OnInit {
// 声明需要进行自定义图例字段: 'item' // 声明需要进行自定义图例字段: 'item'
chart.legend('item', { chart.legend('item', {
position: 'right', // 配置图例显示位置 position: 'bottom', // 配置图例显示位置
custom: true, // 关键字段,告诉 G2要使用自定义的图例 custom: true, // 关键字段,告诉 G2要使用自定义的图例
items: data.map((obj: any, index: any) => { items: data.map((obj: any, index: any) => {
return { return {
name: obj.item, // 对应 itemName name: obj.item, // 对应 itemName
value: obj.percent, // 对应 itemValue value: obj.percent, // 对应 itemValue
marker: { marker: {
symbol: 'square', // marker 的形状 symbol: 'circle', // marker 的形状
style: { style: {
r: 5, // marker 图形半径 r: 5, // marker 图形半径
fill: chart.getTheme().colors10[index] // marker 颜色,使用默认颜色,同图形对应 fill: index === 0 ? '#E60012' : '#F09896' // marker 颜色,使用默认颜色,同图形对应
} }
} // marker 配置 } // marker 配置
}; };
@ -165,7 +175,7 @@ export class DatatableDataindexComponent implements OnInit {
.interval() .interval()
.adjust('stack') .adjust('stack')
.position('percent') .position('percent')
.color('item') .color('item', ['#E60012', '#F09896'])
.style({ .style({
fillOpacity: 1, fillOpacity: 1,
stroke: 'white', stroke: 'white',
@ -182,6 +192,14 @@ export class DatatableDataindexComponent implements OnInit {
}; };
} }
} }
})
.label('percent', percent => {
return {
content: data => {
return ` ${percent * 100}%`;
},
style: { fontSize: 14 }
};
}); });
innerView innerView
@ -201,7 +219,7 @@ export class DatatableDataindexComponent implements OnInit {
content: data[0].count, content: data[0].count,
style: { style: {
fontSize: 28, fontSize: 28,
fill: '#8c8c8c', fill: '##000',
textAlign: 'center' textAlign: 'center'
}, },
offsetY: 20 offsetY: 20
@ -253,7 +271,7 @@ export class DatatableDataindexComponent implements OnInit {
content: data.count, content: data.count,
style: { style: {
fontSize: 28, fontSize: 28,
fill: '#8c8c8c', fill: '##000',
textAlign: 'center' textAlign: 'center'
}, },
offsetY: 20 offsetY: 20
@ -271,6 +289,50 @@ export class DatatableDataindexComponent implements OnInit {
} }
} }
/**
* 构建面积图
* @param el
*/
private initAreaMap(el: HTMLElement, datas: any[]): void {
const chart = new Chart({
container: el,
autoFit: true,
height: 500
});
chart.data(datas);
chart.scale('Data', {
range: [0, 1],
tickCount: 10,
type: 'timeCat'
});
chart.scale('sales', {
nice: true
});
chart.axis('Data', false);
chart.axis('sales', false);
chart.tooltip({
showCrosshairs: true
});
// chart.annotation().dataMarker({
// position: ['2014-01', 1750],
// top: true,
// text: {
// content: '因政策调整导致销量下滑',
// style: {
// fontSize: 13
// }
// },
// line: {
// length: 30
// }
// });
chart.line().position('Data*sales');
chart.area().position('Data*sales');
chart.render();
}
/** /**
* 构建大区业绩完成情况柱折双轴图 * 构建大区业绩完成情况柱折双轴图
* @param el * @param el
@ -308,6 +370,7 @@ export class DatatableDataindexComponent implements OnInit {
// 声明需要进行自定义图例字段: 'item' // 声明需要进行自定义图例字段: 'item'
chart.legend({ chart.legend({
title: { text: '1111', spacing: 11 },
offsetY: 10, offsetY: 10,
position: 'bottom', // 配置图例显示位置 position: 'bottom', // 配置图例显示位置
custom: true, // 关键字段,告诉 G2要使用自定义的图例 custom: true, // 关键字段,告诉 G2要使用自定义的图例
@ -333,7 +396,11 @@ export class DatatableDataindexComponent implements OnInit {
* @param el * @param el
* @param data * @param data
*/ */
private initBiaxialChart(el: HTMLElement, data: any[]) { private initBiaxialChart(
el: HTMLElement,
data: any[],
{ y1Title, y2Title, y3Title }: { y1Title: string; y2Title: string; y3Title: string }
) {
const chart = new Chart({ const chart = new Chart({
container: el, container: el,
autoFit: true, autoFit: true,
@ -342,45 +409,47 @@ export class DatatableDataindexComponent implements OnInit {
chart.data(data); chart.data(data);
// 设置坐标轴 // 设置坐标轴
chart.scale({ chart.scale({
pre: { alias: '同期业绩完成率', min: 0, max: 1, formatter: val => val * 100 + '%' }, y1: { alias: y1Title, min: 0, max: 1000000 },
pre2: { alias: '业绩完成率', min: 0, max: 1, formatter: val => val * 100 + '%' }, y2: { alias: y2Title, min: 0, max: 1, formatter: val => (val * 100).toFixed(0) + '%' },
quantity: { alias: '业绩量 (万)', min: 0, max: 1000000 } y3: { alias: y3Title, min: 0, max: 1, formatter: val => (val * 100).toFixed(0) + '%' }
}); });
// 设置 // 设置
chart.legend({ chart.legend({
custom: true, custom: true,
position: 'top-right',
padding: [10, 0, 40, 0],
items: [ items: [
{ value: 'quantity', name: '业绩量 (万)', marker: { symbol: 'hyphen', style: { stroke: '#3182bd', r: 15, lineWidth: 5 } } }, { value: 'y1', name: y1Title, marker: { symbol: 'circle', style: { fill: '#E60012', r: 5, fontSize: 13 } } },
{ value: 'pre2', name: '业绩完成率', marker: { symbol: 'hyphen', style: { stroke: '#fdae6b', r: 15, lineWidth: 5 } } }, { value: 'y3', name: y3Title, marker: { symbol: 'circle', style: { fill: '#6CBFFF', r: 5, fontSize: 13 } } },
{ value: 'pre', name: '同期业绩完成率', marker: { symbol: 'hyphen', style: { stroke: '#ff4d4f', r: 15, lineWidth: 5 } } } { value: 'y2', name: y2Title, marker: { symbol: 'circle', style: { fill: '#50D4AB', r: 5, fontSize: 13 } } }
] ]
}); });
chart.axis('pre', { chart.axis('y2', {
grid: null, grid: null,
title: null, title: null,
label: { label: {
formatter: val => +val * 100 + '%' formatter: val => val
} }
}); });
chart.axis('pre2', false); chart.axis('y3', false);
chart.tooltip({ chart.tooltip({
shared: true shared: true
}); });
chart.interval().position('time*quantity').label('quantity').color('#3182bd'); chart.interval().position('x*y1').color('#E60012');
chart chart
.line() .line()
.position('time*pre') .position('x*y2')
.label('pre', val => ({ content: (val * 100).toFixed(0) + '%' })) // .label('pre', val => ({ content: (val * 100).toFixed(0) + '%' }))
.color('#ff4d4f') .color('#6CBFFF')
.size(3); .size(3);
chart.point().position('time*pre').color('#ff4d4f').size(3).shape('circle'); chart.point().position('x*y2').color('#6CBFFF').size(3).shape('circle');
chart chart
.line() .line()
.position('time*pre2') .position('x*y3')
.label('pre2', val => ({ content: (val * 100).toFixed(0) + '%' })) // .label('pre2', val => ({ content: (val * 100).toFixed(0) + '%' }))
.color('#fdae6b') .color('#50D4AB')
.size(3); .size(3);
chart.point().position('time*pre2').color('#fdae6b').size(3).shape('circle'); chart.point().position('x*y3').color('#50D4AB').size(3).shape('circle');
chart.interaction('active-region'); chart.interaction('active-region');
chart.removeInteraction('legend-filter'); // 自定义图例,移除默认的分类图例筛选交互 chart.removeInteraction('legend-filter'); // 自定义图例,移除默认的分类图例筛选交互
@ -417,11 +486,10 @@ export class DatatableDataindexComponent implements OnInit {
private formatBarData(data: DataPerformanceTrendVO[]): any[] { private formatBarData(data: DataPerformanceTrendVO[]): any[] {
return data.map(item => ({ return data.map(item => ({
time: item.time, x: item.time,
quantity: item.quantity, y1: item.quantity,
color: undefined, y2: Math.floor(Math.random() * 100) / 100,
pre: Math.floor(Math.random() * 100) / 100, y3: Math.floor(Math.random() * 100) / 100
pre2: Math.floor(Math.random() * 100) / 100
})); }));
} }

View File

@ -73,7 +73,9 @@ export class PartnerListComponent {
nzFooter: null nzFooter: null
}); });
modal.afterClose.subscribe(res => { modal.afterClose.subscribe(res => {
modal.destroy(); if (res) {
this.st.load(1);
}
}); });
} }

View File

@ -1,5 +1,6 @@
import { Component, Input, OnInit, ViewChild } from '@angular/core'; import { Component, Input, OnInit, ViewChild } from '@angular/core';
import { SFComponent, SFSchema, SFValue } from '@delon/form'; import { SFComponent, SFSchema, SFValue } from '@delon/form';
import { ModalHelper } from '@delon/theme';
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
import { PartnerListService } from '../../services/partner-list.service'; import { PartnerListService } from '../../services/partner-list.service';
@ -15,7 +16,7 @@ export class PartnerAuditModalComponent implements OnInit {
info: any; info: any;
schema!: SFSchema; schema!: SFSchema;
sourcePage = ''; sourcePage = '';
constructor(private nzModalService: NzModalService, public service: PartnerListService) {} constructor(private nzModalService: NzModalService, public service: PartnerListService, private modal: NzModalRef) {}
ngOnInit(): void { ngOnInit(): void {
this.initSF(this.info); this.initSF(this.info);
@ -49,7 +50,7 @@ export class PartnerAuditModalComponent implements OnInit {
widget: 'radio', widget: 'radio',
hidden: this.info.isPass !== undefined hidden: this.info.isPass !== undefined
}, },
default: true default: this.info.isPass !== undefined ? this.info.isPass : true
}, },
channelId: { channelId: {
title: '渠道销售', title: '渠道销售',
@ -121,7 +122,7 @@ export class PartnerAuditModalComponent implements OnInit {
.subscribe(res => { .subscribe(res => {
if (res) { if (res) {
this.service.msgSrv.success('审核成功!'); this.service.msgSrv.success('审核成功!');
this.close(); this.modal.destroy(1);
} }
}); });
} }

View File

@ -142,6 +142,12 @@ export class PartnerDetailComponent implements OnInit, OnDestroy {
nzComponentParams: { info: { ...this.detailData, isPass }, sourcePage: '合伙人审核详情' }, nzComponentParams: { info: { ...this.detailData, isPass }, sourcePage: '合伙人审核详情' },
nzFooter: null nzFooter: null
}); });
modal.afterClose.subscribe(res => {
if (res) {
this.initData();
}
});
} }
ratify() { ratify() {
@ -370,7 +376,7 @@ export class PartnerDetailComponent implements OnInit, OnDestroy {
buttons: [ buttons: [
{ {
text: '详情', text: '详情',
click: (item) => this.service.showChangeDetail(item.id) click: item => this.service.showChangeDetail(item.id)
} }
] ]
} }

View File

@ -130,6 +130,12 @@ export class PersonalPartnerDetailComponent implements OnInit {
}, },
nzFooter: null nzFooter: null
}); });
modal.afterClose.subscribe(res => {
if (res) {
this.initData();
}
});
} }
ratify() { ratify() {