From c69ddde7828d777f04c6468c269aaa0aa03d72c9 Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Thu, 02 Aug 2018 09:50:58 +0800 Subject: [PATCH] 文件修改 --- src/app/routes/dashboard/analysis/analysis.component.ts | 82 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 82 insertions(+), 0 deletions(-) diff --git a/src/app/routes/dashboard/analysis/analysis.component.ts b/src/app/routes/dashboard/analysis/analysis.component.ts new file mode 100644 index 0000000..0bc230f --- /dev/null +++ b/src/app/routes/dashboard/analysis/analysis.component.ts @@ -0,0 +1,82 @@ +import { HttpClient } from '@angular/common/http'; +import { Component, OnInit } from '@angular/core'; +import { NzMessageService } from 'ng-zorro-antd'; +import { getTimeDistance, yuan } from '@delon/abc'; +import { _HttpClient } from '@delon/theme'; + +@Component({ + selector: 'app-dashboard-analysis', + templateUrl: './analysis.component.html', + styleUrls: ['./analysis.component.less'] +}) +export class DashboardAnalysisComponent implements OnInit { + + data: any = { + salesData: [], + offlineData: [] + }; + loading = true; + q: any = { + start: null, + end: null + }; + rankingListData: any[] = Array(7).fill({}).map((item, i) => { + return { + title: `��������� ${i} ������`, + total: 323234 + }; + }); + + constructor(private http: _HttpClient, public msg: NzMessageService, + private http2: HttpClient) {} + + ngOnInit() { + // this.http.get('/chart').subscribe((res: any) => { + // res.offlineData.forEach((item: any) => { + // item.chart = Object.assign([], res.offlineChartData); + // }); + // this.data = res; + // this.loading = false; + // this.changeSaleType(); + // }); + } + + setDate(type: any) { + const rank = getTimeDistance(type); + this.q.start = rank[0]; + this.q.end = rank[1]; + } + + sort(sortName, sortValue) { + this.data.searchData = [ + ...(<any[]>this.data.searchData).sort((a, b) => { + if (a[ sortName ] > b[ sortName ]) { + return (sortValue === 'ascend') ? 1 : -1; + } else if (a[ sortName ] < b[ sortName ]) { + return (sortValue === 'ascend') ? -1 : 1; + } else { + return 0; + } + }) + ]; + } + + salesType = 'all'; + salesPieData: any; + salesTotal = 0; + changeSaleType() { + this.salesPieData = this.salesType === 'all' ? this.data.salesTypeData : ( + this.salesType === 'online' ? this.data.salesTypeDataOnline : this.data.salesTypeDataOffline + ); + if (this.salesPieData) this.salesTotal = this.salesPieData.reduce((pre, now) => now.y + pre, 0); + } + + handlePieValueFormat(value: any) { + return yuan(value); + } + + _activeTab = 0; + _tabChange(value: any) { + console.log('tab', this._activeTab, value); + } +} -- Gitblit v1.8.0