Merge branch 'develop' of https://gitlab.eascs.com/tms-ui/tms-obc-web into develop

This commit is contained in:
heqinghang
2022-04-08 15:13:36 +08:00
51 changed files with 1310 additions and 878 deletions

View File

@ -37,7 +37,9 @@ export class DatatableBusiindexComponent implements OnInit {
{ 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-right', type: 'widget', widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.yisfjf }) } },
{ title: '平均附加费率', index: 'fjfl', className: 'text-center' },
{ title: '平均附加费率', index: 'fjfl', className: 'text-center',format: (item)=> {
return item.fjfl + '%'
} },
{ title: '已开票金额', index: 'ykpje', className: 'text-right', type: 'widget', widget: { type: 'currency-chy', params: ({ record }) => ({ value: record.ykpje }) } },
];
/**

View File

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

View File

@ -0,0 +1,132 @@
/*
* @Description :
* @Version : 1.0
* @Author : Shiming
* @Date : 2022-04-07 17:57:23
* @LastEditors : Shiming
* @LastEditTime : 2022-04-07 19:28:24
* @FilePath : \\tms-obc-web\\src\\app\\routes\\datatable\\components\\datascreen\\curve\\curve.component.ts
* Copyright (C) 2022 huzhenhong. All rights reserved.
*/
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';
const DataSet = require('@antv/data-set');
import { Chart } from '@antv/g2';
@Component({
selector: 'app-financetable-curve-min',
templateUrl: './curve.component.html',
styleUrls: ['./curve.component.less']
})
export class DatatableCustomindexCurveMinComponent implements OnInit,OnChanges {
el: any;
@Input() chartData: any;
chart: any;
data = [
{ time: '01', type: '订单数', temperature: 7 },
{ time: '02', type: '运单数', temperature: 3.9 },
{ time: '03', type: '订单数', temperature: 6.9 },
{ time: '04', type: '订单数', temperature: 4.2 },
{ time: '05', type: '订单数', temperature: 9.5 },
{ time: '06', type: '订单数', temperature: 5.7 },
{ time: '06', type: '运单数', temperature: 5.7 },
{ time: '07', type: '运单数', temperature: 14.5 },
{ time: '08', type: '订单数', temperature: 8.5 },
{ time: '09', type: '订单数', temperature: 18.4 },
{ time: '10', type: '订单数', temperature: 11.9 },
{ time: '11', type: '订单数', temperature: 21.5 },
{ time: '12', type: '订单数', temperature: 15.2 },
{ time: '08', type: '运单数', temperature: 8.5 },
{ time: '09', type: '运单数', temperature: 18.4 },
{ time: '10', type: '运单数', temperature: 11.9 },
{ time: '11', type: '运单数', temperature: 21.5 },
{ time: '12', type: '订单数', temperature: 15.2 },
];
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();
}, 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: 200,
});
let value: any = []
this.service.request(this.service.$api_getTradingTrend).subscribe((res: any) => {
if(res) {
res.forEach((element: any) => {
value.push({
time: element?.time,
type: element?.type == 'DD' ? '订单数' : '运单数',
temperature: element?.value,
});
});
console.log(value);
this.chartData = value
this.chart.data(this.chartData);
this.chart.scale({
time: {
range: [0, 1],
},
number: {
nice: true,
},
});
this.chart.tooltip({
showCrosshairs: true,
shared: true,
});
this.chart.axis('temperature', {
label: {
formatter: (val: any) => {
return val + '万';
},
},
});
this.chart
.line()
.position('time*temperature')
.color('type')
.shape('smooth');
this.chart
.point()
.position('time*temperature')
.color('type')
.shape('circle');
this.chart.render();
};
});
}
}

View File

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

View File

