xufenglei
2017-12-27 4156fed8a32e81a61b706b8a17876f7a1fdcabb7
安装 用户更新
5 files modified
78 ■■■■■ changed files
src/app/routes/systems/account/account.component.html 10 ●●●● patch | view | raw | blame | history
src/app/routes/systems/account/account.component.ts 21 ●●●● patch | view | raw | blame | history
src/app/routes/users/installer/edit/edit.component.ts 23 ●●●● patch | view | raw | blame | history
src/app/routes/users/installer/installer.component.html 7 ●●●●● patch | view | raw | blame | history
src/app/routes/users/installer/installer.component.ts 17 ●●●● patch | view | raw | blame | history
src/app/routes/systems/account/account.component.html
@@ -1,6 +1,6 @@
<pro-header [title]="'账户列表'"></pro-header>
<nz-card [nzBordered]="false">
    <form nz-form [nzLayout]="'inline'">
    <form nz-form (ngSubmit)="load(true)" [nzLayout]="'inline'">
        <div nz-row [nzGutter]="24">
            <div nz-col [nzSpan]="8" class="mb-md">
                <div nz-form-item class="d-flex">
@@ -28,9 +28,9 @@
                        <label>是否删除</label>
                    </div>
                    <div nz-form-control class="flex-1">
                        <nz-select [(ngModel)]="query.isDelete" name="isDelete" [nzSize]="'large'" >
                        <nz-select [(ngModel)]="query.isDelete" name="isDelete" [nzSize]="'large'">
                            <nz-option *ngFor="let option of options" [nzLabel]="option.label" [nzValue]="option.value" ></nz-option>
                        </nz-select>
                        </nz-select>
                    </div>
                </div>
            </div>
@@ -47,7 +47,7 @@
            <i class="anticon anticon-plus"></i><span>新建</span>
        </button>
        <ng-container *ngIf="selectedRows.length > 0"> &nbsp;
        <button nz-button [nzSize]="'large'" (click)="remove()">批量删除</button>
            <button nz-button [nzSize]="'large'" (click)="remove()">批量删除</button>
        </ng-container>
    </div>
@@ -89,7 +89,7 @@
        <tbody nz-tbody>
            <tr nz-tbody-tr *ngFor="let account of nzTable.data">
                <td nz-td [nzCheckbox]="true">
                    <label nz-checkbox [(ngModel)]="account.checked" (ngModelChange)="refreshStatus($event)"></label>
                    <label nz-checkbox [(ngModel)]="account.checked" (ngModelChange)="refreshStatus($event)" [nzDisabled]="account.isDelete == '1'? true : false"></label>
                </td>
                <td nz-td>{{account.accountName}}</td>
                <td nz-td>{{account.mobile}}</td>
src/app/routes/systems/account/account.component.ts
@@ -22,14 +22,13 @@
  query: any = {
    pageIndex: 1,
    pageSize: 3,
    pageSize: 10,
    isDelete: this.options[1].value
  };
  data: any[] = [];
  total: 0;
  selectedRows: any[] = [];
  curRows: any[] = [];
  allChecked = false;
  indeterminate = false;
  sortMap: any = {};
@@ -50,7 +49,7 @@
      this.data = res.data.data;
      this.total = res.data.total;
      this.dataChange(this.data);
      this.refreshStatus();
    });
  }
