fengxiang
2018-01-16 928d55a8fde33200bb1ca4016ce5b86e9a1118a8
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<form nz-form [formGroup]="validateForm" (ngSubmit)="save($event,validateForm.value,validateForm.valid)" [nzLayout]="'vertical'"
    #f="ngForm">
    <nz-card [nzBordered]="false" nzTitle="报警阀值(注意,只有部分选项有 反向三级 数值,没有可不填)">
        <nz-table #nzTable [nzDataSource]="grid.data" [nzPageSize]="10" [nzLoading]="grid.loading" [nzShowTotal]="true">
            <thead nz-thead>
                <tr>
                    <th nz-th [nzCheckbox]="true">
                        <label nz-checkbox formControlName="_allChecked" [nzIndeterminate]="indeterminate" (ngModelChange)="checkAll($event)"></label>
                    </th>
                    <th nz-th>
                        传感器名称(单位)
                    </th>
                    <th nz-th>
                        一级
                    </th>
                    <th nz-th>
                        二级
                    </th>
                    <th nz-th>
                        三级
                    </th>
                    <th nz-th>
                        反向一级
                    </th>
                    <th nz-th>
                        反向二级
                    </th>
                    <th nz-th>
                        反向三级
                    </th>
                </tr>
            </thead>
            <tbody formGroupName="alarmLevels" nz-tbody>
                <tr nz-tbody-tr *ngFor="let row of nzTable.data" formGroupName="{{row.key}}">
 
                    <td nz-td [nzCheckbox]="true">
                        <label nz-checkbox formControlName="enable"></label>
                    </td>
                    <td>
                        <span>
                            {{ row.name }}({{ row.unit }})
                        </span>
                    </td>
                    <td formArrayName="increment" *ngFor="let in of validateForm.get('alarmLevels.'+row.key+'.increment').controls; index as i">
                            <div nz-form-item>
                                <div nz-form-control nzHasFeedback>
                                    <nz-input [formControlName]="i" maxlength="20" nzDisabled="{{ !f.value['alarmLevels'][row.key]['enable'] }}"></nz-input>
                                </div>
                            </div>
                    </td>
                    <td formArrayName="degression" *ngFor="let in of validateForm.get('alarmLevels.'+row.key+'.degression').controls; index as i">
                        <div nz-form-item>
                            <div nz-form-control nzHasFeedback>
                                <nz-input [formControlName]="i" maxlength="20" nzDisabled="{{ !f.value['alarmLevels'][row.key]['enable'] }}"></nz-input>
                            </div>
                        </div>
                   </td>   
                </tr>
            </tbody>
        </nz-table>
    </nz-card>
    <div [ngStyle]="{'background-color':'#f5f7fa','width':'110%','left':'-5%','height':'20px','position':'relative'}"></div>
    <nz-card [nzBordered]="false" nzTitle="报警方式"  formGroupName="alarmMode">
            <label nz-checkbox formControlName="enable">
                <span>启用报警</span>
            </label>
            <div [ngStyle]="{'margin-left': '20%'}">
                <br/>
                <br/>
                <br/>
                  <div *ngFor="let i of [1,2,3]" nz-form-item nz-row class="mb-sm">
                    <div nz-form-label nz-col [nzSm]="3" [nzXs]="24">
                        <span [ngSwitch]="i">
                            <label *ngSwitchCase="1">一级报警方式:</label>
                            <label *ngSwitchCase="2">二级报警方式:</label>
                            <label *ngSwitchCase="3">三级报警方式:</label>
                        </span>
                    </div>
                    <div nz-form-control nz-col [nzSpan]="12" nzHasFeedback>
                        <nz-select formControlName="{{ 'level'+i }}" [nzMode]="'multiple'" [nzPlaceHolder]="'选择 报警方式'" [nzNotFoundContent]="'无法找到'"
                            nzDisabled="{{ !f.value['alarmMode']['enable'] }}">
                            <nz-option *ngFor="let option of alarmModes" [nzLabel]="option.label" [nzValue]="option.value" [nzDisabled]="option.disabled">
                            </nz-option>
                        </nz-select>
                    </div>
                    <br/>
                    <br/>
                    <br/>
                </div>
            </div>
        </nz-card>
    <footer-toolbar errorCollect>
        <span [ngStyle]="{'color':'red','width':'300px','margin-right':'40px'}">{{ errorMessage }}</span>
        <label>组织名称:</label>
        <span [ngStyle]="{'font-size': '16px','font-weight': 'bold','margin-right':'30px'}">{{ organization.name }}</span>
        <button nz-button type="button" (click)="backToList()">返回</button>
        <button nz-button [nzType]="'primary'" [nzLoading]="isSaving">
            <span>
                保存
                <span *ngIf="isSaving">中</span>
            </span>
        </button>
    </footer-toolbar>    
</form>