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/pro/list/applications/applications.component.ts | 76 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 76 insertions(+), 0 deletions(-) diff --git a/src/app/routes/pro/list/applications/applications.component.ts b/src/app/routes/pro/list/applications/applications.component.ts new file mode 100644 index 0000000..404eeab --- /dev/null +++ b/src/app/routes/pro/list/applications/applications.component.ts @@ -0,0 +1,76 @@ +import { Component, OnInit } from '@angular/core'; +import { NzMessageService } from 'ng-zorro-antd'; +import { _HttpClient } from '@delon/theme'; + +@Component({ + selector: 'pro-list-applications', + templateUrl: './applications.component.html', + styleUrls: ['./applications.component.less'], +}) +export class ProListApplicationsComponent implements OnInit { + q: any = { + ps: 8, + categories: [], + owners: ['zxx'], + }; + + list: any[] = []; + + loading = true; + + // region: cateogry + categories = [ + { id: 0, text: '������', value: false }, + { id: 1, text: '���������', value: false }, + { id: 2, text: '���������', value: false }, + { id: 3, text: '���������', value: false }, + { id: 4, text: '���������', value: false }, + { id: 5, text: '���������', value: false }, + { id: 6, text: '���������', value: false }, + { id: 7, text: '���������', value: false }, + { id: 8, text: '���������', value: false }, + { id: 9, text: '���������', value: false }, + { id: 10, text: '���������', value: false }, + { id: 11, text: '������������', value: false }, + { id: 12, text: '������������', value: false }, + ]; + + changeCategory(status: boolean, idx: number) { + if (idx === 0) { + this.categories.map(i => (i.value = status)); + } else { + this.categories[idx].value = status; + } + this.getData(); + } + // endregion + + constructor(private http: _HttpClient, public msg: NzMessageService) {} + + ngOnInit() { + this.getData(); + } + + getData() { + this.loading = true; + this.http.get('/api/list', { count: this.q.ps }).subscribe((res: any) => { + this.list = res.map(item => { + item.activeUser = this.formatWan(item.activeUser); + return item; + }); + this.loading = false; + }); + } + + private formatWan(val) { + const v = val * 1; + if (!v || isNaN(v)) return ''; + + let result = val; + if (val > 10000) { + result = Math.floor(val / 10000); + result = `${result}`; + } + return result; + } +} -- Gitblit v1.8.0