@ -4,46 +4,71 @@
* @Author : Shiming
* @Date : 2022-04-06 10:57:56
* @LastEditors : Shiming
* @LastEditTime : 2022-04-07 01:26:56
* @LastEditTime : 2022-04-07 19:51:32
* @FilePath : \\tms-obc-web\\src\\app\\routes\\datatable\\components\\datascreen\\datascreen.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved.
-->
<!-- 页头 -->
<!-- <page-header-wrapper [title]="'运营报表'"></page-header-wrapper> -->
<div >
<div style="position: relative;">
<h1 style="display: flex; justify-content: center; align-items: center;margin: 0; padding: 0; font-size: 25px;font-weight: 700;">运多星网络货运平台</h1>
<div style="position: absolute; right: 0; display: flex;">
<img src="../../../../../assets/images/oclock.svg" alt="">&nbsp;
<span style="font-size: 16px; margin-top: 5px;">{{todayTime}}</span>
</div>
</div>
<h1 style="display: flex; justify-content: center; align-items: center;margin: 0; padding: 0;font-size: 25px;font-weight: 700;">实时交易监控</h1>
</div>
<div nz-row [nzGutter]="24">
<div nz-col class="gutter-row" [nzSpan]="8">
<nz-card nzTitle="">
<nz-card nzTitle="2022全年交易情况">
<nz-row [nzGutter]="16">
<nz-col [nzSpan]="12">
<nz-statistic [nzValue]="(1949101 | number)!" [nzTitle]="'成交额'"></nz-statistic>
<nz-statistic [nzValue]="(allDeal?.dealAmount | currency)!" [nzTitle]="'成交额'"></nz-statistic>
</nz-col>
<nz-col [nzSpan]="12">
<nz-statistic [nzValue]="(2019.111 | number: '1.0-2')!" [nzTitle]="'结算额'"></nz-statistic>
<nz-statistic [nzValue]="(allDeal?.settlementAmount | currency)!" [nzTitle]="'结算额'"></nz-statistic>
</nz-col>
</nz-row>
<nz-row [nzGutter]="16">
<nz-col [nzSpan]="12">
<nz-statistic [nzValue]="(1949101 | number)!" [nzTitle]="'订单数'"></nz-statistic>
<nz-statistic [nzValue]="(allDeal?.billQuantity | number)!" [nzTitle]="'订单数'"></nz-statistic>
</nz-col>
<nz-col [nzSpan]="12">
<nz-statistic [nzValue]="(2019.111 | number: '1.0-2')!" [nzTitle]="'货物吞吐()'"></nz-statistic>
<nz-statistic [nzValue]="(allDeal?.weight | number: '1.0-2')!" [nzTitle]="'货物吞吐()'"></nz-statistic>
</nz-col>
</nz-row>
</nz-card>
<nz-card nzTitle="本月交易趋势">
<g2-timeline
[data]="chartData"
[titleMap]="{ y1: '客流量', y2: '支付笔数' }"
[height]="200"
mask="MM月DD日"
[slider]="false"
></g2-timeline>
<nz-card nzTitle="本月交易趋势" >
<app-financetable-curve-min #curve [chartData]='chartData2'></app-financetable-curve-min>
</nz-card>
<nz-card nzTitle="实时货源">
<st #st multiSort bordered [columns]="columns" [ps]="5" [data]="service.$api_listShipperReportPage"
<st
[scroll]="{ y: '300px' }"
#st
multiSort
bordered
[columns]="columns"
[data]="service.$api_getRealTimeSupply"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[page]="{ show: false, showSize: false, pageSizes: [5, 50, 100] }" [loading]="service.http.loading">
[res]="{ reName: { list: 'data' } }"
[page]="{ show: false, showSize: false, pageSizes: [5, 50, 100] }"
[loading]="service.http.loading"
>
<ng-template st-row="index" let-item let-index="index">
{{ index }}
</ng-template>
<ng-template st-row="weight" let-item let-index="index">
{{ item.weight ? item.weight + '吨' : '' }}
{{ item.volume ? item.volume + '方' : '' }}
</ng-template>
<ng-template st-row="weight" let-item let-index="index">
{{ item.weight ? item.weight + '吨' : '' }}
{{ item.volume ? item.volume + '方' : '' }}
</ng-template>
</st>
</nz-card>
</div>
@ -51,20 +76,20 @@
<nz-card>
<nz-row [nzGutter]="24">
<nz-col [nzSpan]="8">
<nz-statistic [nzValue]="(2019.111 | number: '1.0-2')!" [nzTitle]="'今日交易额'"></nz-statistic>
<nz-statistic [nzValue]="(headDeal?.todayAmount | currency)!" [nzTitle]="'今日交易额'"></nz-statistic>
</nz-col>
<nz-col [nzSpan]="8">
<nz-statistic [nzValue]="(1949101 | number)!" [nzTitle]="'本月交易额'"></nz-statistic>
<nz-statistic [nzValue]="(headDeal?.monthAmount | currency)!" [nzTitle]="'本月交易额'"></nz-statistic>
</nz-col>
<nz-col [nzSpan]="8">
<nz-statistic [nzValue]="(2019.111 | number: '1.0-2')!" [nzTitle]="'累计交易额'"></nz-statistic>
<nz-statistic [nzValue]="(headDeal?.cumulativeAmount | currency)!" [nzTitle]="'累计交易额'"></nz-statistic>
</nz-col>
</nz-row>
</nz-card>
<app-datatable-customindex-map style="max-height: 600px;" #map [chartData]="chartData"></app-datatable-customindex-map>
<app-datatable-customindex-map style="max-height: 600px" #map [chartData]="chartData"></app-datatable-customindex-map>
<nz-card>
<nz-row [nzGutter]="24">
<g2-bar height="200" [title]="'销售额趋势'" [data]="salesData" (clickItem)="handleClick($event)"></g2-bar>
<g2-bar #bar height="200" [delay]='500' repaint='true' [title]="'本月发货量排名'" [data]="salesData2" (ready)='genData()'></g2-bar>
</nz-row>
</nz-card>
</div>
@ -72,59 +97,78 @@
<nz-card>
<nz-row [nzGutter]="24">
<nz-col [nzSpan]="6">
<nz-statistic [nzValue]="(1949101 | number)!" [nzTitle]="'货主'"></nz-statistic>
<nz-statistic [nzValue]="(classifyDeal?.enterpriseTotal | number)!" [nzTitle]="'货主'"></nz-statistic>
</nz-col>
<nz-col [nzSpan]="6">
<nz-statistic [nzValue]="(2019.111 | number: '1.0-2')!" [nzTitle]="'合伙人'"></nz-statistic>
<nz-statistic [nzValue]="(classifyDeal?.partnerTotal | number: '1.0-2')!" [nzTitle]="'合伙人'"></nz-statistic>
</nz-col>
<nz-col [nzSpan]="6">
<nz-statistic [nzValue]="(1949101 | number)!" [nzTitle]="'司机'"></nz-statistic>
<nz-statistic [nzValue]="(classifyDeal?.driverTotal | number)!" [nzTitle]="'司机'"></nz-statistic>
</nz-col>
<nz-col [nzSpan]="6">
<nz-statistic [nzValue]="(2019.111 | number: '1.0-2')!" [nzTitle]="'车辆'"></nz-statistic>
<nz-statistic [nzValue]="(classifyDeal?.carTotal | number: '1.0-2')!" [nzTitle]="'车辆'"></nz-statistic>
</nz-col>
</nz-row>
</nz-card>
<nz-card nzTitle="今日交易情况">
<nz-row [nzGutter]="16">
<nz-col [nzSpan]="12">
<nz-statistic [nzValue]="(1949101 | number)!" [nzTitle]="'订单数'"></nz-statistic>
<nz-statistic [nzValue]="(todaysDeal?.billQuantity | number)!" [nzTitle]="'订单数'"></nz-statistic>
</nz-col>
<nz-col [nzSpan]="12">
<nz-statistic [nzValue]="(2019.111 | number: '1.0-2')!" [nzTitle]="'有效订单'"></nz-statistic>
<nz-statistic [nzValue]="(todaysDeal?.billEffectiveQuantity | number: '1.0-2')!" [nzTitle]="'有效订单'"></nz-statistic>
</nz-col>
</nz-row>
<nz-row [nzGutter]="16">
<nz-col [nzSpan]="12">
<nz-statistic [nzValue]="(1949101 | number)!" [nzTitle]="'运输金额()'"></nz-statistic>
<nz-statistic [nzValue]="(todaysDeal?.amount | currency)!" [nzTitle]="'运输金额()'"></nz-statistic>
</nz-col>
<nz-col [nzSpan]="12">
<nz-statistic [nzValue]="(2019.111 | number: '1.0-2')!" [nzTitle]="'货物吞吐()'"></nz-statistic>
<nz-statistic [nzValue]="(todaysDeal?.weight | number: '1.0-2')!" [nzTitle]="'货物吞吐()'"></nz-statistic>
</nz-col>
</nz-row>
</nz-card>
<nz-card nzTitle="本月运营质量监测">
<nz-row [nzGutter]="24">
<nz-col [nzSpan]="6">
<g2-pie percent="28" subTitle="中式快餐" total="28%" height="130"></g2-pie>
<nz-row [nzGutter]="24">
<nz-col [nzSpan]="12">
<div style="width: 200px; display: inline-block">
<g2-pie percent="28" subTitle="准点率" total="28%" height="100"></g2-pie>
</div>
</nz-col>
<nz-col [nzSpan]="6">
<g2-pie percent="28" subTitle="中式快餐" total="28%" height="130"></g2-pie>
<nz-col [nzSpan]="12">
<div style="width: 200px; display: inline-block">
<g2-pie percent="22" subTitle="货损率" total="22%" height="100"></g2-pie>
</div>
</nz-col>
<nz-col [nzSpan]="6">
<g2-pie percent="28" subTitle="中式快餐" total="28%" height="130"></g2-pie>
<nz-col [nzSpan]="12">
<div style="width: 200px; display: inline-block">
<g2-pie percent="22" subTitle="空车率" total="22%" height="100"></g2-pie>
</div>
</nz-col>
<nz-col [nzSpan]="6">
<g2-pie percent="28" subTitle="中式快餐" total="28%" height="130"></g2-pie>
<nz-col [nzSpan]="12">
<div style="width: 200px; display: inline-block">
<g2-pie percent="22" subTitle="结算率" total="22%" height="100" width="200"></g2-pie>
</div>
</nz-col>
</nz-row>
</nz-card>
<nz-card nzTitle="实时运单风控">
<st #st multiSort bordered [columns]="orderColumns" [ps]="5" [data]="service.$api_listShipperReportPage"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqOrderParams }"
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[page]="{ show: false, showSize: false, pageSizes: [5, 50, 100] }" [loading]="service.http.loading">
</st>
<st
#st
multiSort
bordered
[scroll]="{y: '300px'}"
[columns]="orderColumns"
[data]="service.$api_getRealTimeWaybillRiskControl"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqOrderParams }"
[res]="{ reName: { list: 'data' } }"
[page]="{ show: false, showSize: false, pageSizes: [5, 50, 100] }"
[loading]="service.http.loading"
>
<ng-template st-row="carNo" let-item let-index="index">
{{ item?.driverName }}{{ item?.carNo ? '/' + item?.carNo : '' }}
</ng-template>
</st>
</nz-card>
</div>
</div>
</div>

