<div class="mainCon" style="padding-top: 45px;" @EnterLeave>
    <Navbar [leftContent]="icon"
            (onLeftClick)="onLeftClick()"
            [rightContent]="r"
            style="background-color: #28c9bd;position: fixed;top: 0;width: 100%;z-index: 2;"
    >
        {{fieldRegionName}}控制
    </Navbar>
    <ng-template #r>
        <span (click)="pullToRefresh()">刷新</span>
    </ng-template>
    <div class="topPart">
        <ListItem multipleLine *ngIf="yewei || yewei === 0">
            当前液位:
            <div class="process">
                <div [class]="'inlineProcess ' + color" [ngStyle]="{width: proc + '%'}">
                </div>
            </div>
            {{yewei.toFixed(2)}}m
        </ListItem>
        <ListItem multipleLine *ngIf="temp || temp === 0">
            当前温度:
            <div style="display: inline-block;margin-left: calc(100% - 145px);vertical-align: middle">
                {{temp.toFixed(2)}}℃
            </div>
        </ListItem>
        <div *ngFor="let a of nb;let i = index">
            <ListItem multipleLine [extra]="a.fieldDeviceName === '南水' ? s1 : s2">
                {{a.fieldDeviceName}}
            </ListItem>
            <ListItem multipleLine *ngIf="a.fieldDeviceName === '南水' ? nanClicked : beiClicked">
                选择开启时间
                <Stepper class="stepClass" [(ngModel)]="duration" [min]="1" [showNumber]="true"></Stepper>
                分钟
                <div style="text-align: right;padding-top: 10px">
                    <div Button style="margin-right: 10px" class="btn" (click)="cancel()" [inline]="true"
                         [size]="'small'" [type]="'default'">取消
                    </div>
                    <div Button (click)="confirm(a)" class="btn" [inline]="true" [size]="'small'" [type]="'primary'">
                        确认
                    </div>
                </div>
            </ListItem>
        </div>
    </div>
    <div class="middlePart">
        <ion-item>
            <ion-label>运行模式</ion-label>
                <ion-select multiple="false" cancelText="取消" okText="确认"  [value]="workModeSetting.workMode"  (ionChange)="workModeEvent()">
                <ion-select-option value="0">手动模式</ion-select-option>
                <ion-select-option value="1">半自动</ion-select-option>
                <ion-select-option value="2">全自动</ion-select-option>
            </ion-select>
        </ion-item>
    </div>
    <div class="bottomPart">
        <ListItem multipleLine *ngFor="let a of devices;let i = index">
            {{a.fieldDeviceName}}
            <v-switch [value]="a.value" [disabled]="true" [loading]="a.loading"></v-switch>
        </ListItem>
    </div>
</div>
<ng-template #icon>
    <span class="vo v-back"></span>
</ng-template>
<ng-template #s1>
    <v-switch [value]="value[0]" [disabled]="beiLoading || value[1]" (click)="toggleNb(0)"
              [loading]="nanLoading"></v-switch>
</ng-template>
<ng-template #s2>
    <v-switch [value]="value[1]" [disabled]="nanLoading || value[0]" (click)="toggleNb(1)"
              [loading]="beiLoading"></v-switch>
</ng-template>
