From 12b04f145bae740e1971036b1e2dfc1bc224d17b Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Wed, 11 Jul 2018 14:38:47 +0800 Subject: [PATCH] Revert "框架调整" --- src/app/routes/dashboard/analysis/analysis.component.ts | 88 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 88 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..fa81d14 --- /dev/null +++ b/src/app/routes/dashboard/analysis/analysis.component.ts @@ -0,0 +1,88 @@ +import { Component, OnInit } from '@angular/core'; +import { NzMessageService } from 'ng-zorro-antd'; +import { SimpleTableColumn } from '@delon/abc'; +import { getTimeDistance, yuan } from '@delon/util'; +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; + date_range: Date[] = []; + rankingListData: any[] = Array(7) + .fill({}) + .map((item, i) => { + return { + title: `��������� ${i} ������`, + total: 323234, + }; + }); + searchColumn: SimpleTableColumn[] = [ + { title: '������', index: 'index' }, + { + title: '���������������', + index: 'keyword', + click: (item: any) => this.msg.success(item.keyword), + }, + { + type: 'number', + title: '���������', + index: 'count', + sorter: (a, b) => a.count - b.count, + }, + { + type: 'number', + title: '���������', + index: 'range', + render: 'range', + sorter: (a, b) => a.range - b.range, + }, + ]; + + constructor(private http: _HttpClient, public msg: NzMessageService) {} + + 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) { + this.date_range = getTimeDistance(type); + } + + 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