View File

@ -4,5 +4,8 @@
color: #399ffd;
font-weight: bold;
}
.nz-statistic-number,.ant-statistic-content-value {
font-size: 20px;
}
}
}

View File

@ -1,11 +1,11 @@
import { map } from 'rxjs/operators';
/*
* @Description :
* @Description :
* @Version : 1.0
* @Author : Shiming
* @Date : 2022-04-06 10:57:56
* @LastEditors : Shiming
* @LastEditTime : 2022-04-07 09:30:20
* @LastEditTime : 2022-04-07 19:48:19
* @FilePath : \\tms-obc-web\\src\\app\\routes\\datatable\\components\\datascreen\\datascreen.component.ts
* Copyright (C) 2022 huzhenhong. All rights reserved.
*/
@ -14,10 +14,10 @@ import { STColumn, STComponent } from '@delon/abc/st';
import { SFSchema } from '@delon/form';
import { ModalHelper, _HttpClient } from '@delon/theme';
import { DataService } from '../../services/data.service';
import { DatatableCustomindexMapComponent } from './curve/map.component';
import { G2TimelineData } from '@delon/chart/timeline';
import { DatatableCustomindexMapComponent } from './map/map.component';
import { G2TimelineComponent, G2TimelineData } from '@delon/chart/timeline';
import { G2MiniAreaClickItem, G2MiniAreaData } from '@delon/chart/mini-area';
import { format } from 'date-fns';
import { FinanceTableCurveComponent } from '../financetable/curve/curve.component';
@Component({
@ -29,90 +29,121 @@ export class DatatableDatascreenComponent implements OnInit {
@ViewChild('st') private readonly st!: STComponent;
@ViewChild('orderSt') private readonly orderSt!: STComponent;
@ViewChild('map') private readonly map!: DatatableCustomindexMapComponent;
columns: STColumn[] = [];
chartData: G2TimelineData[] = [];
orderColumns: STColumn[] = [];
salesData = this.genData();
constructor(public service: DataService) {
}
@ViewChild('timeline', { static: false }) timeline!: G2TimelineComponent;
@ViewChild('curve') private readonly curve!: FinanceTableCurveComponent;
columns: STColumn[] = [];
chartData: any[] = [];
orderColumns: STColumn[] = [];
chartData2: any = {}
allDeal: any;
headDeal: any;
classifyDeal: any;
todaysDeal: any;
todayTime: string = '';
monthData: G2TimelineData[] = [];
monthData2:G2TimelineData[] =[];
salesData2: Array<any> = this.genData();
constructor(public service: DataService) {}
ngOnChanges(changes: any): void {
console.log(changes);
}
/**
* 查询参数
*/
get reqOrderParams() {
const params = {
}
const params = {};
return { ...params };
}
get reqParams() {
const params = {
}
const params = {};
return { ...params };
}
ngOnInit(): void {
this.initST()
this.initOrderST()
this.initData()
this.initLineData()
setInterval(() => {
this.setTime();
}, 1000);
this.initST();
this.initOrderST();
this.initData();
// this.initLineData();
}
initData(){
setTime() {
var myDate = new Date();
var mytime = myDate.toLocaleTimeString(); //获取当前时间
myDate.getFullYear(); //获取完整的年份(4位,1970-????)
myDate.getMonth(); //获取当前月份(0-11,0代表1月)
myDate.getDate(); //获取当前日(1-31)
this.todayTime = myDate.getFullYear() + '-' + myDate.getMonth() + 1 + '-' + myDate.getDate() + ' ' + mytime;
}
initData() {
this.service.request(this.service.$api_getAnnualTransactions).subscribe((res: any) => {
this.allDeal = res;
});
this.service.request(this.service.$api_getTransactionAmount).subscribe((res: any) => {
this.headDeal = res;
});
this.service.request(this.service.$api_getCustomerStatistics).subscribe((res: any) => {
this.classifyDeal = res;
});
this.service.request(this.service.$api_getTradingToday).subscribe((res: any) => {
this.todaysDeal = res;
});
let value: any = [];
this.service.request(this.service.$api_getTransactionDistribution).subscribe((res: any) => {
if (res) {
res.forEach((element: any) => {
value.push({
name: element.province,
value: element.weight
});
});
console.log(value);
this.chartData = value;
this.map.reRender();
}
});
}
public genData(): G2MiniAreaData[] {
let value: any = [];
this.service.request(this.service.$api_getShipmentRanking).subscribe((res: any) => {
console.log(res);
})
}
initLineData(){
for (let i = 0; i < 20; i += 1) {
this.chartData.push({
time: new Date().getTime() + 1000 * 60 * 60 * 24 * i,
y1: Math.floor(Math.random() * 100) + 1000,
y2: Math.floor(Math.random() * 100) + 10,
res.forEach((element: any) => {
value.push({
x: element.city,
y: element.weight
});
});
}
});
console.log(value);
return value;
}
private genData(): G2MiniAreaData[] {
const beginDay = new Date().getTime();
const res: G2MiniAreaData[] = [];
for (let i = 0; i < 20; i += 1) {
res.push({
x: format(new Date(beginDay + 1000 * 60 * 60 * 24 * i), 'yyyy-MM-dd'),
y: Math.floor(Math.random() * 100) + 10,
});
}
return res;
initPillarData(){
this.curve.reRender()
}
/**
* 初始化数据列表
*/
* 初始化数据列表
*/
initST() {
this.columns = [
{ title: '序号', index: 'carNo', className: 'text-center' },
{ title: '发货地', index: 'carNoColorLabel', className: 'text-center' },
{ title: '卸货地', index: 'carModelLabel', className: 'text-center' },
{ title: '货物', index: 'carStatus', className: 'text-center'},
{ title: '数量', index: 'approvalStatus', className: 'text-center' },
{ title: '序号', render: 'index', className: 'text-center', width: '70px' },
{ title: '发货地', index: 'loadAddress', className: 'text-center', width: '90px' },
{ title: '卸货地', index: 'dischargeAddress', className: 'text-center', width: '90px' },
{ title: '货物', index: 'goodsName', className: 'text-center', width: '90px' },
{ title: '数量', render: 'weight', className: 'text-center', width: '120px' }
];
console.log(this.map);
setTimeout(() => {
if(this.map) {
this.map.reRender()
}
}, 500);
}
initOrderST() {
this.orderColumns = [
{ title: '运单号', index: 'carNo', className: 'text-center' },
{ title: '货主', index: 'carNoColorLabel', className: 'text-center' },
{ title: '时间', index: 'carModelLabel', className: 'text-center' },
{ title: '风险等级', index: 'carStatus', className: 'text-center'}
{ title: '运单号', index: 'wayCode', className: 'text-center', width: '150px' },
{ title: '司机/车辆', index: 'carNo', className: 'text-center', width: '120px' },
{ title: '货主', index: 'shipperName', className: 'text-center', width: '70px' },
{ title: '时间', index: 'createTime', className: 'text-center', width: '200px' },
{ title: '异常预警', index: 'warningTypeLabel', className: 'text-center', width: '120px' }
];
}
handleClick(data: G2MiniAreaClickItem): void {
this.service.msgSrv.info(`${data.item.x} - ${data.item.y}`);
}

View File

@ -0,0 +1,11 @@
<!--
* @Description :
* @Version : 1.0
* @Author : Shiming
* @Date : 2022-04-06 17:57:07
* @LastEditors : Shiming
* @LastEditTime : 2022-04-07 19:44:32
* @FilePath : \\tms-obc-web\\src\\app\\routes\\datatable\\components\\datascreen\\map\\map.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved.
-->
<g2-custom delay="200" (render)="render($event)" ></g2-custom>

View File

@ -49,7 +49,7 @@ export class DatatableCustomindexMapComponent implements OnInit, OnChanges {
this.chart = new Chart({
container: el,
autoFit: true,
height: 540,
height: 680,
padding: [0, 0]
});
this.chart.tooltip({
@ -87,16 +87,27 @@ export class DatatableCustomindexMapComponent implements OnInit, OnChanges {
});
// 可视化用户数据
this.userData = [
{ name: '山东', value: '21',trend:'#F51D27' },
{ name: '山东', value: 22},
{ name: '广东', value: 20,trend:'#0A61D7' },
{ name: '广东', value: 20 },
{ name: '四川', value: 120 },
{ name: '湖南', value: 200 },
{ name: '河北', value: 30 },
// this.userData = [
// { name: '山东', value: 21 },
// { name: '山东', value: 22},
// { name: '广东', value: 20, },
// { name: '广东', value: 20 },
// { name: '四川', value: 120 },
// { name: '湖南', value: 200 },
// { name: '河北', value: 30 },
];
// ];
let value: any = []
this.service.request(this.service.$api_getTransactionDistribution).subscribe((res: any) => {
if(res) {
res.forEach((element: any) => {
value.push({
name: element.province,
value: element.weight,
});
});
console.log(value);
this.userData = value
this.userDv = this.ds.createView().source(this.userData).transform({
geoDataView: this.worldMap,
field: 'name',
@ -105,31 +116,37 @@ export class DatatableCustomindexMapComponent implements OnInit, OnChanges {
}).transform({
type: 'map',
callback: (obj: { trend: string; value: number }) => {
obj.trend = obj.value > 100 ? '蓝色地区' : '红色地区';
if(obj.value < 500) {
obj.trend = '500以下';
} else if(obj.value >= 500 && obj.value < 1000){
obj.trend = '500-1000';
} else if(obj.value >= 1000 ){
obj.trend = '>1000';
}
return obj;
}
});
this.userView = this.chart.createView();
this.userView.data(this.userDv.rows);
// this.userView.scale({
// trend: {
// alias: '蓝色地区数量'
// }
// });
this.userView.scale({
trend: {
alias: '蓝色地区数量'
}
});
console.log(this.userView);
console.log('45545');
this.userView.polygon().position('longitude*latitude').color('trend', ['#000', '#76ddb2']).tooltip('').style({fillOpacity: 0.85 })
// .animate({
// leave: {
// animation: 'fade-out'
// }
// });
this.userView.polygon().position('longitude*latitude').color('trend', ['#0a3f80', '#1b6aca', '#5d93d4']).tooltip('name*trend*value').style({fillOpacity: 0.85 })
.animate({
leave: {
animation: 'fade-out'
}
});
this.userView.interaction('element-active');
this.chart.render();
}
})
});
console.log('9999');