import { Component, OnInit } from '@angular/core';
import {Api} from '../../service/api';
import {NavController} from '@ionic/angular';
import {ActivatedRoute} from '@angular/router';

@Component({
  selector: 'v-env-detail',
  templateUrl: './env-detail.page.html',
  styleUrls: ['./env-detail.page.scss'],
})
export class EnvDetailPage implements OnInit {

  constructor(private api: Api,public nav: NavController,private ac: ActivatedRoute,) { }

    item = {
        name : '1号牛舍',
        temp : '23.5',
        humi : '82',
        thi: '轻',
        time : '2019-08-05 23:44',
        online : true,
        remoteMode: true,  //true 平控  false 现控
        wokeMode: 1,  //0 手控  1 自控  2 智控
        ctrl: 0,
        alarm: true,
    };

    fieldRegionNo = '';
    fieldRegionName = '';
    fieldRegionGroup = '';

    // 发送指令延时判断
    comm = {
        remain : 20,
        isLoading : true
    };

  ngOnInit() {
      console.log('+ogOnInit');
      this.comm.isLoading = false;
      this.comm.remain = 0;
      this.ac.queryParams.subscribe((data) => {
          console.log(data);
          if(data.no)
          {
              this.fieldRegionNo = data.no;
              this.fieldRegionName = data.name;
              this.fieldRegionGroup = data.group;
          }
      });
      console.log('-ogOnInit');
  }

}
