This commit is contained in:
heqinghang
2022-04-01 16:42:15 +08:00
parent a543097734
commit 6863464467
10 changed files with 212 additions and 32 deletions

View File

@ -5,6 +5,9 @@ import { format } from 'date-fns';
import { SFComponent, SFDateWidgetSchema, SFRadioWidgetSchema, SFSchema, SFUISchema } from '@delon/form';
import { G2TimelineData, G2TimelineMap } from '@delon/chart/timeline';
import { Chart } from '@antv/g2';
import { DataService } from '../../../services/data.service';
import { ComplianceCurveComponent } from './curve/curve.component';
@Component({
selector: 'app-datatable-compliance-index',
templateUrl: './index.component.html',
@ -12,51 +15,107 @@ import { Chart } from '@antv/g2';
providers: [DatePipe]
})
export class DatatableComplianceIndexComponent implements OnInit {
@ViewChild('curve') private readonly curve!: ComplianceCurveComponent;
@ViewChild('sf', { static: false })
sf!: SFComponent;
ui!: SFUISchema;
schema: SFSchema = {};
mode = 'year';
date: any = null;
dateFormat = 'yyyy-MM-dd';
time: any = ['2022-01-01 00:00:00']
constructor(private http: _HttpClient, private modal: ModalHelper, private ngZone: NgZone, private datePipe: DatePipe) {}
dateFormat = 'yyyy';
time: any = '2022'
chartData: any = {}
cardData1:any;
cardData2:any;
cardData3:any;
cardData4:any;
constructor(private http: _HttpClient, private modal: ModalHelper, private ngZone: NgZone,public service: DataService, private datePipe: DatePipe) {}
ngOnInit(): void {
this.initSF();
this.initdData();
}
initdData(){
const params ={
...this.sf?.value,
timeType:this.mode ==='month'?'M':'Y',
time:this.time
}
this.service.request(this.service.$api_getBillRateQualified, params).subscribe(res => {
if (res) {
this.cardData1 = res;
this.cardData1.proportion = this.cardData1.proportion*100 +'%'
}
});
this.service.request(this.service.$api_getBillRateProportion, params).subscribe(res => {
if (res) {
this.cardData2 = res;
this.cardData2.proportion = this.cardData2.proportion*100 +'%'
}
});
this.service.request(this.service.$api_getBillRateDirectPayment, params).subscribe(res => {
if (res) {
this.cardData3 = res;
this.cardData3.proportion = this.cardData3.proportion*100 +'%'
}
});
this.service.request(this.service.$api_getBillTimelyPayment, params).subscribe(res => {
if (res) {
this.cardData4 = res;
this.cardData4.proportion = this.cardData4.proportion*100 +'%'
}
});
this.service.request(this.service.$api_listMonitorSituation, params).subscribe(res => {
if (res) {
this.chartData = res
this.curve.reRender();
}
})
}
changeData(){
if(this.mode === 'year') {
this.dateFormat = 'yyyy'
} else if(this.mode === 'month') {
this.dateFormat = 'yyyy-MM'
} else {
this.dateFormat = 'yyyy-MM-dd'
}
}
}
onChange(result: any) {
if(this.mode === 'year') {
this.time = [this.datePipe.transform(this.date, 'yyyy') + '-01-01 00:00:00']
this.time = this.datePipe.transform(this.date, 'yyyy')
} else if(this.mode === 'month') {
this.time = [this.datePipe.transform(this.date, 'yyyy-MM') + '-01 00:00:00']
this.time = this.datePipe.transform(this.date, 'yyyy-MM')
}
this.initdData();
}
initSF() {
this.schema = {
properties: {
name: {
enterpriseInfoId: {
type: 'string',
title: '',
ui: {
widget: 'select',
placeholder: '网络货运人'
placeholder: '网络货运人',
asyncData: () => this.service.getNetworkFreightForwarder({}),
change:()=>{
this.initdData();
},
allowClear: true
}
},
name2: {
enterpriseProjectId: {
type: 'string',
title: '',
ui: {
@ -64,11 +123,12 @@ export class DatatableComplianceIndexComponent implements OnInit {
placeholder: '部门'
}
},
name3: {
salesmanId: {
type: 'string',
title: '',
ui: {
placeholder: '业务员'
placeholder: '业务员',
enter: () => this.initdData(),
}
}
}
@ -81,6 +141,9 @@ export class DatatableComplianceIndexComponent implements OnInit {
}
render(el: ElementRef<HTMLDivElement>) {
this.ngZone.runOutsideAngular(() => this.init(el.nativeElement));
}