@@ -95,20 +94,15 @@
  }
  checkAll(value: boolean) {
    this.curRows.forEach(i => {
    this.data.forEach(i => {
      i.checked = value;
    });
    this.refreshStatus();
  }
  dataChange(res: any) {
    this.curRows = res;
    this.refreshStatus();
  }
  refreshStatus() {
    const allChecked = this.curRows.every(value => value.checked);
    const allUnChecked = this.curRows.every(value => !value.checked);
    const allChecked = this.data.every(value => value.checked);
    const allUnChecked = this.data.every(value => !value.checked);
    this.allChecked = allChecked;
    this.indeterminate = (!allChecked) && (!allUnChecked);
    this.selectedRows = this.data.filter(value => value.checked);
@@ -118,11 +112,6 @@
    this.sortMap = {};
    this.sortMap[field] = value;
    this.query.sorter = value ? `${field} ${value}` : '';
    this.load(true);
  }
  reset(ls: any[]) {
    for (const item of ls) item.value = false;
    this.load(true);
  }
src/app/routes/users/installer/edit/edit.component.ts
@@ -22,20 +22,19 @@
    public http: HttpClient) { }
  ngOnInit() {
    if (this.user.id > 0) {
      this.http.get(environment.SERVER_BASH_URL + '/user/operate_user/' + this.user.id).subscribe((res: any) => {
        this.user = res;
        this.user.createTime = this.dateSrv.date_format(this.user.createTime, 'YYYY-MM-DD');
        this.user.expireTime = this.dateSrv.date_format(this.user.expireTime, 'YYYY-MM-DD');
      });
    } else {
      this.user.createTime = this.dateSrv.today('YYYY-MM-DD');
      this.user.expireTime = this.dateSrv.today('YYYY-MM-DD');
    }
//    if (this.user.id > 0) {
//      this.http.get(environment.SERVER_BASH_URL + '/user/operate_user/' + this.user.id).subscribe((res: any) => {
//        this.user = res;
//        this.user.createTime = this.dateSrv.date_format(this.user.createTime, 'YYYY-MM-DD');
//        this.user.expireTime = this.dateSrv.date_format(this.user.expireTime, 'YYYY-MM-DD');
//      });
//    } else {
//      this.user.createTime = this.dateSrv.today('YYYY-MM-DD');
//      this.user.expireTime = this.dateSrv.today('YYYY-MM-DD');
//    }
  }
  save() {
    console.log(this.user);
    if (this.user.name == null || this.user.name === '') {
      this.msgSrv.error('请输入姓名');
    } else if (this.user.mobile == null || this.user.mobile === '') {
@@ -45,7 +44,7 @@
    } else if (this.user.password == null || this.user.password === '') {
      this.msgSrv.error('请输入密码');
    } else {
      this.http.post(environment.SERVER_BASH_URL + '/user/operate_user/save', this.user).subscribe(() => {
      this.http.post(environment.SERVER_BASH_URL + '/operateUser/operateUser', this.user).subscribe(() => {
        this.subject.next('true');
        this.close();
      });
src/app/routes/users/installer/installer.component.html
@@ -40,14 +40,13 @@
    </nz-alert>
  </div>
  <nz-table #nzTable
            [nzDataSource]="data"
            [nzAjaxData]="data"
            [nzLoading]="http.loading"
            [nzTotal]="total"
            [(nzPageIndex)]="q.pi"
            [nzPageSize]="q.ps"
            [nzShowTotal]="true"
            (nzPageIndexChange)="load()"
            (nzDataChange)="dataChange($event)">
            (nzPageIndexChange)="load()">
    <thead nz-thead>
    <tr>
      <th nz-th [nzCheckbox]="true">
@@ -62,7 +61,7 @@
      <th nz-th><span>创建日期</span></th>
      <th nz-th>
        <span>过期日期</span>
        <nz-table-sort [(nzValue)]="sortMap.updatedAt" (nzValueChange)="sort('expireTime', $event)"></nz-table-sort>
        <nz-table-sort [(nzValue)]="sortMap.updatedAt" (nzValueChange)="sort('expire_time', $event)"></nz-table-sort>
      </th>
      <th nz-th><span>操作</span></th>
    </tr>
src/app/routes/users/installer/installer.component.ts
@@ -15,7 +15,7 @@
  q: any = {
    pi: 1,
    ps: 10,
    ps: 1,
    sorter: '',
    u_name: '',
    u_mobile: ''
@@ -43,7 +43,7 @@
    if (reload) {
      this.q.pi = 1;
    }
    this.http.get(environment.SERVER_BASH_URL + '/user/operate_user', this.q).subscribe((res: any) => {
    this.http.get(environment.SERVER_BASH_URL + '/operateUser/list', {params: this.q}).subscribe((res: any) => {
      // let data = res.data;
      // const total = res.total;
      //
@@ -68,8 +68,10 @@
      // this.data = data.slice(start, start + this.q.ps);
      // this.total = total;
      this.data = res.data;
      this.total = res.total;
      this.data = res.data.data;
      this.total = res.data.total;
      this.dataChange(this.data);
    });
  }
@@ -89,7 +91,7 @@
  }
  delete(user) {
    this.http.delete(environment.SERVER_BASH_URL + '/user/operate_user/' + user.id).subscribe((res: any) => {
    this.http.post(environment.SERVER_BASH_URL + '/operateUser/operateUser/id',user).subscribe((res: any) => {
      this.msgSrv.success('安装用户删除成功!');
      this.load(true);
    });
@@ -100,8 +102,7 @@
    this.selectedRows.forEach(i => {
      ids.push(i.id);
    });
    console.log(ids);
    this.http.post(environment.SERVER_BASH_URL + '/user/operate_user/deleteList', ids).subscribe((res: any) => {
    this.http.post(environment.SERVER_BASH_URL + '/operateUser/operateUsers/ids', ids).subscribe((res: any) => {
      this.load(true);
    });
  }
@@ -129,7 +130,7 @@
  sort(field: string, value: any) {
    this.sortMap = {};
    this.sortMap[field] = value;
    this.q.sorter = value ? `${field}_${value}` : '';
    this.q.sorter = value ? `${field} ${value}` : '';
    this.load(true);
  }