152 lines
5.0 KiB
TypeScript
152 lines
5.0 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-14 16:21:00
|
|
* @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 './map/map.component';
|
|
import { G2TimelineComponent, G2TimelineData } from '@delon/chart/timeline';
|
|
import { G2MiniAreaClickItem, G2MiniAreaData } from '@delon/chart/mini-area';
|
|
import { FinanceTableCurveComponent } from '../financetable/curve/curve.component';
|
|
|
|
|
|
@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;
|
|
@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> = [];
|
|
constructor(public service: DataService) {}
|
|
ngOnChanges(changes: any): void {
|
|
console.log(changes);
|
|
}
|
|
/**
|
|
* 查询参数
|
|
*/
|
|
get reqOrderParams() {
|
|
const params = {};
|
|
return { ...params };
|
|
}
|
|
get reqParams() {
|
|
const params = {};
|
|
return { ...params };
|
|
}
|
|
ngOnInit(): void {
|
|
setInterval(() => {
|
|
this.setTime();
|
|
}, 1000);
|
|
this.initST();
|
|
this.initOrderST();
|
|
this.initData();
|
|
// this.initLineData();
|
|
}
|
|
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.initPillarData()
|
|
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();
|
|
}
|
|
});
|
|
}
|
|
genData(): any{
|
|
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.salesData2 = value
|
|
});
|
|
}
|
|
initPillarData(){
|
|
// this.curve.reRender()
|
|
this.genData();
|
|
}
|
|
/**
|
|
* 初始化数据列表
|
|
*/
|
|
initST() {
|
|
this.columns = [
|
|
{ title: '序号', render: 'index', className: 'text-center', },
|
|
{ title: '发货地', index: 'loadAddress', className: 'text-center', },
|
|
{ title: '卸货地', index: 'dischargeAddress', className: 'text-center',},
|
|
{ title: '货物', index: 'goodsName', className: 'text-center', },
|
|
{ title: '数量', render: 'weight', className: 'text-center',}
|
|
];
|
|
}
|
|
initOrderST() {
|
|
this.orderColumns = [
|
|
{ title: '运单号', index: 'wayCode', className: 'text-center', },
|
|
{ title: '司机/车辆', index: 'carNo', className: 'text-center', },
|
|
{ title: '货主', index: 'shipperName', className: 'text-center', },
|
|
{ title: '时间', index: 'createTime', className: 'text-center', },
|
|
{ title: '异常预警', index: 'warningTypeLabel', className: 'text-center',}
|
|
];
|
|
}
|
|
|
|
handleClick(data: G2MiniAreaClickItem): void {
|
|
this.service.msgSrv.info(`${data.item.x} - ${data.item.y}`);
|
|
}
|
|
}
|