Commit 6817aec5 authored by zhuangzhuang's avatar zhuangzhuang

牛舍配置页改修 牛舍历史数据微调

parent 80b92e88
This diff is collapsed.
This diff is collapsed.
<ion-header>
<ion-toolbar>
<ion-title class="title">{{item.fieldRegionName}}历史数据</ion-title>
<ion-toolbar color="secondary">
<ion-buttons slot="start">
<ion-back-button text="" ></ion-back-button>
</ion-buttons>
<ion-title mode="ios" class="title">{{item.fieldRegionName}}历史数据</ion-title>
</ion-toolbar>
</ion-header>
<ion-content color='light' style="height: 100%">
<ion-content color='light' style="height: 100%; padding-top: 30px;">
<div style="padding-top: 10px">
<h1 class="subTittle">牛舍热应激状态</h1> <span [ngClass]="{'perfect': analResult === '优','good': analResult === '良','bad': analResult === '差'}" margin-start="10px;">{{analResult}}</span>
<h1 style="
font-size: 16px;
padding-left: 5px;
border-left: 5px solid #28c9bd;
line-height: 25px;
margin-bottom: 5px;">牛舍热应激状态</h1> <span [ngClass]="{'perfect': analResult === '优','good': analResult === '良','bad': analResult === '差'}">{{analResult}}</span>
<h1 style="
font-size: 16px;
padding-left: 5px;
border-left: 5px solid #28c9bd;
line-height: 25px;
margin-bottom: 5px;">近8个小时环境参数曲线</h1>
<div echarts [options]="chartOption" class="demo-chart"></div>
<h1 style="
font-size: 16px;
padding-left: 5px;
border-left: 5px solid #28c9bd;
line-height: 25px;
margin-bottom: 5px;">近8个小时环境参数表</h1>
<div>
<ngx-datatable class='material' [rows]="rows" [columnMode]="'force'" [scrollbarH]="true"[scrollbarV]="true" style="white-space: nowrap; ">
<ngx-datatable-column name="时间" prop="time" width="100">
</ngx-datatable-column>
<ngx-datatable-column name="热应激" prop="thi" width="60">
</ngx-datatable-column>
<ngx-datatable-column name="温度" prop="temp" width="80">
</ngx-datatable-column>
<ngx-datatable-column name="湿度" prop="humi" width="80">
</ngx-datatable-column>
<ngx-datatable-column name="光照" prop="AA" width="80">
</ngx-datatable-column>
<ngx-datatable-column name="风机" prop="BB" width="80">
</ngx-datatable-column>
<ngx-datatable-column name="喷淋" prop="CC" width="80">
</ngx-datatable-column>
<ngx-datatable-column name="照明" prop="DD" width="80">
</ngx-datatable-column>
</ngx-datatable>
<h1 class="subTittle">近8个小时环境参数曲线</h1>
<div echarts [options]="chartOption" class="demo-chart"></div>
<h1 class="subTittle">近8个小时环境参数表</h1>
<div>
<ngx-datatable class='material' [rows]="rows" [columnMode]="'force'" [scrollbarH]="true"[scrollbarV]="true" style="white-space: nowrap; text-align: center">
<ngx-datatable-column name="时间" prop="time" width="100">
</ngx-datatable-column>
<ngx-datatable-column name="热应激" prop="thi" width="60">
</ngx-datatable-column>
<ngx-datatable-column name="温度" prop="temp" width="80">
</ngx-datatable-column>
<ngx-datatable-column name="湿度" prop="humi" width="80">
</ngx-datatable-column>
<ngx-datatable-column name="光照" prop="AA" width="80">
</ngx-datatable-column>
<ngx-datatable-column name="风机" prop="BB" width="80">
</ngx-datatable-column>
<ngx-datatable-column name="喷淋" prop="CC" width="80">
</ngx-datatable-column>
<ngx-datatable-column name="照明" prop="DD" width="80">
</ngx-datatable-column>
</ngx-datatable>
</div>
</div>
</ion-content>
......@@ -2,7 +2,7 @@
@import '~@swimlane/ngx-datatable/release/themes/material.css';
@import '~@swimlane/ngx-datatable/release/assets/icons.css';
.perfect{
.perfect {
width: 30px;
height: 30px;
background-color:green;
......@@ -35,12 +35,22 @@
color:white;
}
.demo-chart{
.demo-chart {
width: 100%;
height: 230px;
}
.title{
.title {
text-align: center;
padding-left: 0px
padding-left: 0px;
font-weight: lighter;
font-size: large
}
.subTittle {
font-size: 16px;
padding-left: 5px;
border-left: 5px solid #28c9bd;
line-height: 25px;
margin-bottom: 5px;
}
import { Component, OnInit } from '@angular/core';
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {Api} from '../../service/api';
import {Load} from '../../service/load';
import { NgxDatatableModule } from '@swimlane/ngx-datatable';
import {NgxDatatableModule} from '@swimlane/ngx-datatable';
@Component({
selector: 'v-env-history',
templateUrl: './env-history.page.html',
styleUrls: ['./env-history.page.scss'],
selector: 'v-env-history',
templateUrl: './env-history.page.html',
styleUrls: ['./env-history.page.scss'],
})
export class EnvHistoryPage implements OnInit {
constructor(private api: Api, private ac: ActivatedRoute, private load: Load) { }
item = {fieldRegionNo: ''};
constructor(private api: Api, private ac: ActivatedRoute, private load: Load) {
}
// TODO 以下为假数据 待删除
analResult = '优';
item = {fieldRegionNo: ''};
chartOption = {
backgroundColor: '#F0F8FF',
visualMap: [{
show: false,
type: 'continuous',
seriesIndex: 0,
min: 0,
max: 400},
{
show: false,
type: 'continuous',
seriesIndex: 1,
dimension: 0,
min: 0,
max: 400
}],
// TODO 以下为假数据 待删除
analResult = '优';
xAxis: {
name: '时间',
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: [{
name: '温度(℃)',
type: 'value',
splitLine: {show: false}
},
{
name: '湿度(%)',
type: 'value',
max: 100,
splitLine: {show: false}
}],
series: [{
data: [28, 32, 35, 34, 30, 29, 27],
type: 'line'
},{
data: [15, 13, 12, 11, 12, 11, 87],
yAxisIndex: 1,
type: 'line'
},{
data: [76, 45, 43, 23, 34, 54, 23],
yAxisIndex: 1,
type: 'line'
}]
};
chartOption = {
backgroundColor: '#F0F8FF',
visualMap: [
{show: false, type: 'continuous', seriesIndex: 0, min: 0, max: 400},
{show: false, type: 'continuous', seriesIndex: 1, dimension: 0, min: 0, max: 400}],
xAxis: {
name: '', type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
},
yAxis: [
{name: '温度(℃)', type: 'value', splitLine: {show: false}},
{name: '湿度(%)', type: 'value', max: 100, splitLine: {show: false}}
],
series: [
{data: [28, 32, 35, 34, 30, 29, 27], type: 'line'},
{data: [15, 13, 12, 11, 12, 11, 87], yAxisIndex: 1, type: 'line'},
{data: [76, 45, 43, 23, 34, 54, 23], yAxisIndex: 1, type: 'line'}
]
};
// 时间 热应激 温度 湿度 光照 风机 喷淋 照明
rows = [
{ time: '17:00', thi: '轻', temp: '23.8', humi: '56', AA: '70', BB: '55%', CC: 'O', DD: 'X'},
{ time: '17:30', thi: '中', temp: '27.2', humi: '43', AA: '80', BB: '55%', CC: 'X', DD: 'O' },
{ time: '18:00', thi: '轻', temp: '23.2', humi: '61', AA: '99', BB: '55%', CC: 'O', DD: 'X' },
{ time: '18:30', thi: '轻', temp: '23.1', humi: '47', AA: '100', BB: '55%', CC: 'X', DD: 'O'},
{ time: '19:00', thi: '轻', temp: '20.2', humi: '43', AA: '60', BB: '55%', CC: 'O', DD: 'X' },
{ time: '19:30', thi: '轻', temp: '21.6', humi: '34', AA: '50', BB: '55%', CC: 'O', DD: 'X' },
{ time: '20:00', thi: '轻', temp: '22.5', humi: '43', AA: '40', BB: '55%', CC: 'X', DD: 'O' },
// 时间 热应激 温度 湿度 光照 风机 喷淋 照明
rows = [
{time: '17:00', thi: '轻', temp: '23.8', humi: '56', AA: '70', BB: '55%', CC: 'O', DD: 'X'},
{time: '17:30', thi: '中', temp: '27.2', humi: '43', AA: '80', BB: '55%', CC: 'X', DD: 'O'},
{time: '18:00', thi: '轻', temp: '23.2', humi: '61', AA: '99', BB: '55%', CC: 'O', DD: 'X'},
{time: '18:30', thi: '轻', temp: '23.1', humi: '47', AA: '100', BB: '55%', CC: 'X', DD: 'O'},
{time: '19:00', thi: '轻', temp: '20.2', humi: '43', AA: '60', BB: '55%', CC: 'O', DD: 'X'},
{time: '19:30', thi: '轻', temp: '21.6', humi: '34', AA: '50', BB: '55%', CC: 'O', DD: 'X'},
{time: '20:00', thi: '轻', temp: '22.5', humi: '43', AA: '40', BB: '55%', CC: 'X', DD: 'O'},
];
];
ngOnInit() {
this.ac.queryParams.subscribe((data) => {
this.item.fieldRegionNo = data.no;
});
this.getData(0);
ngOnInit() {
this.ac.queryParams.subscribe((data) => {
this.item.fieldRegionNo = data.no;
});
this.getData(0);
// TODO 待删除
for (let i = 0; i < 8; i ++) {
this.chartOption.xAxis.data = ['8', '7', '6', '5', '4', '3', '2', '1'];
// TODO 待删除
this.chartOption.xAxis.data = ['1', '2', '3', '4', '5', '6', '7', '8'];
// for (let i = 0; i < 8; i++) {
// this.chartOption.xAxis.data = ['1', '2', '3', '4', '5', '6', '7', '8'];
// }
}
}
getData(time) {
if (time) {
this.load.toLoad('加载中...', false);
}
this.api.cowshedApp.getRealDataByFieldRegionNo([{'fieldRegionNo' : this.item.fieldRegionNo}, (data) => {
getData(time) {
if (time) {
this.load.toLoad('加载中...', false);
}
this.api.cowshedApp.getRealDataByFieldRegionNo([{'fieldRegionNo': this.item.fieldRegionNo}, (data) => {
if (data) {
this.item = data;
}
}]);
}
if (data) {
this.item = data;
}
}]);
}
}
......@@ -3,7 +3,7 @@
<ion-buttons slot="start">
<ion-back-button color="secondary" defaultHref="/index" text=""></ion-back-button>
</ion-buttons>
<ion-searchbar (ionInput)="getItems($event)" (ionClear)="resetItems()" debounce="1000"></ion-searchbar>
<ion-searchbar (ionInput)="getItems($event)" (ionClear)="resetItems()" debounce="1000" style="height: 40px;"></ion-searchbar>
<!--<ion-searchbar (ionInput)="getItems($event)" [(ngModel)]="searchItem"></ion-searchbar>-->
<!--<div class="topSearch">
<SearchBar [placeholder]="'点击此处进行搜索'" [(ngModel)]="searchText"
......
......@@ -90,6 +90,11 @@ export class Api {
controlSwitch: (data) => this.trans('post', '/control/controlSwitch', data),
};
public config = {
getAll: (data) => this.trans('post', '/cowshedConfig/getAll', data),
updateCowshedConfig: (data) => this.trans('post', '/cowshedConfig/updateCowshedConfig', data),
};
private trans(type, addr, data) {
this.sendHttpReq(type, addr, data[0], data[1], data[2], data[3]);
}
......
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