From 5933685ea11e748cca2f5c13b79abc2b1ffa32a2 Mon Sep 17 00:00:00 2001
From: 沈斌 <bluelazysb@hotmail.com>
Date: Mon, 18 Dec 2017 20:20:01 +0800
Subject: [PATCH] updates
---
src/assets/users-installer-data.json | 605 ++++++++++++++++++++++++++++++++++++++++++++++++++
src/app/routes/users/installer/installer.component.html | 9
src/app/routes/users/users.module.ts | 4
src/app/routes/users/installer/installer.component.ts | 58 ++--
4 files changed, 649 insertions(+), 27 deletions(-)
diff --git a/src/app/routes/users/installer/installer.component.html b/src/app/routes/users/installer/installer.component.html
index 0f5ba69..b28c063 100644
--- a/src/app/routes/users/installer/installer.component.html
+++ b/src/app/routes/users/installer/installer.component.html
@@ -39,7 +39,14 @@
</span>
</nz-alert>
</div>
- <nz-table #nzTable [nzDataSource]="data" [nzPageSize]="q.ps" [nzLoading]="loading" (nzDataChange)="dataChange($event)" (nzPageIndexChange)="pageChange($event)" [nzShowTotal]="true">
+ <nz-table #nzTable
+ [nzAjaxData]="data"
+ [nzLoading]="http.loading"
+ [nzTotal]="total"
+ [(nzPageIndex)]="q.pi"
+ [nzPageSize]="q.ps"
+ [nzShowTotal]="true"
+ (nzPageIndexChange)="load()">
<thead nz-thead>
<tr>
<th nz-th [nzCheckbox]="true">
diff --git a/src/app/routes/users/installer/installer.component.ts b/src/app/routes/users/installer/installer.component.ts
index af60ea2..51d9a85 100644
--- a/src/app/routes/users/installer/installer.component.ts
+++ b/src/app/routes/users/installer/installer.component.ts
@@ -1,6 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { NzMessageService } from 'ng-zorro-antd';
+import { ModalHelper } from '@delon/theme';
+import { _HttpClient } from '@delon/theme';
import { getInstaller, deleteInstaller } from '../../../../../_mock/installer.service';
+import * as moment from 'moment';
@Component({
selector: 'app-installer',
@@ -17,7 +20,7 @@
u_mobile: ''
};
data: any[] = [];
- loading = false;
+ total: 0;
selectedRows: any[] = [];
curRows: any[] = [];
allChecked = false;
@@ -26,15 +29,36 @@
sortMap: any = {};
modalVisible = false;
- constructor(public msg: NzMessageService) {}
+ constructor(
+ public msg: NzMessageService,
+ public http: _HttpClient,
+ private modalHelper: ModalHelper) {}
ngOnInit() {
- this.getData();
+ this.load();
}
- getData() {
- this.pageChange(1).then(() => {
- this.data = getInstaller(this.q);
+ load(reload: boolean = false) {
+ if (reload) {
+ this.q.pi = 1;
+ }
+ this.http.get('./assets/users-installer-data.json', this.q).subscribe((res: any) => {
+ const data = res.data;
+ const total = res.total;
+
+ if (this.q.sorter !== '') {
+ const s = this.q.sorter.split('_');
+ data.sort((prev, next) => {
+ if (s[1] === 'descend') {
+ return moment(next[s[0]]).unix() - moment(prev[s[0]]).unix();
+ }
+ return moment(prev[s[0]]).unix() - moment(next[s[0]]).unix();
+ });
+ }
+
+ const start = (this.q.pi - 1) * this.q.ps;
+ this.data = data.slice(start, start + this.q.ps);
+ this.total = total;
});
}
@@ -48,7 +72,7 @@
remove() {
this.selectedRows.forEach(i => deleteInstaller(i.name));
- this.getData();
+ this.load(true);
}
checkAll(value: boolean) {
@@ -70,27 +94,11 @@
this.sortMap = {};
this.sortMap[field] = value;
this.q.sorter = value ? `${field}_${value}` : '';
- this.getData();
- }
-
- dataChange(res: any) {
- this.curRows = res;
- this.refreshStatus();
- }
-
- pageChange(pi: number): Promise<any> {
- this.q.pi = pi;
- this.loading = true;
- return new Promise((resolve) => {
- setTimeout(() => {
- this.loading = false;
- resolve();
- }, 500);
- });
+ this.load(true);
}
reset(ls: any[]) {
for (const item of ls) item.value = false;
- this.getData();
+ this.load(true);
}
}
diff --git a/src/app/routes/users/users.module.ts b/src/app/routes/users/users.module.ts
index 859a284..d82f4af 100644
--- a/src/app/routes/users/users.module.ts
+++ b/src/app/routes/users/users.module.ts
@@ -5,6 +5,7 @@
import { SharedModule } from '@shared/shared.module';
import { ReceiverComponent } from './receiver/receiver.component';
+import { EditComponent } from './installer/edit/edit.component';
const routes: Routes = [
{
@@ -24,7 +25,8 @@
],
declarations: [
InstallerComponent,
- ReceiverComponent
+ ReceiverComponent,
+ EditComponent
]
})
export class UsersModule { }
diff --git a/src/assets/users-installer-data.json b/src/assets/users-installer-data.json
new file mode 100644
index 0000000..3655a34
--- /dev/null
+++ b/src/assets/users-installer-data.json
@@ -0,0 +1,605 @@
+{
+ "total": 50,
+ "data": [
+ {
+ "key": 0,
+ "name": "������1",
+ "sex": "���",
+ "mobile": 13713713777,
+ "email": "test_1@test.com",
+ "weixin": "test1",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������1",
+ "nickname": "������1",
+ "updatedAt": "2017-06-30T16:00:00.000Z"
+ },
+ {
+ "key": 1,
+ "name": "������2",
+ "sex": "���",
+ "mobile": 13713713778,
+ "email": "test_2@test.com",
+ "weixin": "test2",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������2",
+ "nickname": "������2",
+ "updatedAt": "2017-06-30T16:00:00.000Z"
+ },
+ {
+ "key": 2,
+ "name": "������3",
+ "sex": "���",
+ "mobile": 13713713779,
+ "email": "test_3@test.com",
+ "weixin": "test3",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������3",
+ "nickname": "������3",
+ "updatedAt": "2017-07-01T16:00:00.000Z"
+ },
+ {
+ "key": 3,
+ "name": "������4",
+ "sex": "���",
+ "mobile": 13713713780,
+ "email": "test_4@test.com",
+ "weixin": "test4",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������4",
+ "nickname": "������4",
+ "updatedAt": "2017-07-01T16:00:00.000Z"
+ },
+ {
+ "key": 4,
+ "name": "������5",
+ "sex": "���",
+ "mobile": 13713713781,
+ "email": "test_5@test.com",
+ "weixin": "test5",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������5",
+ "nickname": "������5",
+ "updatedAt": "2017-07-02T16:00:00.000Z"
+ },
+ {
+ "key": 5,
+ "name": "������6",
+ "sex": "���",
+ "mobile": 13713713782,
+ "email": "test_6@test.com",
+ "weixin": "test6",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������6",
+ "nickname": "������6",
+ "updatedAt": "2017-07-02T16:00:00.000Z"
+ },
+ {
+ "key": 6,
+ "name": "������7",
+ "sex": "���",
+ "mobile": 13713713783,
+ "email": "test_7@test.com",
+ "weixin": "test7",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������7",
+ "nickname": "������7",
+ "updatedAt": "2017-07-03T16:00:00.000Z"
+ },
+ {
+ "key": 7,
+ "name": "������8",
+ "sex": "���",
+ "mobile": 13713713784,
+ "email": "test_8@test.com",
+ "weixin": "test8",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������8",
+ "nickname": "������8",
+ "updatedAt": "2017-07-03T16:00:00.000Z"
+ },
+ {
+ "key": 8,
+ "name": "������9",
+ "sex": "���",
+ "mobile": 13713713785,
+ "email": "test_9@test.com",
+ "weixin": "test9",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������9",
+ "nickname": "������9",
+ "updatedAt": "2017-07-04T16:00:00.000Z"
+ },
+ {
+ "key": 9,
+ "name": "������10",
+ "sex": "���",
+ "mobile": 13713713786,
+ "email": "test_10@test.com",
+ "weixin": "test10",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������10",
+ "nickname": "������10",
+ "updatedAt": "2017-07-04T16:00:00.000Z"
+ },
+ {
+ "key": 10,
+ "name": "������11",
+ "sex": "���",
+ "mobile": 13713713787,
+ "email": "test_11@test.com",
+ "weixin": "test11",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������11",
+ "nickname": "������11",
+ "updatedAt": "2017-07-05T16:00:00.000Z"
+ },
+ {
+ "key": 11,
+ "name": "������12",
+ "sex": "���",
+ "mobile": 13713713788,
+ "email": "test_12@test.com",
+ "weixin": "test12",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������12",
+ "nickname": "������12",
+ "updatedAt": "2017-07-05T16:00:00.000Z"
+ },
+ {
+ "key": 12,
+ "name": "������13",
+ "sex": "���",
+ "mobile": 13713713789,
+ "email": "test_13@test.com",
+ "weixin": "test13",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������13",
+ "nickname": "������13",
+ "updatedAt": "2017-07-06T16:00:00.000Z"
+ },
+ {
+ "key": 13,
+ "name": "������14",
+ "sex": "���",
+ "mobile": 13713713790,
+ "email": "test_14@test.com",
+ "weixin": "test14",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������14",
+ "nickname": "������14",
+ "updatedAt": "2017-07-06T16:00:00.000Z"
+ },
+ {
+ "key": 14,
+ "name": "������15",
+ "sex": "���",
+ "mobile": 13713713791,
+ "email": "test_15@test.com",
+ "weixin": "test15",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������15",
+ "nickname": "������15",
+ "updatedAt": "2017-07-07T16:00:00.000Z"
+ },
+ {
+ "key": 15,
+ "name": "������16",
+ "sex": "���",
+ "mobile": 13713713792,
+ "email": "test_16@test.com",
+ "weixin": "test16",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������16",
+ "nickname": "������16",
+ "updatedAt": "2017-07-07T16:00:00.000Z"
+ },
+ {
+ "key": 16,
+ "name": "������17",
+ "sex": "���",
+ "mobile": 13713713793,
+ "email": "test_17@test.com",
+ "weixin": "test17",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������17",
+ "nickname": "������17",
+ "updatedAt": "2017-07-08T16:00:00.000Z"
+ },
+ {
+ "key": 17,
+ "name": "������18",
+ "sex": "���",
+ "mobile": 13713713794,
+ "email": "test_18@test.com",
+ "weixin": "test18",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������18",
+ "nickname": "������18",
+ "updatedAt": "2017-07-08T16:00:00.000Z"
+ },
+ {
+ "key": 18,
+ "name": "������19",
+ "sex": "���",
+ "mobile": 13713713795,
+ "email": "test_19@test.com",
+ "weixin": "test19",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������19",
+ "nickname": "������19",
+ "updatedAt": "2017-07-10T00:00:00.000Z"
+ },
+ {
+ "key": 19,
+ "name": "������20",
+ "sex": "���",
+ "mobile": 13713713796,
+ "email": "test_20@test.com",
+ "weixin": "test20",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������20",
+ "nickname": "������20",
+ "updatedAt": "2017-07-10T00:00:00.000Z"
+ },
+ {
+ "key": 20,
+ "name": "������21",
+ "sex": "���",
+ "mobile": 13713713797,
+ "email": "test_21@test.com",
+ "weixin": "test21",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������21",
+ "nickname": "������21",
+ "updatedAt": "2017-07-11T00:00:00.000Z"
+ },
+ {
+ "key": 21,
+ "name": "������22",
+ "sex": "���",
+ "mobile": 13713713798,
+ "email": "test_22@test.com",
+ "weixin": "test22",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������22",
+ "nickname": "������22",
+ "updatedAt": "2017-07-11T00:00:00.000Z"
+ },
+ {
+ "key": 22,
+ "name": "������23",
+ "sex": "���",
+ "mobile": 13713713799,
+ "email": "test_23@test.com",
+ "weixin": "test23",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������23",
+ "nickname": "������23",
+ "updatedAt": "2017-07-12T00:00:00.000Z"
+ },
+ {
+ "key": 23,
+ "name": "������24",
+ "sex": "���",
+ "mobile": 13713713800,
+ "email": "test_24@test.com",
+ "weixin": "test24",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������24",
+ "nickname": "������24",
+ "updatedAt": "2017-07-12T00:00:00.000Z"
+ },
+ {
+ "key": 24,
+ "name": "������25",
+ "sex": "���",
+ "mobile": 13713713801,
+ "email": "test_25@test.com",
+ "weixin": "test25",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������25",
+ "nickname": "������25",
+ "updatedAt": "2017-07-13T00:00:00.000Z"
+ },
+ {
+ "key": 25,
+ "name": "������26",
+ "sex": "���",
+ "mobile": 13713713802,
+ "email": "test_26@test.com",
+ "weixin": "test26",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������26",
+ "nickname": "������26",
+ "updatedAt": "2017-07-13T00:00:00.000Z"
+ },
+ {
+ "key": 26,
+ "name": "������27",
+ "sex": "���",
+ "mobile": 13713713803,
+ "email": "test_27@test.com",
+ "weixin": "test27",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������27",
+ "nickname": "������27",
+ "updatedAt": "2017-07-14T00:00:00.000Z"
+ },
+ {
+ "key": 27,
+ "name": "������28",
+ "sex": "���",
+ "mobile": 13713713804,
+ "email": "test_28@test.com",
+ "weixin": "test28",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������28",
+ "nickname": "������28",
+ "updatedAt": "2017-07-14T00:00:00.000Z"
+ },
+ {
+ "key": 28,
+ "name": "������29",
+ "sex": "���",
+ "mobile": 13713713805,
+ "email": "test_29@test.com",
+ "weixin": "test29",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������29",
+ "nickname": "������29",
+ "updatedAt": "2017-07-15T00:00:00.000Z"
+ },
+ {
+ "key": 29,
+ "name": "������30",
+ "sex": "���",
+ "mobile": 13713713806,
+ "email": "test_30@test.com",
+ "weixin": "test30",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������30",
+ "nickname": "������30",
+ "updatedAt": "2017-07-15T00:00:00.000Z"
+ },
+ {
+ "key": 30,
+ "name": "������31",
+ "sex": "���",
+ "mobile": 13713713807,
+ "email": "test_31@test.com",
+ "weixin": "test31",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������31",
+ "nickname": "������31",
+ "updatedAt": "2017-07-16T00:00:00.000Z"
+ },
+ {
+ "key": 31,
+ "name": "������32",
+ "sex": "���",
+ "mobile": 13713713808,
+ "email": "test_32@test.com",
+ "weixin": "test32",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������32",
+ "nickname": "������32",
+ "updatedAt": "2017-07-16T00:00:00.000Z"
+ },
+ {
+ "key": 32,
+ "name": "������33",
+ "sex": "���",
+ "mobile": 13713713809,
+ "email": "test_33@test.com",
+ "weixin": "test33",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������33",
+ "nickname": "������33",
+ "updatedAt": "2017-07-17T00:00:00.000Z"
+ },
+ {
+ "key": 33,
+ "name": "������34",
+ "sex": "���",
+ "mobile": 13713713810,
+ "email": "test_34@test.com",
+ "weixin": "test34",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������34",
+ "nickname": "������34",
+ "updatedAt": "2017-07-17T00:00:00.000Z"
+ },
+ {
+ "key": 34,
+ "name": "������35",
+ "sex": "���",
+ "mobile": 13713713811,
+ "email": "test_35@test.com",
+ "weixin": "test35",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������35",
+ "nickname": "������35",
+ "updatedAt": "2017-07-18T00:00:00.000Z"
+ },
+ {
+ "key": 35,
+ "name": "������36",
+ "sex": "���",
+ "mobile": 13713713812,
+ "email": "test_36@test.com",
+ "weixin": "test36",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������36",
+ "nickname": "������36",
+ "updatedAt": "2017-07-18T00:00:00.000Z"
+ },
+ {
+ "key": 36,
+ "name": "������37",
+ "sex": "���",
+ "mobile": 13713713813,
+ "email": "test_37@test.com",
+ "weixin": "test37",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������37",
+ "nickname": "������37",
+ "updatedAt": "2017-07-19T00:00:00.000Z"
+ },
+ {
+ "key": 37,
+ "name": "������38",
+ "sex": "���",
+ "mobile": 13713713814,
+ "email": "test_38@test.com",
+ "weixin": "test38",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������38",
+ "nickname": "������38",
+ "updatedAt": "2017-07-19T00:00:00.000Z"
+ },
+ {
+ "key": 38,
+ "name": "������39",
+ "sex": "���",
+ "mobile": 13713713815,
+ "email": "test_39@test.com",
+ "weixin": "test39",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������39",
+ "nickname": "������39",
+ "updatedAt": "2017-07-20T00:00:00.000Z"
+ },
+ {
+ "key": 39,
+ "name": "������40",
+ "sex": "���",
+ "mobile": 13713713816,
+ "email": "test_40@test.com",
+ "weixin": "test40",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������40",
+ "nickname": "������40",
+ "updatedAt": "2017-07-20T00:00:00.000Z"
+ },
+ {
+ "key": 40,
+ "name": "������41",
+ "sex": "���",
+ "mobile": 13713713817,
+ "email": "test_41@test.com",
+ "weixin": "test41",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������41",
+ "nickname": "������41",
+ "updatedAt": "2017-07-21T00:00:00.000Z"
+ },
+ {
+ "key": 41,
+ "name": "������42",
+ "sex": "���",
+ "mobile": 13713713818,
+ "email": "test_42@test.com",
+ "weixin": "test42",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������42",
+ "nickname": "������42",
+ "updatedAt": "2017-07-21T00:00:00.000Z"
+ },
+ {
+ "key": 42,
+ "name": "������43",
+ "sex": "���",
+ "mobile": 13713713819,
+ "email": "test_43@test.com",
+ "weixin": "test43",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������43",
+ "nickname": "������43",
+ "updatedAt": "2017-07-22T00:00:00.000Z"
+ },
+ {
+ "key": 43,
+ "name": "������44",
+ "sex": "���",
+ "mobile": 13713713820,
+ "email": "test_44@test.com",
+ "weixin": "test44",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������44",
+ "nickname": "������44",
+ "updatedAt": "2017-07-22T00:00:00.000Z"
+ },
+ {
+ "key": 44,
+ "name": "������45",
+ "sex": "���",
+ "mobile": 13713713821,
+ "email": "test_45@test.com",
+ "weixin": "test45",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������45",
+ "nickname": "������45",
+ "updatedAt": "2017-07-23T00:00:00.000Z"
+ },
+ {
+ "key": 45,
+ "name": "������46",
+ "sex": "���",
+ "mobile": 13713713822,
+ "email": "test_46@test.com",
+ "weixin": "test46",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������46",
+ "nickname": "������46",
+ "updatedAt": "2017-07-23T00:00:00.000Z"
+ },
+ {
+ "key": 46,
+ "name": "������47",
+ "sex": "���",
+ "mobile": 13713713823,
+ "email": "test_47@test.com",
+ "weixin": "test47",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������47",
+ "nickname": "������47",
+ "updatedAt": "2017-07-24T00:00:00.000Z"
+ },
+ {
+ "key": 47,
+ "name": "������48",
+ "sex": "���",
+ "mobile": 13713713824,
+ "email": "test_48@test.com",
+ "weixin": "test48",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������48",
+ "nickname": "������48",
+ "updatedAt": "2017-07-24T00:00:00.000Z"
+ },
+ {
+ "key": 48,
+ "name": "������49",
+ "sex": "���",
+ "mobile": 13713713825,
+ "email": "test_49@test.com",
+ "weixin": "test49",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������49",
+ "nickname": "������49",
+ "updatedAt": "2017-07-25T00:00:00.000Z"
+ },
+ {
+ "key": 49,
+ "name": "������50",
+ "sex": "���",
+ "mobile": 13713713826,
+ "email": "test_50@test.com",
+ "weixin": "test50",
+ "password": "ISGMyneATSuhkiwz4BURBQ==",
+ "organization": "������50",
+ "nickname": "������50",
+ "updatedAt": "2017-07-25T00:00:00.000Z"
+ }
+ ]
+}
--
Gitblit v1.8.0