fengxiang
2018-06-25 27cd36be226ca2434f06b1ae9e4d43f1fea639ab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<nz-card [nzBordered]="false">
        <div class="mb-md">
                <button nz-button (click)="addOrModify($event)" [nzType]="'primary'" [nzSize]="'large'">
                    <i class="anticon anticon-plus"></i><span>新建</span>
                </button>
                <ng-container *ngIf="grid.selectedIndexs.length > 0"> &nbsp;
                <button nz-button [nzSize]="'large'" (click)="deleteSelected($event)">批量删除</button>
                </ng-container>
                <nz-input [ngStyle]="{'width': '280px','float':'right'}" [(ngModel)]="queryMap.value" name=""  [nzPlaceHolder]="queryMap.text"
                (keyup)="queryTextChanged($event)" (change)="queryTextChanged($event)" ></nz-input>
        </div>
        <div class="mb-md">
                <nz-alert *ngIf="grid.selectedIndexs.length > 0" [nzType]="'info'" [nzShowIcon]="true"> 
                    <span alert-body>
                         已选择<strong class="text-primary">{{grid.selectedIndexs.length}}</strong>项
                    </span> 
                </nz-alert>
    </div>
    <nz-table #nzTable
              [nzAjaxData]="grid.data"              
              [nzTotal]="grid.total"
              [(nzPageIndex)]="grid.pageIndex"
              [(nzPageSize)]="grid.pageSize"
              [nzLoading]="grid.loading"
              [nzShowTotal]="true"
              (nzPageIndexChange)="load()">
              <thead nz-thead>
                  <tr>
                    <th nz-th [nzCheckbox]="true">
                        <label nz-checkbox [(ngModel)]="grid.allChecked" [nzIndeterminate]="grid.indeterminate" (ngModelChange)="grid.checkAll($event)"></label>
                    </th>
                    <th nz-th *ngFor="let col of grid.columns"
                     [ngStyle]="{'width':col.width,'text-align':col['align'] === undefined?'left':col.align}" >
                           <span>{{ col.text }}</span>
                           <nz-table-sort *ngIf="col.isSort"   [(nzValue)]="col.sort" (nzValueChange)="sort(col.name,$event)"></nz-table-sort>
                    </th>
                    <th nz-th><span>操作</span></th>
                  </tr>
              </thead>
              <tbody nz-tbody>
                <tr nz-tbody-tr *ngFor="let row of nzTable.data">
                    <td nz-td [nzCheckbox]="true">
                       <label nz-checkbox [(ngModel)]="row.checked" (ngModelChange)="grid.refreshStatus($event)"></label>
                    </td>
                    <td nz-td *ngFor="let col of grid.columns"
                    [ngStyle]="{'width':col.width,'text-align':col['align'] === undefined?'left':col.align}">
                        <span [ngSwitch]="col.type">
                             <!-- 要使用管道,无法自动生成 -->
                            <span *ngSwitchDefault> {{ row[col.name]|tyepHandle:col:row }} </span>
                             <!-- 要使用管道,无法自动生成 -->        
                        </span>
                    </td>
                    <td nz-td>
                            <a (click)="addOrModify(row)">编辑</a>
                            <span nz-table-divider></span>
                              <nz-popconfirm [nzTitle]="'确定要删除该'+grid.title+'吗?'" [nzOkText]="'Yes'" [nzCancelText]="'No'" (nzOnConfirm)="delete(row.id)" >
                                <a nz-popconfirm>删除</a>
                              </nz-popconfirm>
                            <span nz-table-divider></span>
                            <a [routerLink]="['/systems/registration']" (click)="registration(row)">注册码</a>
                            <span nz-table-divider></span>
                            <nz-dropdown>
                                <a class="ant-dropdown-link" nz-dropdown>
                                  更多 <i class="anticon anticon-down"></i>
                                </a>
                                <ul nz-menu>
                                  <li nz-menu-item>
                                        <a (click)="configAlarm(row)">配置三级警报</a>
                                  </li>
                                  <li nz-menu-item>
                                        <a (click)="configScreenLayout(row)">配置大屏布局</a>
                                  </li>
                                  <li nz-menu-item>
                                        <a (click)="configShowUnit(row)">配置显示单位</a>
                                  </li>
                                </ul>
                              </nz-dropdown>
                     </td>
                </tr>
              </tbody>
              </nz-table>
  </nz-card>