Commit f7b6c675 authored by yating.lin's avatar yating.lin

修改牛舍分析页

parent 4021a53a
...@@ -7,6 +7,7 @@ import { IonicModule } from '@ionic/angular'; ...@@ -7,6 +7,7 @@ import { IonicModule } from '@ionic/angular';
import { EnvAnalPage } from './env-anal.page'; import { EnvAnalPage } from './env-anal.page';
import {NgxEchartsCoreModule} from 'ngx-echarts/core'; import {NgxEchartsCoreModule} from 'ngx-echarts/core';
import {NgxDatatableModule} from '@swimlane/ngx-datatable';
const routes: Routes = [ const routes: Routes = [
{ {
...@@ -21,7 +22,8 @@ const routes: Routes = [ ...@@ -21,7 +22,8 @@ const routes: Routes = [
FormsModule, FormsModule,
IonicModule, IonicModule,
RouterModule.forChild(routes), RouterModule.forChild(routes),
NgxEchartsCoreModule NgxEchartsCoreModule,
NgxDatatableModule
], ],
declarations: [EnvAnalPage] declarations: [EnvAnalPage]
}) })
......
...@@ -7,45 +7,16 @@ ...@@ -7,45 +7,16 @@
<ion-content color='light' style="height: 100%"> <ion-content color='light' style="height: 100%">
<ion-item lines="full"> <ion-item lines="full">
<ion-label>请选择牛舍</ion-label> <div>
<ion-select multiple="false" cancelText="取消" okText="确认" (ionChange)="selFarmEvent()"> <ion-button color="primary" style="display: inline-block">输入牛舍单产奶量并分析 >></ion-button>
<ion-select-option *ngFor="let a of cowFarm" value="a.value">{{a.name}}</ion-select-option> </div>
</ion-select>
</ion-item> </ion-item>
<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=" <h1 style="
font-size: 16px; font-size: 16px;
padding-left: 5px; padding-left: 5px;
border-left: 5px solid #28c9bd; border-left: 5px solid #28c9bd;
line-height: 25px; line-height: 25px;
margin-bottom: 5px;">近8个小时环境参数曲线</h1> margin-bottom: 5px;">温湿度曲线图</h1>
<div echarts [options]="chartOption" class="demo-chart"></div> <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'"
>
<ngx-datatable-column name="时间" prop="time" width="100">
</ngx-datatable-column>
<ngx-datatable-column name="热应激" prop="thi" width="200">
</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>
</div>
</ion-content> </ion-content>
...@@ -44,3 +44,33 @@ ...@@ -44,3 +44,33 @@
text-align: center; text-align: center;
padding-left: 0px padding-left: 0px
} }
.fixPadding {
--inner-padding-start:0px;
--inner-padding-end: 8px;
--padding-start: 0px;
--padding-end: 0px;
}
.showNoData {
height: 100px;
line-height: 30px;
display: inline-block;
text-align: center;
width:100%;
margin-top:30px;
}
.echart-pie {
position: fixed;
padding: 10px;
width: 95%;
height: 380px;
margin-bottom: 15px;
}
.subItem{
font-size: 14px;
--padding-start: 0px;
padding-left:5px;
}
import { Component, OnInit } from '@angular/core'; import {Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import * as echarts from 'echarts';
@Component({ @Component({
selector: 'v-env-anal', selector: 'v-env-anal',
...@@ -8,14 +9,16 @@ import { Component, OnInit } from '@angular/core'; ...@@ -8,14 +9,16 @@ import { Component, OnInit } from '@angular/core';
export class EnvAnalPage implements OnInit { export class EnvAnalPage implements OnInit {
cowFarm :[{ // cowFarm :[{
name : '1号牛舍', // name : '1号牛舍',
value : '1'; // value : '1';
},{ // },{
name : '2号牛舍', // name : '2号牛舍',
value : '2'; // value : '2';
}]; // }];
chartData = [{sensorSN: '', unit: '', dataList: []}];
hasChartData = false;
analResult = '优'; analResult = '优';
chartOption = { chartOption = {
...@@ -40,12 +43,12 @@ export class EnvAnalPage implements OnInit { ...@@ -40,12 +43,12 @@ export class EnvAnalPage implements OnInit {
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
}, },
yAxis: [{ yAxis: [{
name:'温度(℃)', name: '温度(℃)',
type: 'value', type: 'value',
splitLine: {show: false} splitLine: {show: false}
}, },
{ {
name:'湿度(%)', name: '湿度(%)',
type: 'value', type: 'value',
max: 100, max: 100,
splitLine: {show: false} splitLine: {show: false}
...@@ -53,37 +56,79 @@ export class EnvAnalPage implements OnInit { ...@@ -53,37 +56,79 @@ export class EnvAnalPage implements OnInit {
series: [{ series: [{
data: [820, 932, 901, 934, 1290, 1330, 1320], data: [820, 932, 901, 934, 1290, 1330, 1320],
type: 'line' type: 'line'
},{ }, {
data: [15, 13, 12, 11, 12, 11, 87], data: [15, 13, 12, 11, 12, 11, 87],
yAxisIndex:1, yAxisIndex: 1,
type: 'line' type: 'line'
},{ }, {
data: [76, 45, 43, 23, 34, 54, 23], data: [76, 45, 43, 23, 34, 54, 23],
yAxisIndex:1, yAxisIndex: 1,
type: 'line' type: 'line'
}] }]
}; };
rows = [
{ time: '17:00', thi: '轻', temp: '23.8', humi: '56' },
{ time: '17:30', thi: '中', temp: '27.2', humi: '43' },
{ time: '18:00', thi: '轻', temp: '23.2', humi: '61' },
{ time: '18:30', thi: '轻', temp: '23.1', humi: '47' },
{ time: '19:00', thi: '轻', temp: '20.2', humi: '43' },
{ time: '19:30', thi: '轻', temp: '21.6', humi: '34' },
{ time: '20:00', thi: '轻', temp: '22.5', humi: '43' },
];
constructor() { } constructor() { }
ngOnInit() { ngOnInit() {
for(let i = 0;i < 8; i ++)
this.chartOption.xAxis.data = ['8','7','6','5','4','3','2','1']; this.fanChart();
this.showerChart();
this.environmentChart();
} }
selFarmEvent(){ fanChart() {
} }
showerChart() {
}
environmentChart() {
this.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: {
type: 'category',
data: ['8', '7', '6', '5', '4', '3', '2', '1']
},
yAxis: [{
name: '温度(℃)',
type: 'value',
splitLine: {show: false}
},
{
name: '湿度(%)',
type: 'value',
max: 100,
splitLine: {show: false}
}],
series: [{
data: [820, 932, 901, 934, 1290, 1330, 1320],
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'
}]
};
}
} }
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