沈斌
2017-12-18 5933685ea11e748cca2f5c13b79abc2b1ffa32a2
updates
1 files added
3 files modified
676 ■■■■■ changed files
src/app/routes/users/installer/installer.component.html 9 ●●●● patch | view | raw | blame | history
src/app/routes/users/installer/installer.component.ts 58 ●●●●● patch | view | raw | blame | history
src/app/routes/users/users.module.ts 4 ●●● patch | view | raw | blame | history
src/assets/users-installer-data.json 605 ●●●●● patch | view | raw | blame | history
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">
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);
  }
}
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 { }
src/assets/users-installer-data.json
New file
@@ -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"
    }
  ]
}