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/delon/simple-table/simple-table.component.ts | 74 +++++++++++++++++++++++++++++++++++++ 1 files changed, 74 insertions(+), 0 deletions(-) diff --git a/src/app/routes/delon/simple-table/simple-table.component.ts b/src/app/routes/delon/simple-table/simple-table.component.ts new file mode 100644 index 0000000..99b5aea --- /dev/null +++ b/src/app/routes/delon/simple-table/simple-table.component.ts @@ -0,0 +1,74 @@ +import { Component, OnInit, OnDestroy } from '@angular/core'; +import { NzMessageService } from 'ng-zorro-antd'; +import { map } from 'rxjs/operators'; +import { + SimpleTableChange, + SimpleTableColumn, + SimpleTableButton, +} from '@delon/abc'; +import { _HttpClient } from '@delon/theme'; + +@Component({ + selector: 'app-simple-table', + templateUrl: './simple-table.component.html', +}) +export class SimpleTableComponent implements OnInit { + ps = 20; + total = 200; // mock total + args: any = { _allow_anonymous: true }; + url = `https://api.randomuser.me/?results=20`; + events: any[] = []; + scroll = { y: '230px' }; + columns: SimpleTableColumn[] = [ + { title: 'id', index: 'id.value', type: 'checkbox' }, + { title: 'Avatar', index: 'picture.thumbnail', type: 'img', width: '80px' }, + { + title: 'Name', + index: 'name.first', + width: '150px', + format: (item: any) => `${item.name.first} ${item.name.last}`, + type: 'link', + click: (item: any) => this.message.info(`${item.name.first}`), + }, + { title: 'Email', index: 'email' }, + { + title: 'Gender', + index: 'gender', + type: 'yn', + ynTruth: 'female', + ynYes: '���', + ynNo: '���', + width: '120px', + }, + { title: 'Events', render: 'events', width: '90px' }, + { title: 'Registered', index: 'registered', type: 'date', width: '150px' }, + { + title: 'Actions', + width: '120px', + buttons: <SimpleTableButton[]>[ + { + text: 'Edit', + click: (item: any) => this.message.info(`edit [${item.id.value}]`), + if: (item: any) => item.gender === 'female', + }, + { + text: 'Delete', + type: 'del', + click: (item: any) => this.message.info(`deleted [${item.id.value}]`), + }, + ], + }, + ]; + + constructor(public http: _HttpClient, private message: NzMessageService) {} + + ngOnInit(): void { + this.http + .get('/chart/visit') + .subscribe((res: any[]) => (this.events = res.slice(0, 8))); + } + + fullChange(val: boolean) { + this.scroll = val ? { y: '350px' } : { y: '230px' }; + } +} -- Gitblit v1.8.0