Commit 4f48adcd authored by zhuangzhuang's avatar zhuangzhuang

牛舍首页-10%

parent aea03b6c
<ion-header mode="ios"> <ion-header mode="ios">
<ion-toolbar> <ion-toolbar color="gray">
<ion-buttons slot="start"> <ion-buttons slot="start">
<ion-back-button color="secondary" defaultHref="/index" text=""></ion-back-button> <ion-back-button color="secondary" defaultHref="/index" text=""></ion-back-button>
</ion-buttons> </ion-buttons>
<ion-searchbar></ion-searchbar> <ion-searchbar></ion-searchbar>
<!--<div class="topSearch">
<SearchBar [placeholder]="'点击此处进行搜索'" [(ngModel)]="searchText"
(onCancel)="searchText ='';toggleFocus(false);"
[setFocus]="false" (onFocus)="toggleFocus(true)" (onBlur)="toggleFocus(false)"
(onClear)="searchText ='';toggleFocus(false);"></SearchBar>
</div>-->
</ion-toolbar> </ion-toolbar>
<!--<v-search *ngIf="ifFocus" [(value)]="searchText"></v-search>-->
<ion-slides style="width: 100%; height: 125px;" mode="ios"
[options]="lunbo" #slide (ionSlideTouchEnd)="slideDidChange()">
<ion-slide class="slideCon" *ngFor="let one of imgs">
<div class="inBox">
<img [src]="'../../../../assets/lunbo/' + one">
</div>
</ion-slide>
</ion-slides>
</ion-header> </ion-header>
<ion-content color='light'> <ion-content color='light'>
<h1 style=" <h1 style="
...@@ -33,18 +49,18 @@ ...@@ -33,18 +49,18 @@
<div class="content"> <div class="content">
<span class="block2" *ngIf="item.temp">温度: &nbsp;&nbsp;{{item.temp}} ℃ &nbsp;&nbsp;</span> <span class="block2" *ngIf="item.temp">温度: &nbsp;&nbsp;{{item.temp}} ℃ &nbsp;&nbsp;</span>
<span class="block1" *ngIf="item.humi">湿度: &nbsp;&nbsp;{{item.humi}} % &nbsp;&nbsp;</span> <span class="block1" *ngIf="item.humi">湿度: &nbsp;&nbsp;{{item.humi}} % &nbsp;&nbsp;</span>
<span class="block1" *ngIf="item.thi">热应激等级: &nbsp;&nbsp;{{item.thi}}</span> <span class="block1" *ngIf="item.heatStressLevel">热应激等级: &nbsp;&nbsp;{{item.heatStressLevel}}</span>
</div> </div>
<div class="bottom"> <div class="bottom">
<span [ngClass]="{'online': item.online, 'offline': !item.online}">{{item.online ? '在线' : '离线'}} </span> <span [ngClass]="{'online': item.online, 'offline': !item.online}">{{item.online ? '在线' : '离线'}} </span>
<span *ngIf="item.online" class="online">{{item.remoteMode ? '平控' :'现控'}} </span> <span *ngIf="item.online" class="online">{{item.operationModel ? '平控' :'现控'}} </span>
<span *ngIf="item.online && item.remoteMode && item.wokeMode === 2" class="online">智控 </span> <span *ngIf="item.online && item.operationModel && item.isWisdomModel === 2" class="online">智控 </span>
<span *ngIf="item.online && item.remoteMode && item.wokeMode === 1" class="online">自控 </span> <span *ngIf="item.online && item.operationModel && item.isWisdomModel === 1" class="online">自控 </span>
<span *ngIf="item.online && item.remoteMode && item.wokeMode === 0" class="online">手控 </span> <span *ngIf="item.online && item.operationModel && item.isWisdomModel === 0" class="online">手控 </span>
<!--<div class="block1" *ngIf="item.yewei || item.yewei === 0">池体液位: &nbsp;&nbsp;{{item.yewei}} m</div>--> <!--<div class="block1" *ngIf="item.yewei || item.yewei === 0">池体液位: &nbsp;&nbsp;{{item.yewei}} m</div>-->
<!--<div class="block2" *ngIf="item.temp || item.temp === 0">液体温度: &nbsp;&nbsp;{{item.temp}} ℃</div>--> <!--<div class="block2" *ngIf="item.temp || item.temp === 0">液体温度: &nbsp;&nbsp;{{item.temp}} ℃</div>-->
<!--<div class="block2">运行状态: &nbsp;&nbsp;{{item.state ? '工作中' : '未运行'}} </div>--> <!--<div class="block2">运行状态: &nbsp;&nbsp;{{item.state ? '工作中' : '未运行'}} </div>-->
<!--<span class="right">{{item.time | date: 'yyyy-MM-dd HH:mm:ss'}}</span>--> <!--<span class="right">{{item.ts | date: 'yyyy-MM-dd HH:mm:ss'}}</span>-->
</div> </div>
</div> </div>
</ion-item> </ion-item>
......
...@@ -83,3 +83,10 @@ ...@@ -83,3 +83,10 @@
font-size: 14px; font-size: 14px;
} }
.topSearch {
display: inline-block;
width: calc(100% - 30px);
vertical-align: top;
padding-left: 5px;
}
...@@ -6,16 +6,20 @@ import {Load} from '../../service/load'; ...@@ -6,16 +6,20 @@ import {Load} from '../../service/load';
import {NavController} from '@ionic/angular'; import {NavController} from '@ionic/angular';
@Component({ @Component({
selector: 'v-env-home', selector: 'v-env-home',
templateUrl: './env-home.page.html', templateUrl: './env-home.page.html',
styleUrls: ['./env-home.page.scss'], styleUrls: ['./env-home.page.scss'],
}) })
export class EnvHomePage implements OnInit { export class EnvHomePage implements OnInit {
constructor(private tf: Transfer, private ac: ActivatedRoute, constructor(private tf: Transfer, private ac: ActivatedRoute,
private api: Api, private load: Load, public nav: NavController) { } private api: Api, private load: Load, public nav: NavController) {
}
@ViewChild('slide') slide;
searchText = '';
isError = false;
ifFocus = false; ifFocus = false;
lunbo = { lunbo = {
speed: 1000, speed: 1000,
allowTouchMove: true, allowTouchMove: true,
...@@ -28,144 +32,144 @@ export class EnvHomePage implements OnInit { ...@@ -28,144 +32,144 @@ export class EnvHomePage implements OnInit {
zoom: false, zoom: false,
height: 150, height: 150,
}; };
// 热应激良
thiGood = 0;
// 热应激差
thiBad = 0;
// 故障总数
alarmTotal = 0;
farmMsg = { farmMsg = {
temp : 28.6, temp: 28.6,
humi : 32.1, humi: 32.1,
thi : '中', thi: '中',
hasCow : true, hasCow: true,
} };
items = [
{
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,
},
{
name : '3号牛舍',
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,
},
{
name : '4号牛舍',
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,
},
{
name : '5号牛舍',
temp : '23.5',
humi : '82',
thi: '轻',
time : '1566378129',
online : true,
remoteMode: true, //true 平控 false 现控
wokeMode: 1, //0 手控 1 自控 2 智控
ctrl: 0,
alarm: true,
},
{
name : '6号牛舍',
temp : '23.5',
humi : '82',
thi: '轻',
time : '1566378129',
online : true,
remoteMode: true, //true 平控 false 现控
wokeMode: 1, //0 手控 1 自控 2 智控
ctrl: 0,
alarm: true,
},
{
name : '7号牛舍',
temp : '23.5',
humi : '82',
thi: '轻',
time : '2019-08-05 23:44:21',
online : true,
remoteMode: true, //true 平控 false 现控
wokeMode: 1, //0 手控 1 自控 2 智控
ctrl: 0,
alarm: true,
},
{
name : '8号牛舍',
temp : '23.5',
humi : '82',
thi: '轻',
time : '1566378129',
online : true,
remoteMode: true, //true 平控 false 现控
wokeMode: 1, //0 手控 1 自控 2 智控
ctrl: 0,
alarm: true,
},
];
imgs = ['1.jpg', '2.jpg', '3.jpg'];
itam = {
name : '',
temp : '',
humi : '',
thi: '',
time : '',
online : false,
ctrl: 0,
alarm: true,
};
dummyData = {
name : '1好',
temp : '',
humi : '',
thi: '',
time : '',
online : false,
ctrl: 0,
alarm: true,
};
@ViewChild('slide') slide; items = [
{
name: '1号牛舍',
temp: '23.5',
humi: '82',
heatStressLevel: '轻',
online: true,
operationModel: true, // true 平控 false 现控
isWisdomModel: 1, // 0 手控 1 自控 2 智控
alarm: true,
ts: '2019-08-05 23:44',
},
{
name: '2号牛舍',
temp: '23.5',
humi: '82',
heatStressLevel: '轻',
online: true,
operationModel: true, // true 平控 false 现控
isWisdomModel: 1, // 0 手控 1 自控 2 智控
alarm: true,
ts: '2019-08-05 23:44',
},
{
name: '3号牛舍',
temp: '23.5',
humi: '82',
heatStressLevel: '轻',
online: true,
operationModel: true, // true 平控 false 现控
isWisdomModel: 1, // 0 手控 1 自控 2 智控
alarm: true,
time: '2019-08-05 23:44',
},
{
name: '4号牛舍',
temp: '23.5',
humi: '82',
thi: '轻',
time: '2019-08-05 23:44',
online: true,
operationModel: true, // true 平控 false 现控
isWisdomModel: 1, // 0 手控 1 自控 2 智控
ctrl: 0,
alarm: true,
},
{
name: '5号牛舍',
temp: '23.5',
humi: '82',
thi: '轻',
time: '2019-08-05 23:44',
online: true,
operationModel: true, // true 平控 false 现控
isWisdomModel: 1, // 0 手控 1 自控 2 智控
ctrl: 0,
alarm: true,
},
];
imgs = ['1.jpg', '2.jpg', '3.jpg'];
dummyData = {
name: '1好',
temp: '',
humi: '',
thi: '',
time: '',
online: false,
ctrl: 0,
alarm: true,
};
ngOnInit() { ngOnInit() {
// this.ionViewWillEnter(); this.init();
} this.ionViewWillEnter();
}
init() {
this.getData(0);
}
// ionic的生命周期函数 // ionic的生命周期函数
ionViewWillEnter() { ionViewWillEnter() {
this.slideDidChange(); this.slideDidChange();
//this.getData(0); this.getData(0);
} }
toIndex() { getData(time) {
if (this.ifFocus) { if (time) {
this.ifFocus = false; this.load.toLoad('加载中...', false);
} else { }
this.tf.transfer({url: '/index'}); this.api.app.getAllRegionData(['', (data) => {
} // 热应激良 热应激差 故障总数
} data.map((value, index) => {
this.thiGood = value.thiGood;
this.thiBad = value.thiBad;
this.alarmTotal = value.alarmTotal;
});
// 牛舍列表
if (data && data.constructor === Array) {
this.items = [];
this.isError = false;
data.map((value, index) => {
const itemInfo = {
name: value.fieldRegionName,
temp: value.temp,
humi: value.humi,
heatStressLevel: value.heatStressLevel,
online: value.online,
operationModel: value.operationModel,
isWisdomModel: value.isWisdomModel,
alarm: value.alarm,
ts: value.ts
};
this.items.push(itemInfo);
});
} else {
this.api.presentMsgToast('获取数据失败');
this.isError = true;
}
this.load.offLoad();
}]);
}
// //
// toControl(one){ // toControl(one){
// const query = '?name=' + one.name + '&no=' + one.no + '&group=' + one.group; // const query = '?name=' + one.name + '&no=' + one.no + '&group=' + one.group;
...@@ -187,19 +191,14 @@ export class EnvHomePage implements OnInit { ...@@ -187,19 +191,14 @@ export class EnvHomePage implements OnInit {
// console.log(query); // console.log(query);
const query = '/env-detail?name=1213'; const query = '/env-detail?name=1213';
this.nav.navigateForward(query); this.nav.navigateForward(query);
//this.nav.navigateRoot(one.url + query); // this.nav.navigateRoot(one.url + query);
}
getData() {
} }
slideDidChange() { slideDidChange() {
// this.slide.startAutoplay(); this.slide.startAutoplay();
} }
toggleFocus(a){ toggleFocus(e) {
this.ifFocus = e;
} }
} }
...@@ -29,6 +29,7 @@ export class Api { ...@@ -29,6 +29,7 @@ export class Api {
getDeviceData: (data) => this.trans('post', '/app/getDeviceData', data), getDeviceData: (data) => this.trans('post', '/app/getDeviceData', data),
getLiquidLevelData: (data) => this.trans('post', '/app/getLiquidLevelData', data), getLiquidLevelData: (data) => this.trans('post', '/app/getLiquidLevelData', data),
getNorthSouthWaterData: (data) => this.trans('post', '/app/getNorthSouthWaterData', data), getNorthSouthWaterData: (data) => this.trans('post', '/app/getNorthSouthWaterData', data),
getAllRegionData: (data) => this.trans('get', '/cowshedApp/getAll', data),
}; };
public user = { public user = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment