168 lines
5.3 KiB
TypeScript
168 lines
5.3 KiB
TypeScript
import { map } from 'rxjs/operators';
|
|
/*
|
|
* @Description :
|
|
* @Version : 1.0
|
|
* @Author : Shiming
|
|
* @Date : 2022-04-06 10:57:56
|
|
* @LastEditors : Shiming
|
|
* @LastEditTime : 2022-04-07 15:16:53
|
|
* @FilePath : \\tms-obc-web\\src\\app\\routes\\datatable\\components\\datascreen\\datascreen.component.ts
|
|
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
|
*/
|
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
|
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 { G2MiniAreaClickItem, G2MiniAreaData } from '@delon/chart/mini-area';
|
|
import { format } from 'date-fns';
|
|
|
|
|
|
@Component({
|
|
selector: 'app-datatable-datascreen',
|
|
templateUrl: './datascreen.component.html',
|
|
styleUrls: ['./datascreen.component.less']
|
|
})
|
|
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: any[] = [];
|
|
orderColumns: STColumn[] = [];
|
|
allDeal: any;
|
|
headDeal: any;
|
|
classifyDeal: any;
|
|
todaysDeal: any;
|
|
|
|
monthData: G2TimelineData[] = [];
|
|
salesData :any;
|
|
salesData2 :any = this.genData();
|
|
constructor(public service: DataService) {
|
|
|
|
}
|
|
|
|
/**
|
|
* 查询参数
|
|
*/
|
|
get reqOrderParams() {
|
|
const params = {
|
|
|
|
}
|
|
return { ...params };
|
|
}
|
|
get reqParams() {
|
|
const params = {
|
|
}
|
|
return { ...params };
|
|
}
|
|
ngOnInit(): void {
|
|
this.initST()
|
|
this.initOrderST()
|
|
this.initData()
|
|
this.initLineData()
|
|
}
|
|
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()
|
|
}
|
|
})
|
|
}
|
|
initLineData(){
|
|
this.service.request(this.service.$api_getTradingTrend).subscribe((res: any) => {
|
|
this.monthData = res
|
|
// for (let i = 0; i < 20; i += 1) {
|
|
// this.monthData.push({
|
|
// time: new Date().getTime() + 1000 * 60 * 60 * 24 * i,
|
|
// y1: Math.floor(Math.random() * 100) + 1000,
|
|
// y2: Math.floor(Math.random() * 100) + 10,
|
|
// });
|
|
// }
|
|
})
|
|
this.service.request(this.service.$api_getTradingTrend).subscribe((res: any) => {
|
|
this.monthData = res
|
|
// for (let i = 0; i < 20; i += 1) {
|
|
// this.monthData.push({
|
|
// time: new Date().getTime() + 1000 * 60 * 60 * 24 * i,
|
|
// y1: Math.floor(Math.random() * 100) + 1000,
|
|
// y2: Math.floor(Math.random() * 100) + 10,
|
|
// });
|
|
// }
|
|
})
|
|
let value: any = []
|
|
this.service.request(this.service.$api_getShipmentRanking).subscribe((res: any) => {
|
|
console.log(res);
|
|
res.forEach((element: any) => {
|
|
value.push({
|
|
x: element.city,
|
|
y: element.weight,
|
|
});
|
|
});
|
|
this.salesData = value
|
|
console.log(this.salesData);
|
|
})
|
|
}
|
|
public genData(): G2MiniAreaData[] {
|
|
let value: any = []
|
|
this.service.request(this.service.$api_getShipmentRanking).subscribe((res: any) => {
|
|
console.log(res);
|
|
res.forEach((element: any) => {
|
|
value.push({
|
|
x: element.city,
|
|
y: element.weight,
|
|
});
|
|
});
|
|
})
|
|
console.log(value);
|
|
return value;
|
|
}
|
|
/**
|
|
* 初始化数据列表
|
|
*/
|
|
initST() {
|
|
this.columns = [
|
|
{ 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' },
|
|
];
|
|
}
|
|
initOrderST() {
|
|
this.orderColumns = [
|
|
{ title: '运单号', index: 'wayCode', className: 'text-center',width: '120px' },
|
|
{ title: '货主', index: 'shipperName', className: 'text-center',width: '70px' },
|
|
{ title: '时间', index: 'createTime', className: 'text-center',width: '200px' },
|
|
{ title: '风险等级', index: 'warningType', className: 'text-center',width: '90px'}
|
|
];
|
|
}
|
|
|
|
handleClick(data: G2MiniAreaClickItem): void {
|
|
this.service.msgSrv.info(`${data.item.x} - ${data.item.y}`);
|
|
}
|
|
}
|