解决冲突

This commit is contained in:
wangshiming
2022-04-07 16:59:19 +08:00
parent 465ae51f6c
commit deec1b0bd6
3 changed files with 41 additions and 50 deletions

View File

@ -5,7 +5,7 @@ import { map } from 'rxjs/operators';
* @Author : Shiming
* @Date : 2022-04-06 10:57:56
* @LastEditors : Shiming
* @LastEditTime : 2022-04-07 16:31:17
* @LastEditTime : 2022-04-07 16:58:19
* @FilePath : \\tms-obc-web\\src\\app\\routes\\datatable\\components\\datascreen\\datascreen.component.ts
* Copyright (C) 2022 huzhenhong. All rights reserved.
*/
@ -37,10 +37,10 @@ export class DatatableDatascreenComponent implements OnInit {
headDeal: any;
classifyDeal: any;
todaysDeal: any;
todayTime: string ='';
todayTime: string = '';
monthData: G2TimelineData[] = [];
salesData: any;
monthData2: Array<any> = this.genData2();
salesData2: Array<any> = this.genData();
constructor(public service: DataService) {}
ngOnChanges(changes: any): void {
@ -58,16 +58,15 @@ export class DatatableDatascreenComponent implements OnInit {
return { ...params };
}
ngOnInit(): void {
setInterval(() => {
this.setTime()
},1000)
this.setTime();
}, 1000);
this.initST();
this.initOrderST();
this.initData();
this.initLineData();
// this.initLineData();
}
setTime () {
setTime() {
var myDate = new Date();
var mytime = myDate.toLocaleTimeString(); //获取当前时间
myDate.getFullYear(); //获取完整的年份(4位,1970-????)
@ -103,43 +102,16 @@ export class DatatableDatascreenComponent implements OnInit {
}
});
}
initLineData() {
this.service.request(this.service.$api_getTradingTrend).subscribe((res: any) => {
this.monthData = res;
if (this.timeline) {
console.log(this.timeline);
// 等待组件渲染
setTimeout(() => this.timeline.changeData());
}
// 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;
// if (this.pie) {
// // 等待组件渲染
// setTimeout(() => {
// console.log('a')
// this.pie.changeData()
// });
// }
console.log(this.salesData);
});
}
// initLineData() {
// this.service.request(this.service.$api_getTradingTrend).subscribe((res: any) => {
// this.monthData = res;
// if (this.timeline) {
// console.log(this.timeline);
// // 等待组件渲染
// setTimeout(() => this.timeline.changeData(), 100);
// }
// });
// }
public genData(): G2MiniAreaData[] {
let value: any = [];
this.service.request(this.service.$api_getShipmentRanking).subscribe((res: any) => {
@ -154,6 +126,25 @@ export class DatatableDatascreenComponent implements OnInit {
console.log(value);
return value;
}
private genData2(): G2TimelineData[] {
let ress: G2TimelineData[] = [];
this.service.request(this.service.$api_getTradingTrend).subscribe((res: any) => {
if (res) {
res.forEach((element: any) => {
ress.push({
time: element.time,
y1: element.billQuantity,
y2: element.wayBillQuantity
});
});
console.log(ress);
}
});
if(!ress) {
setTimeout(() => {},100)
}
return ress;
}
/**
* 初始化数据列表
*/