Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
muChangApp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
WitCloud
muChangApp
Commits
06b64e55
Commit
06b64e55
authored
Nov 12, 2019
by
yating.lin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口调试
parent
ea2e1ad5
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
436 additions
and
260 deletions
+436
-260
env-alarm-detail.page.html
src/app/envCtrl/env-alarm-detail/env-alarm-detail.page.html
+2
-2
env-anal-detail.page.html
src/app/envCtrl/env-anal-detail/env-anal-detail.page.html
+2
-2
env-anal-detail.page.scss
src/app/envCtrl/env-anal-detail/env-anal-detail.page.scss
+1
-1
env-anal-detail.page.spec.ts
src/app/envCtrl/env-anal-detail/env-anal-detail.page.spec.ts
+4
-3
env-anal.page.ts
src/app/envCtrl/env-anal/env-anal.page.ts
+5
-5
env-detail.page.html
src/app/envCtrl/env-detail/env-detail.page.html
+8
-6
env-detail.page.scss
src/app/envCtrl/env-detail/env-detail.page.scss
+16
-0
env-detail.page.ts
src/app/envCtrl/env-detail/env-detail.page.ts
+80
-43
env-fan.page.html
src/app/envCtrl/env-fan/env-fan.page.html
+11
-5
env-fan.page.scss
src/app/envCtrl/env-fan/env-fan.page.scss
+17
-2
env-fan.page.ts
src/app/envCtrl/env-fan/env-fan.page.ts
+47
-41
env-history.page.html
src/app/envCtrl/env-history/env-history.page.html
+8
-8
env-history.page.ts
src/app/envCtrl/env-history/env-history.page.ts
+94
-23
env-home.page.html
src/app/envCtrl/env-home/env-home.page.html
+19
-19
env-home.page.scss
src/app/envCtrl/env-home/env-home.page.scss
+13
-4
env-home.page.ts
src/app/envCtrl/env-home/env-home.page.ts
+102
-94
api.ts
src/app/service/api.ts
+7
-2
level-0.png
src/assets/img/level-0.png
+0
-0
level-1.png
src/assets/img/level-1.png
+0
-0
level-2.png
src/assets/img/level-2.png
+0
-0
level-3.png
src/assets/img/level-3.png
+0
-0
level-4.png
src/assets/img/level-4.png
+0
-0
No files found.
src/app/envCtrl/env-alarm-detail/env-alarm-detail.page.html
View file @
06b64e55
...
...
@@ -69,7 +69,7 @@
<div
class=
"body"
>
<h3
style=
"margin-bottom: 5px;"
>
{{item.description}}
</h3>
<div>
<div
style=
"width:
70
%; float: left"
>
<div
style=
"width:
65
%; float: left"
>
<div
*
ngIf=
"item.data.temp"
class=
"warnContent"
>
温度: {{item.data.temp}} ℃
</div>
<div
*
ngIf=
"item.data.humi"
class=
"warnContent"
>
湿度: {{item.data.humi}} %
</div>
<div
*
ngIf=
"item.data.heatStressLevel"
class=
"warnContent"
>
热应激等级: {{item.data.heatStressLevel}}
</div>
...
...
@@ -77,7 +77,7 @@
<div
*
ngIf=
"item.data.press"
class=
"warnContent"
>
电磁阀压力: {{item.data.press}} MPa
</div>
<div
*
ngIf=
"item.data.NH3"
class=
"warnContent"
>
氨气: {{item.data.NH3}} ppm
</div>
</div>
<div
style=
"width:3
0
%; float: left"
>
<div
style=
"width:3
5
%; float: left"
>
<div
*
ngIf=
"displayArea === 'trouble' && item.disposeState === 0"
>
<ion-button
color=
"secondary"
style=
"display: inline-block; width: 55px; height: 30px; font-size: 12px; border-radius: 20px;"
(
click
)="
onRecvClick
(
item
)"
>
确认修复
</ion-button>
</div>
...
...
src/app/envCtrl/env-anal-detail/env-anal-detail.page.html
View file @
06b64e55
...
...
@@ -22,10 +22,10 @@
<div
style=
"max-height: calc(100% - 100px);overflow-y:auto;"
>
<ion-item
lines=
"full"
class=
"inputItem"
*
ngFor=
"let item of fieldRegionNameList"
>
<div
style=
"width:4
0
%; font-size:16px;"
>
<div
style=
"width:4
5
%; font-size:16px;"
>
{{item.name}}单产奶量
</div>
<div
style=
"width:2
7
%; padding-left:10px; font-size:16px;"
>
<div
style=
"width:2
5
%; padding-left:10px; font-size:16px;"
>
<ion-input
class=
"inputText"
[(
ngModel
)]="
item
.
num
"
></ion-input>
</div>
<div
style=
"width:30%; text-align:right; padding-right:15px; font-size:14px;"
>
...
...
src/app/envCtrl/env-anal-detail/env-anal-detail.page.scss
View file @
06b64e55
...
...
@@ -80,7 +80,7 @@
.inputItem
{
font-size
:
16px
;
--padding-start
:
10px
;
--padding-end
:
1
0px
;
--padding-end
:
0px
;
height
:
45px
;
padding-left
:
5px
;
padding-right
:
5px
;
...
...
src/app/envCtrl/env-anal-detail/env-anal-detail.page.spec.ts
View file @
06b64e55
...
...
@@ -16,13 +16,14 @@ describe('EnvAnalDetailPage', () => {
.
compileComponents
();
}));
beforeEach
((
void
)
=>
{
beforeEach
(()
=>
{
fixture
=
TestBed
.
createComponent
(
EnvAnalDetailPage
);
component
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
});
it
(
'should create'
,
(
void
)
=>
{
it
(
'should create'
,
()
=>
{
expect
(
component
).
toBeTruthy
();
});
});
src/app/envCtrl/env-anal/env-anal.page.ts
View file @
06b64e55
...
...
@@ -339,7 +339,7 @@ export class EnvAnalPage implements OnInit {
trigger
:
'axis'
},
legend
:
{
data
:
[
'温度
(℃)'
,
'湿度(% rH)
'
]
data
:
[
'温度
'
,
'湿度
'
]
},
xAxis
:
{
type
:
'category'
,
...
...
@@ -350,7 +350,7 @@ export class EnvAnalPage implements OnInit {
{
type
:
'value'
,
scale
:
true
,
name
:
'
温度(℃
)'
,
name
:
'
湿度(% rH
)'
,
// max: 1200,
// min: 0,
boundaryGap
:
[
0.1
,
0.1
]
...
...
@@ -358,7 +358,7 @@ export class EnvAnalPage implements OnInit {
{
type
:
'value'
,
scale
:
true
,
name
:
'
湿度(% rH
)'
,
name
:
'
温度(℃
)'
,
// max: 1200,
// min: 0,
boundaryGap
:
[
0.1
,
0.1
]
...
...
@@ -388,8 +388,8 @@ export class EnvAnalPage implements OnInit {
}
],
grid
:
{
left
:
'
5
%'
,
// 组件离容器左侧的距离
right
:
'
5
%'
,
left
:
'
9
%'
,
// 组件离容器左侧的距离
right
:
'
8
%'
,
bottom
:
'0%'
,
top
:
'15%'
,
containLabel
:
true
// grid 区域是否包含坐标轴的刻度标签
...
...
src/app/envCtrl/env-detail/env-detail.page.html
View file @
06b64e55
...
...
@@ -10,19 +10,21 @@
</ion-toolbar>
<div
class=
"top"
>
<span
[
ngClass
]="{'
online
'
:
item
.
online
,
'
offline
'
:
!
item
.
online
}"
>
{{item.online ? '在线' : '离线'}}
</span>
<span
*
ngIf=
"item.operationModel"
class=
"online"
>
{{item.operationModel ? '平控' :'现控'}}
</span>
<span
*
ngIf=
"item.operationModel === 1 || item.operationModel === 0"
class=
"online"
>
{{item.operationModel ? '平控' :'现控'}}
</span>
<span
*
ngIf=
"item.operationModel === 4"
class=
"offline"
>
现控
</span>
<span
*
ngIf=
"item.operationModel"
[
ngClass
]="{'
online
'
:
item
.
isWisdomModel
,
'
offline
'
:
!
item
.
isWisdomModel
}"
class=
"online"
>
智控
</span>
<span
*
ngIf=
"item.ts"
class=
"right"
>
{{item.ts | date: 'yyyy-MM-dd HH:mm'}}
</span>
<span
*
ngIf=
"item.ts"
class=
"right"
style=
"padding-top: 3px;"
>
{{item.ts | date: 'yyyy-MM-dd HH:mm'}}
</span>
</div>
<div
style=
"background-color: #F0F0F0;"
align=
"center"
>
<v-kanban
class=
"home-bar"
name=
"温度"
[
inData
]="
item
.
temp
"
iconClass=
"vo v-wendu"
iconColor=
"#285B90"
iconSize=
"20px"
fontSize=
"14px"
></v-kanban>
<v-kanban
class=
"home-bar"
name=
"湿度"
[
inData
]="
item
.
humi
"
iconClass=
"vo v-shidu"
iconColor=
"#285B90"
iconSize=
"20px"
fontSize=
"14px"
></v-kanban>
<v-kanban
class=
"home-bar"
name=
"热应激"
[
inData
]="
item
.
heatStressLevelName
"
iconClass=
"vo v-nav-ico"
[
iconColor
]="
item
.
heatStressColor
"
iconSize=
"20px"
fontSize=
"14px"
></v-kanban>
<v-kanban
class=
"home-bar"
name=
"在舍状态"
[
inData
]="
item
.
inHouse
"
iconClass=
"vo v-dapeng-"
iconColor=
"#285B90"
iconSize=
"20px"
fontSize=
"14px"
></v-kanban>
<v-kanban
class=
"home-bar"
name=
"在舍状态"
[
inData
]="
item
.
inHouse
.
inHouseName
"
iconClass=
"vo v-dapeng-"
iconColor=
"#285B90"
iconSize=
"20px"
fontSize=
"14px"
></v-kanban>
</div>
<div
style=
"background-color: #F0F0F0; height: 30px; padding-right: 10px; padding-top: 5px;"
>
<ion-label
style=
"margin-left:15px; height: 30px; vertical-align: middle;"
>
在离舍开关控制
</ion-label>
<v-switch
(
click
)="
setInHouse
(
item
.
inHouse
)"
[
value
]="
item
.
inHouse
"
[
loading
]="
loading
"
></v-switch>
<div
class=
"inHouse"
>
<ion-label
class=
"inHouseLabel"
>
在离舍开关控制
</ion-label>
<ion-toggle
[(
ngModel
)]="
item
.
inHouse
.
inHouse
"
(
click
)="
inHouseControl
(
item
.
inHouse
)"
></ion-toggle>
<!--<v-switch (click)="inHouseControl(item.inHouse)" [value]="item.inHouse.inHouse" [loading]="loading"></v-switch>-->
</div>
</ion-header>
<ion-content
style=
"background-color: #F3F4F4;"
>
...
...
src/app/envCtrl/env-detail/env-detail.page.scss
View file @
06b64e55
...
...
@@ -60,3 +60,19 @@
--color-selected
:
#62C7CC
;
// --background: #62C7CC;
}
.inHouse
{
background-color
:
rgb
(
240
,
240
,
240
);
height
:
35px
;
padding-right
:
10px
;
padding
:
5px
;
text-align
:
right
;
}
.inHouseLabel
{
display
:
inline-block
;
margin-left
:
15px
;
margin-right
:
10px
;
height
:
35px
;
vertical-align
:
middle
;
}
src/app/envCtrl/env-detail/env-detail.page.ts
View file @
06b64e55
...
...
@@ -18,12 +18,30 @@ export class EnvDetailPage implements OnInit {
private
load
:
Load
,
private
tf
:
Transfer
)
{}
item
:
any
=
{};
item
:
any
=
{
factoryNo
:
''
,
factoryName
:
''
,
fieldRegionNo
:
''
,
fieldRegionName
:
''
,
temp
:
0
,
humi
:
0
,
heatStressLevel
:
0
,
online
:
0
,
operationModel
:
1
,
isWisdomModel
:
1
,
alarm
:
1
,
inHouse
:
{
inHouse
:
1
,
inHouseName
:
''
,
fieldDeviceNo
:
''
,
fieldDeviceType
:
''
,
},
ts
:
0
};
fieldRegionNo
=
''
;
loading
=
false
;
// 发送指令延时判断
comm
=
{
remain
:
20
,
...
...
@@ -52,11 +70,11 @@ export class EnvDetailPage implements OnInit {
this
.
showerLink
=
'/env-detail/shower/'
+
this
.
fieldRegionNo
;
this
.
lightLink
=
'/env-detail/light/'
+
this
.
fieldRegionNo
;
this
.
waterchannelLink
=
'/env-detail/waterchannel/'
+
this
.
fieldRegionNo
;
if
(
this
.
item
&&
this
.
item
.
heatStressLevel
&&
this
.
item
.
heatStressLevel
!==
''
)
{
this
.
item
.
heatStressColor
=
this
.
item
.
heatStressLevel
===
'0'
?
'#71fa1d'
:
this
.
item
.
heatStressLevel
===
'1'
?
'#71fa1d'
:
this
.
item
.
heatStressLevel
===
'2'
?
'#FAB139'
:
this
.
item
.
heatStressLevel
===
'3'
?
'#ff6a1f'
:
'#b22222'
;
if
(
this
.
item
)
{
this
.
item
.
heatStressColor
=
this
.
item
.
heatStressLevel
===
0
?
'#71fa1d'
:
this
.
item
.
heatStressLevel
===
1
?
'#71fa1d'
:
this
.
item
.
heatStressLevel
===
2
?
'#FAB139'
:
this
.
item
.
heatStressLevel
===
3
?
'#ff6a1f'
:
'#b22222'
;
}
}
...
...
@@ -64,36 +82,38 @@ export class EnvDetailPage implements OnInit {
if
(
time
)
{
this
.
load
.
toLoad
(
'加载中...'
,
false
);
}
// this.api.cowshedApp.getRealDataByFieldRegionNo([{'fieldRegionNo' : this.fieldRegionNo}, (data) => {
// if (data) {
// this.item = data;
// this.initLayout();
// }
// }]);
// ----------------------------------------------
// TODO 测试用准备数据
this
.
item
=
{
// 3-重度热应激 在线 平控 非智控(自控) 有报警
fieldRegionNo
:
'FRN136641006052720640'
,
fieldRegionName
:
'1号牛舍'
,
temp
:
'23.5'
,
humi
:
'82.8'
,
heatStressLevel
:
'3'
,
heatStressLevelName
:
this
.
getHeatStressLevelName
(
'3'
),
online
:
1
,
// 0-离线,1-在线
operationModel
:
1
,
// 0-现控,1-平控
isWisdomModel
:
0
,
// 0-非智控(自控),1-智控
alarm
:
1
,
inHouse
:
this
.
getInHouseState
(
1
),
// 0-离舍,1-在舍
ts
:
'2019-08-05 23:44'
,
};
this
.
api
.
cowshedApp
.
getRealDataByFieldRegionNo
([{
fieldRegionNo
:
this
.
fieldRegionNo
},
(
data
)
=>
{
if
(
data
)
{
this
.
item
=
data
;
this
.
item
.
heatStressLevelName
=
this
.
getHeatStressLevelName
(
data
.
heatStressLevel
);
this
.
item
.
inHouse
.
inHouseName
=
this
.
getInHouseState
(
data
.
inHouse
.
inHouse
);
this
.
initLayout
();
// ----------------------------------------------
}
}]);
// START----------------------------------------------
// TODO 测试用准备数据
// this.item = {
// // 3-重度热应激 在线 平控 非智控(自控) 有报警
// fieldRegionNo: 'FRN136641006052720640',
// fieldRegionName: '1号牛舍',
// temp: '23.5',
// humi: '82.8',
// heatStressLevel: '3',
// heatStressLevelName: this.getHeatStressLevelName('3'),
// online: 1, // 0-离线,1-在线
// operationModel: 1, // 0-现控,1-平控
// isWisdomModel: 0, // 0-非智控(自控),1-智控
// alarm: 1,
// inHouse : this.getInHouseState(1), // 0-离舍,1-在舍
// ts: '2019-08-05 23:44',
// };
// this.initLayout();
// END----------------------------------------------
}
getHeatStressLevelName
(
id
)
{
getHeatStressLevelName
(
level
)
{
let
levelName
=
''
;
switch
(
id
)
{
switch
(
level
)
{
case
'0'
:
levelName
=
'无'
;
break
;
...
...
@@ -115,9 +135,9 @@ export class EnvDetailPage implements OnInit {
return
levelName
;
}
getInHouseState
(
id
)
{
getInHouseState
(
state
)
{
let
stateName
=
''
;
switch
(
id
)
{
switch
(
state
)
{
case
0
:
stateName
=
'离舍 '
;
break
;
...
...
@@ -125,22 +145,39 @@ export class EnvDetailPage implements OnInit {
stateName
=
'在舍'
;
break
;
default
:
stateName
=
' '
;
break
;
}
return
stateName
;
}
toHistory
(
item
)
{
const
query
=
'env-history?no='
+
item
.
fieldRegionNo
;
this
.
nav
.
navigateForward
(
query
);
// 在离舍开关控制
inHouseControl
(
inHouse
)
{
if
(
inHouse
.
fieldDeviceNo
!==
null
&&
inHouse
.
fieldDeviceNo
!==
''
)
{
const
opt
=
{
fieldDeviceNo
:
''
,
fieldDeviceType
:
''
,
op
:
''
,
ts
:
0
};
opt
.
fieldDeviceNo
=
inHouse
.
fieldDeviceNo
;
opt
.
fieldDeviceType
=
inHouse
.
fieldDeviceType
;
opt
.
op
=
inHouse
.
inHouse
;
opt
.
ts
=
new
Date
().
valueOf
();
this
.
comm
.
remain
=
20
;
this
.
api
.
control
.
controlCowedSwitch
([
opt
,
(
data
)
=>
{
if
(
data
&&
data
.
code
===
1
)
{
this
.
getData
(
1
);
this
.
api
.
presentMsgToast
(
data
.
message
);
// this.alarmMsg.locked = false;
}
else
{
this
.
api
.
presentMsgToast
(
data
.
message
);
}
this
.
comm
.
remain
=
0
;
}]);
}
setInHouse
()
{
this
.
loading
=
true
;
// TODO 在离舍开关控制
this
.
loading
=
false
;
}
toHistory
(
item
)
{
const
query
=
'env-history?no='
+
item
.
fieldRegionNo
+
'&name='
+
item
.
fieldRegionName
+
'&heatStressLevel='
+
item
.
heatStressLevel
;
this
.
nav
.
navigateForward
(
query
);
}
// doRefresh(event) {
// setTimeout(() => {
// this.getData(0);
...
...
src/app/envCtrl/env-fan/env-fan.page.html
View file @
06b64e55
...
...
@@ -23,18 +23,24 @@
margin-bottom: 5px;"
>
控制/状态
</h1>
<ion-item
*
ngIf=
"batchSwitch"
lines=
"full"
insert=
"false"
>
<ion-label>
一键控制
</ion-label>
<!--<ion-toggle slot="end" [checked]="batchSwitch.op" [disabled]="batchSwitch.s"></ion-toggle>-->
<v-switch
(
click
)="
allCheck
(
batchSwitch
)"
[
value
]="
batchSwitch
.
op
"
[
disabled
]="
batchSwitch
.
disabled
"
[
loading
]="
batchSwitch
.
load
"
></v-switch>
<ion-toggle
slot=
"end"
[
checked
]="
batchSwitch
.
op =
==
1
"
[
disabled
]="
batchSwitch
.
disabled
"
[(
ngModel
)]="
batchSwitch
.
op
"
(
load
)="
batchSwitch
.
load
"
(
click
)="
allCheck
(
batchSwitch
)"
></ion-toggle>
<!--<v-switch (click)="allCheck(batchSwitch)" [value]="batchSwitch.op" [disabled]="batchSwitch.disabled" [loading]="batchSwitch.load"></v-switch>-->
</ion-item>
<div>
<ion-card
*
ngFor=
"let device of devices"
class=
"card"
color=
"white"
>
<ion-card-header>
<ion-card-header
class=
"cardHeader"
>
<ion-card-subtitle
align=
"center"
>
{{device.fieldDeviceName}}
</ion-card-subtitle>
</ion-card-header>
<ion-card-content>
<ion-card-content
class=
"cardContent"
>
<!--<ion-toggle slot="middle" [checked]="device.state"></ion-toggle>-->
<v-switch
class=
"btn-switch"
(
click
)="
deviceCheck
(
device
)"
[
value
]="
device
.
state
"
[
disabled
]="
device
.
disabled
"
[
loading
]="
device
.
load
"
></v-switch>
<ion-toggle
class=
"btn-switch"
*
ngIf=
"device.alarm === 0"
[
checked
]="
batchSwitch
.
op =
==
1
"
[
disabled
]="
device
.
disabled
"
[(
ngModel
)]="
device
.
state
"
(
click
)="
deviceCheck
(
device
)"
></ion-toggle>
<ion-toggle
class=
"btn-switch"
*
ngIf=
"device.alarm === 1"
[
checked
]="
batchSwitch
.
op =
==
1
"
[
disabled
]="
device
.
disabled
"
color=
"danger"
[(
ngModel
)]="
device
.
state
"
(
click
)="
deviceCheck
(
device
)"
></ion-toggle>
<!--<v-switch *ngIf="device.alarm === 0" class="btn-switch" (click)="deviceCheck(device)" [value]="device.state" [disabled]="device.disabled" [loading]="device.load"></v-switch>-->
<!--<v-switch *ngIf="device.alarm === 1" class="btn-switch" color="danger" (click)="deviceCheck(device)" [value]="device.state" [disabled]="device.disabled" [loading]="device.load"></v-switch>-->
</ion-card-content>
</ion-card>
</div>
...
...
src/app/envCtrl/env-fan/env-fan.page.scss
View file @
06b64e55
.card
{
float
:
none
;
display
:
inline-block
;
width
:
2
8
%
;
margin
:
10px
10px
5px
5px
;
width
:
2
2
%
;
margin
:
5px
;
}
.btn-switch
{
...
...
@@ -10,3 +10,18 @@
display
:
inline-block
;
margin-top
:
5px
;
}
.btn-switch-alarm
{
// --background-checked: #ff95a1;
--background
:
#ff95a1
;
}
.cardHeader
{
--padding-inline-start
:
0px
!
important
;
--padding-inline-end
:
0px
!
important
;
padding
:
10px
;
}
.cardContent
{
padding
:
5px
;
text-align
:
center
;
}
src/app/envCtrl/env-fan/env-fan.page.ts
View file @
06b64e55
...
...
@@ -26,7 +26,7 @@ export class EnvFanPage implements OnInit {
controlModelOptions
=
[
{
modelId
:
0
,
modelValue
:
'手控模式'
},
{
modelId
:
1
,
modelValue
:
'自控模式'
},
{
modelId
:
2
,
modelValue
:
'智
慧控制
'
}];
{
modelId
:
2
,
modelValue
:
'智
控模式
'
}];
// 发送指令延时判断
comm
=
{
...
...
@@ -37,36 +37,44 @@ export class EnvFanPage implements OnInit {
constructor
(
private
api
:
Api
,
private
ac
:
ActivatedRoute
,
private
load
:
Load
,
private
alertControlle
:
AlertController
)
{
}
ngOnInit
()
{
this
.
init
();
}
init
()
{
this
.
ac
.
queryParams
.
subscribe
((
data
)
=>
{
this
.
fieldRegionNo
=
data
.
no
;
});
this
.
getData
(
0
);
});
}
getData
(
time
)
{
if
(
time
)
{
this
.
load
.
toLoad
(
'加载中...'
,
false
);
}
this
.
api
.
cowshedApp
.
getFengJiData
([{
'fieldRegionNo'
:
this
.
fieldRegionNo
},
(
data
)
=>
{
if
(
data
)
{
this
.
api
.
cowshedApp
.
getFengJiData
([{
fieldRegionNo
:
this
.
fieldRegionNo
},
(
data
)
=>
{
if
(
data
&&
data
.
fieldRegionNo
)
{
this
.
fieldRegionNo
=
data
.
fieldRegionNo
;
this
.
fieldDeviceType
=
data
.
fieldDeviceType
;
this
.
controlModel
=
data
.
controlModel
;
this
.
devices
=
data
.
param
;
// --------------------------------------------------------------------
this
.
initButtons
();
}
// START--------------------------------------------------------------------
// TODO 测试用准备数据
// this.fieldRegionNo = 'FRN136641006052720640';
this
.
fieldDeviceType
=
'风机'
;
this
.
controlModel
=
0
;
this
.
devices
=
[{
fieldDeviceNo
:
'136641005998194688'
,
fieldDeviceName
:
'A号风机组'
,
state
:
1
},
{
fieldDeviceNo
:
'136641005998194688'
,
fieldDeviceName
:
'B号风机组'
,
state
:
0
},
{
fieldDeviceNo
:
'136641005998194688'
,
fieldDeviceName
:
'C号风机组'
,
state
:
1
},
{
fieldDeviceNo
:
'136641005998194688'
,
fieldDeviceName
:
'D号风机组'
,
state
:
0
},
{
fieldDeviceNo
:
'136641005998194688'
,
fieldDeviceName
:
'E号风机组'
,
state
:
1
},
{
fieldDeviceNo
:
'136641005998194688'
,
fieldDeviceName
:
'F号风机组'
,
state
:
1
}];
// --------------------------------------------------------------------
this
.
devices
=
[{
fieldDeviceNo
:
'136641005998194688'
,
fieldDeviceName
:
'1号组'
,
state
:
1
,
alarm
:
1
},
{
fieldDeviceNo
:
'136641005998194688'
,
fieldDeviceName
:
'2号组'
,
state
:
0
,
alarm
:
1
},
{
fieldDeviceNo
:
'136641005998194688'
,
fieldDeviceName
:
'3号组'
,
state
:
1
,
alarm
:
0
},
{
fieldDeviceNo
:
'136641005998194688'
,
fieldDeviceName
:
'4号组'
,
state
:
0
,
alarm
:
1
},
{
fieldDeviceNo
:
'136641005998194688'
,
fieldDeviceName
:
'5号组'
,
state
:
1
,
alarm
:
0
},
{
fieldDeviceNo
:
'136641005998194688'
,
fieldDeviceName
:
'6号组'
,
state
:
1
,
alarm
:
0
}];
this
.
initButtons
();
// END--------------------------------------------------------------------
}]);
}
initButtons
()
{
// [手控(0)]的状态下:活性(false) 以外:非活性(true)
const
allDisabled
=
this
.
controlModel
===
0
?
false
:
true
;
this
.
batchSwitch
.
disabled
=
allDisabled
;
...
...
@@ -74,7 +82,7 @@ export class EnvFanPage implements OnInit {
device
.
disabled
=
allDisabled
;
});
// 设置
[一键控制]按钮(默认: 开启)
//
[一键控制]按钮(默认: 开启)
// 当任意子按钮[关闭]的状态下: 关闭 以外:开启
this
.
batchSwitch
.
op
=
1
;
this
.
devices
.
map
((
device
)
=>
{
...
...
@@ -83,22 +91,20 @@ export class EnvFanPage implements OnInit {
}
});
}
}]);
}
// 一键控制
allCheck
(
btn
)
{
btn
.
load
=
true
;
const
req
=
{
fieldRegionNo
:
this
.
fieldRegionNo
,
fieldDeviceType
:
this
.
fieldDeviceType
,
op
:
btn
.
op
?
0
:
1
,
type
:
this
.
fieldDeviceType
,
ts
:
parseInt
((
new
Date
().
getTime
()
/
1000
).
toString
(),
10
)
};
this
.
comm
.
remain
=
120
;
// 一键开启设备
this
.
api
.
control
.
controlBatchSwitch
([
req
,
(
data
)
=>
{
this
.
api
.
control
.
control
Cowed
BatchSwitch
([
req
,
(
data
)
=>
{
if
(
data
.
code
===
1
)
{
this
.
getData
(
1
);
this
.
api
.
presentMsgToast
(
data
.
message
);
...
...
@@ -117,23 +123,23 @@ export class EnvFanPage implements OnInit {
// 单个设备控制
deviceCheck
(
btn
)
{
btn
.
loading
=
true
;
// btn.load
= true;
const
req
=
{
fieldDeviceNo
:
btn
.
fieldDeviceNo
,
fieldDeviceType
:
this
.
fieldDeviceType
,
op
:
btn
.
state
?
0
:
1
,
ts
:
parseInt
((
new
Date
().
getTime
()
/
1000
).
toString
(),
10
)
ts
:
new
Date
().
valueOf
(
)
};
this
.
comm
.
remain
=
20
;
this
.
api
.
control
.
controlSwitch
([
req
,
(
data
)
=>
{
this
.
api
.
control
.
control
Cowed
Switch
([
req
,
(
data
)
=>
{
if
(
data
&&
data
.
code
===
1
)
{
this
.
getData
(
1
);
this
.
comm
.
remain
=
0
;
this
.
api
.
presentMsgToast
(
data
.
message
);
}
else
{
this
.
comm
.
remain
=
0
;
this
.
api
.
presentMsgToast
(
data
.
message
);
}
btn
.
loading
=
false
;
this
.
comm
.
remain
=
0
;
// btn.load = false;
}]);
}
}
src/app/envCtrl/env-history/env-history.page.html
View file @
06b64e55
...
...
@@ -3,7 +3,7 @@
<ion-buttons
slot=
"start"
>
<ion-back-button
text=
""
></ion-back-button>
</ion-buttons>
<ion-title
mode=
"ios"
class=
"title"
>
{{
item.
fieldRegionName}}历史数据
</ion-title>
<ion-title
mode=
"ios"
class=
"title"
>
{{fieldRegionName}}历史数据
</ion-title>
</ion-toolbar>
</ion-header>
...
...
@@ -11,23 +11,23 @@
<div
style=
"padding-top: 10px"
>
<h1
class=
"subTittle"
>
牛舍热应激状态
</h1>
<div
style=
"width:100%; padding: 10px"
>
<img
[
src
]="'../../
assets
/
img
/
level-
best
.
png
'"
style=
"width:50px !important"
>
<img
[
src
]="'../../
assets
/
img
/
level-
'
+
heatStressLevel
+
'
.
png
'"
style=
"width:50px !important"
>
</div>
<h1
class=
"subTittle"
>
近8个小时环境参数曲线
</h1>
<div
echarts
[
options
]="
chartOption
"
class=
"demo-chart"
></div>
<h1
class=
"subTittle"
>
近8个小时环境参数表
</h1>
<div
style=
"width: 98%"
>
<ngx-datatable
class=
"material"
[
rows
]="
rows
"
[
columnMode
]="'
force
'"
[
scrollbarH
]="
true
"
[
scrollbarV
]="
true
"
style=
"white-space: nowrap;
text-align: center; font-size:14px"
>
<ngx-datatable-column
name=
"时间"
prop=
"t
ime"
width
=
"80"
>
<ngx-datatable
class=
"material"
[
rows
]="
tableRows
"
[
columnMode
]="'
force
'"
[
scrollbarH
]="
true
"
[
scrollbarV
]="
true
"
style=
"
text-align: center; font-size:14px"
>
<ngx-datatable-column
name=
"时间"
prop=
"t
s"
[
width
]
="
80
"
>
</ngx-datatable-column>
<ngx-datatable-column
name=
"热应激"
prop=
"thi"
width=
"6
0"
>
<ngx-datatable-column
name=
"热应激"
prop=
"thi"
[
width
]="
8
0
"
>
</ngx-datatable-column>
<ngx-datatable-column
name=
"温度"
prop=
"temp"
width=
"6
0"
>
<ngx-datatable-column
name=
"温度"
prop=
"temp"
[
width
]="
8
0
"
>
</ngx-datatable-column>
<ngx-datatable-column
name=
"湿度"
prop=
"humi"
width=
"6
0"
>
<ngx-datatable-column
name=
"湿度"
prop=
"humi"
[
width
]="
8
0
"
>
</ngx-datatable-column>
<ngx-datatable-column
name=
"氨气浓度"
prop=
"NH3"
width=
"8
0"
>
<ngx-datatable-column
name=
"氨气浓度"
prop=
"NH3"
[
width
]="
9
0
"
>
</ngx-datatable-column>
</ngx-datatable>
</div>
...
...
src/app/envCtrl/env-history/env-history.page.ts
View file @
06b64e55
...
...
@@ -3,6 +3,7 @@ import {ActivatedRoute} from '@angular/router';
import
{
Api
}
from
'../../service/api'
;
import
{
Load
}
from
'../../service/load'
;
import
{
NgxDatatableModule
}
from
'@swimlane/ngx-datatable'
;
import
{
DateFormatter
}
from
'@angular/common/src/pipes/deprecated/intl'
;
@
Component
({
selector
:
'v-env-history'
,
...
...
@@ -14,9 +15,13 @@ export class EnvHistoryPage implements OnInit {
constructor
(
private
api
:
Api
,
private
ac
:
ActivatedRoute
,
private
load
:
Load
)
{
}
fieldRegionNo
=
''
;
fieldRegionName
=
''
;
heatStressLevel
=
0
;
item
:
any
=
{};
// --------------------------------------------------------------------------------
//
START
--------------------------------------------------------------------------------
// TODO 以下为假数据 待删除
chartOption
=
{
backgroundColor
:
'#F0F8FF'
,
...
...
@@ -39,43 +44,109 @@ export class EnvHistoryPage implements OnInit {
};
// 时间 热应激 温度 湿度 光照 风机 喷淋 照明
r
ows
=
[
{
t
ime
:
'17:00'
,
thi
:
'轻'
,
temp
:
'23.8'
,
humi
:
'56'
,
NH3
:
'70'
},
{
t
ime
:
'17:30'
,
thi
:
'中'
,
temp
:
'27.2'
,
humi
:
'43'
,
NH3
:
'80'
},
{
t
ime
:
'18:00'
,
thi
:
'轻'
,
temp
:
'23.2'
,
humi
:
'61'
,
NH3
:
'99'
},
{
t
ime
:
'18:30'
,
thi
:
'轻'
,
temp
:
'23.1'
,
humi
:
'47'
,
NH3
:
'100'
},
{
t
ime
:
'19:00'
,
thi
:
'轻'
,
temp
:
'20.2'
,
humi
:
'43'
,
NH3
:
'60'
},
{
t
ime
:
'19:30'
,
thi
:
'轻'
,
temp
:
'21.6'
,
humi
:
'34'
,
NH3
:
'50'
},
{
t
ime
:
'20:00'
,
thi
:
'轻'
,
temp
:
'22.5'
,
humi
:
'43'
,
NH3
:
'40'
},
tableR
ows
=
[
{
t
s
:
'17:00'
,
thi
:
'轻'
,
temp
:
'23.8'
,
humi
:
'56'
,
NH3
:
'70'
},
{
t
s
:
'17:30'
,
thi
:
'中'
,
temp
:
'27.2'
,
humi
:
'43'
,
NH3
:
'80'
},
{
t
s
:
'18:00'
,
thi
:
'轻'
,
temp
:
'23.2'
,
humi
:
'61'
,
NH3
:
'99'
},
{
t
s
:
'18:30'
,
thi
:
'轻'
,
temp
:
'23.1'
,
humi
:
'47'
,
NH3
:
'100'
},
{
t
s
:
'19:00'
,
thi
:
'轻'
,
temp
:
'20.2'
,
humi
:
'43'
,
NH3
:
'60'
},
{
t
s
:
'19:30'
,
thi
:
'轻'
,
temp
:
'21.6'
,
humi
:
'34'
,
NH3
:
'50'
},
{
t
s
:
'20:00'
,
thi
:
'轻'
,
temp
:
'22.5'
,
humi
:
'43'
,
NH3
:
'40'
},
];
// --------------------------------------------------------------------------------
//
END
--------------------------------------------------------------------------------
ngOnInit
()
{
this
.
init
();
}
init
()
{
this
.
ac
.
queryParams
.
subscribe
((
data
)
=>
{
this
.
item
.
fieldRegionNo
=
data
.
no
;
});
this
.
fieldRegionNo
=
data
.
no
;
this
.
fieldRegionName
=
data
.
name
;
this
.
heatStressLevel
=
data
.
heatStressLevel
;
this
.
getData
(
0
);
// --------------------------------------------------------------------------------
// 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
)
=>
{
// TODO 测试用假数据
data
.
fieldRegionName
=
'1号牛舍'
;
const
req
:
any
=
{};
req
.
fieldRegionNo
=
this
.
fieldRegionNo
;
req
.
startTime
=
new
Date
().
valueOf
()
-
8
*
3600
*
1000
;
req
.
endTime
=
new
Date
().
valueOf
();
this
.
api
.
cowshedApp
.
getHistoryByFieldRegionNo
([
req
,
(
data
)
=>
{
if
(
data
)
{
this
.
paintChart
(
data
);
}
}]);
req
.
counts
=
1
;
this
.
api
.
cowshedApp
.
getHistoryTableByFieldRegionNo
([
req
,
(
data
)
=>
{
if
(
data
&&
data
.
constructor
===
Array
)
{
this
.
item
=
data
;
this
.
paintTable
(
data
);
}
}]);
}
paintChart
(
param
)
{
const
temp
=
[];
const
humi
=
[];
const
thi
=
[];
const
times
=
[];
if
(
param
.
temp
&&
param
.
temp
.
constructor
===
Array
)
{
param
.
temp
.
map
(
item
=>
{
times
.
push
(
new
Date
(
item
.
time
).
getHours
());
temp
.
push
(
item
.
value
);
});
}
if
(
param
.
humi
&&
param
.
humi
.
constructor
===
Array
)
{
param
.
humi
.
map
(
item
=>
{
humi
.
push
(
item
.
value
);
});
}
if
(
param
.
thi
&&
param
.
thi
.
constructor
===
Array
)
{
param
.
thi
.
map
(
item
=>
{
thi
.
push
(
item
.
value
);
});
}
this
.
chartOption
=
{
backgroundColor
:
'#fff'
,
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
:
times
,
},
yAxis
:
[
{
name
:
'温度(℃)'
,
type
:
'value'
,
splitLine
:
{
show
:
false
}},
{
name
:
'湿度(%)'
,
type
:
'value'
,
max
:
100
,
splitLine
:
{
show
:
false
}}
],
series
:
[
{
data
:
temp
,
type
:
'line'
},
{
data
:
humi
,
yAxisIndex
:
1
,
type
:
'line'
},
{
data
:
thi
,
yAxisIndex
:
1
,
type
:
'line'
}
]
};
}
paintTable
(
param
)
{
this
.
tableRows
=
[];
param
.
map
(
item
=>
{
this
.
tableRows
.
push
({
ts
:
item
.
ts
,
thi
:
item
.
heatStressLevel
,
temp
:
item
.
temp
,
humi
:
item
.
humi
,
NH3
:
item
.
NH3
});
});
}
}
src/app/envCtrl/env-home/env-home.page.html
View file @
06b64e55
...
...
@@ -3,19 +3,8 @@
<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" style="height: 40px;"></ion-searchbar>-->
<ion-searchbar
(
ionInput
)="
getItems
($
event
)"
debounce=
"1000"
style=
"height: 40px;"
></ion-searchbar>
<!--<ion-searchbar debounce="1000" style="height: 40px;"></ion-searchbar>-->
<!--<ion-searchbar (ionInput)="getItems($event)" [(ngModel)]="searchItem"></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>
<!--<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"
>
...
...
@@ -51,18 +40,29 @@
<ion-item
*
ngFor=
"let item of items"
(
click
)="
toControl
(
item
)"
class=
"ion-item"
style=
"width: 100%; --padding-start: 0px"
>
<div
class=
"item"
>
<div
class=
"top"
>
<i
*
ngIf=
"item.alarm"
class=
"vo v-tixing"
></i>
{{item.fieldRegionName}}
<div
style=
"width:10%; float:left"
><img
[
src
]="'../../
assets
/
img
/
house
.
png
'"
style=
"display: inline-block;margin-right: 10px; width:23px !important"
>
</div>
<div
style=
"width:90%; float:left; padding-top: 4px;"
>
<span
style=
"text-align: center"
>
{{item.fieldRegionName}}
</span><span
style=
"text-align: center; font-size:12px; padding-left:10px; color:red;"
*
ngIf=
"item.operationModel === 4"
>
(部分设备处于现控状态)
</span></div>
</div>
<div
class=
"content"
>
<span
*
ngIf=
"item.temp"
>
温度:
{{item.temp}} ℃
</span>
<span
*
ngIf=
"item.humi"
>
湿度:
{{item.humi}} %
</span>
<span
*
ngIf=
"item.heatStressLevel"
>
热应激等级:
<span
class=
"warmColor{{item.heatStressLevel}}"
>
{{item.heatStressLevelName}}
</span></span>
<span
*
ngIf=
"item.temp"
class=
"detailInfo"
style=
"width: 40%"
>
温度:
{{item.temp}} ℃
</span>
<span
*
ngIf=
"item.humi"
class=
"detailInfo"
style=
"width: 40%"
>
湿度:
{{item.humi}} % rH
</span>
<span
*
ngIf=
"item.humi"
class=
"detailInfo"
style=
"width: 40%"
>
氨气:
{{item.NH3}} ppm
</span>
<span
*
ngIf=
"item.heatStressLevel"
class=
"detailInfo"
style=
"width: 40%"
>
热应激:
<span
class=
"warmColor{{item.heatStressLevel}}"
>
{{item.heatStressLevelName}}
</span></span>
</div>
<div
class=
"bottom"
>
<span
[
ngClass
]="{'
online
'
:
item
.
online
,
'
offline
'
:
!
item
.
online
}"
>
{{item.online ? '在线' : '离线'}}
</span>
<span
*
ngIf=
"item.operationModel"
class=
"online"
>
{{item.operationModel ? '远控' :'现控'}}
</span>
<span
*
ngIf=
"item.operationModel"
[
ngClass
]="{'
online
'
:
item
.
isWisdomModel
,
'
offline
'
:
!
item
.
isWisdomModel
}"
class=
"online"
>
智控
</span>
<span
*
ngIf=
"item.ts"
class=
"right"
>
{{item.ts | date: 'yyyy-MM-dd HH:mm'}}
</span>
<div
style=
"width:100%"
>
<!--<span [ngClass]="{'online': item.online, 'offline': !item.online}">{{item.online ? '在线' : '离线'}} </span>-->
<!--<span *ngIf="item.operationModel" class="online">{{item.operationModel ? '远控' :'现控'}} </span>-->
<!--<span *ngIf="item.operationModel" [ngClass]="{'online': item.isWisdomModel, 'offline': !item.isWisdomModel}" class="online">智控 </span>-->
<!--<span *ngIf="item.ts" class="right">{{item.ts | date: 'yyyy-MM-dd HH:mm'}}</span>-->
<div
[
ngClass
]="{'
online
'
:
item
.
online
,
'
offline
'
:
!
item
.
online
}"
>
{{item.online ? '在线' : '离线'}}
</div>
<!-- 1:远控 0:现控 4:混乱 -->
<div
*
ngIf=
"item.operationModel === 1 || item.operationModel === 0"
class=
"online"
>
{{item.operationModel === 1 ? '远控' :'现控'}}
</div>
<div
*
ngIf=
"item.operationModel === 4"
class=
"offline"
>
现控
</div>
<div
*
ngIf=
"item.operationModel"
[
ngClass
]="{'
online
'
:
item
.
isWisdomModel
,
'
offline
'
:
!
item
.
isWisdomModel
}"
class=
"online"
>
智控
</div>
<div
*
ngIf=
"item.ts"
class=
"right"
>
{{item.ts | date: 'yyyy-MM-dd HH:mm'}}
</div>
</div>
</div>
</div>
</ion-item>
...
...
src/app/envCtrl/env-home/env-home.page.scss
View file @
06b64e55
...
...
@@ -17,7 +17,7 @@
}
.top
{
line-height
:
25px
;
//
line-height: 25px;
//border-bottom: 1px solid #cccc;
padding-bottom
:
5px
;
font-size
:
17px
;
...
...
@@ -45,13 +45,21 @@
//border-top: 1px solid #ccc;
padding
:
3px
;
color
:
#aaa
;
margin-top
:
10px
;
margin-top
:
60px
;
width
:
100%
;
}
.content
{
margin-top
:
10px
;
width
:
100%
;
margin-top
:
25px
;
font-size
:
14px
;
color
:
#aaa
;
text-align
:
center
;
// text-align: center;
}
.detailInfo
{
padding-left
:
15px
;
float
:
left
;
margin-top
:
2px
;
}
.online
{
...
...
@@ -82,6 +90,7 @@
float
:
right
;
color
:
#aaa
;
font-size
:
14px
;
padding-top
:
5px
;
}
.topSearch
{
...
...
src/app/envCtrl/env-home/env-home.page.ts
View file @
06b64e55
...
...
@@ -50,6 +50,7 @@ export class EnvHomePage implements OnInit {
alarmTotal
=
0
;
// 牛舍列表
items
=
[];
// 搜索用列表
displayItems
=
[];
getItems
(
e
)
{
...
...
@@ -94,12 +95,16 @@ export class EnvHomePage implements OnInit {
// 牛舍列表
if
(
data
.
resultIndexDataListForAppVos
&&
data
.
resultIndexDataListForAppVos
.
constructor
===
Array
)
{
this
.
isError
=
false
;
this
.
items
=
[];
data
.
resultIndexDataListForAppVos
.
map
((
value
,
index
)
=>
{
const
itemInfo
=
{
factoryNo
:
value
.
factoryNo
,
factoryName
:
value
.
factoryName
,
fieldRegionNo
:
value
.
fieldRegionNo
,
fieldRegionName
:
value
.
fieldRegionName
,
temp
:
value
.
temp
,
humi
:
value
.
humi
,
NH3
:
value
.
NH3
,
heatStressLevel
:
value
.
heatStressLevel
,
heatStressLevelName
:
this
.
getHeatStressLevelName
(
value
.
heatStressLevel
),
online
:
value
.
online
,
...
...
@@ -108,6 +113,7 @@ export class EnvHomePage implements OnInit {
alarm
:
value
.
alarm
,
ts
:
value
.
ts
};
this
.
items
.
push
(
itemInfo
);
});
}
else
{
...
...
@@ -116,107 +122,89 @@ export class EnvHomePage implements OnInit {
}
this
.
displayItems
=
this
.
items
;
// --------------------------------------------------------------------
//
START
--------------------------------------------------------------------
// TODO 测试用准备数据
this
.
thiGood
=
1
;
this
.
thiBad
=
12
;
this
.
alarmTotal
=
5
;
this
.
items
=
[
{
// 0-无热应激 离线 无报警
fieldRegionNo
:
'FRN136641006052720640'
,
fieldRegionName
:
'1号牛舍'
,
temp
:
'23.5'
,
humi
:
'82'
,
heatStressLevel
:
'0'
,
heatStressLevelName
:
this
.
getHeatStressLevelName
(
'0'
),
online
:
0
,
// 0-离线,1-在线
alarm
:
0
,
ts
:
'2019-08-05 23:44'
,
},
{
// 1-轻度热应激 在线 现控 无报警
fieldRegionNo
:
'FN108050436279648256'
,
fieldRegionName
:
'2号牛舍'
,
temp
:
'23.5'
,
humi
:
'82'
,
heatStressLevel
:
'1'
,
heatStressLevelName
:
this
.
getHeatStressLevelName
(
'1'
),
online
:
1
,
// 0-离线,1-在线
operationModel
:
0
,
// 0-现控,1-平控
alarm
:
0
,
ts
:
'2019-08-05 23:44'
,
},
{
// 2-中度热应激 在线 平控 非智控(手控) 有报警
fieldRegionNo
:
'FN108050436279648256'
,
fieldRegionName
:
'3号牛舍'
,
temp
:
'23.5'
,
humi
:
'82'
,
heatStressLevel
:
'2'
,
heatStressLevelName
:
this
.
getHeatStressLevelName
(
'2'
),
online
:
1
,
// 0-离线,1-在线
operationModel
:
1
,
// 0-现控,1-平控
isWisdomModel
:
0
,
// 0-非智控(手控),1-智控
alarm
:
1
,
ts
:
'2019-08-05 23:44'
,
},
{
// 3-重度热应激 在线 平控 非智控(自控) 有报警
fieldRegionNo
:
'FN108050436279648256'
,
fieldRegionName
:
'4号牛舍'
,
temp
:
'23.5'
,
humi
:
'82'
,
heatStressLevel
:
'3'
,
heatStressLevelName
:
this
.
getHeatStressLevelName
(
'3'
),
online
:
1
,
// 0-离线,1-在线
operationModel
:
1
,
// 0-现控,1-平控
isWisdomModel
:
0
,
// 0-非智控(自控),1-智控
alarm
:
1
,
ts
:
'2019-08-05 23:44'
,
},
{
// 4-II重度热应激 在线 平控 智控 有报警
fieldRegionNo
:
'FN108050436279648256'
,
fieldRegionName
:
'测试用5号牛舍'
,
temp
:
'23.5'
,
humi
:
'82'
,
heatStressLevel
:
'4'
,
heatStressLevelName
:
this
.
getHeatStressLevelName
(
'4'
),
online
:
1
,
// 0-离线,1-在线
operationModel
:
1
,
// 0-现控,1-平控
isWisdomModel
:
1
,
// 0-非智控(自控),1-智控
alarm
:
1
,
ts
:
'2019-08-05 23:44'
,
},
];
this
.
displayItems
=
this
.
items
;
// --------------------------------------------------------------------
// this.thiGood = 1;
// this.thiBad = 12;
// this.alarmTotal = 5;
// this.items = [
// {
// // 0-无热应激 离线 无报警
// fieldRegionNo: 'FRN136641006052720640',
// fieldRegionName: '1号牛舍',
// temp: 23.5,
// humi: 82,
// heatStressLevel: '0',
// heatStressLevelName: this.getHeatStressLevelName('0'),
// online: 0, // 0-离线,1-在线
// alarm: 0,
// ts: '2019-08-05 23:44',
// },
// {
// // 1-轻度热应激 在线 现控 无报警
// fieldRegionNo: 'FN108050436279648256',
// fieldRegionName: '2号牛舍',
// temp: 23.5,
// humi: 82,
// heatStressLevel: '1',
// heatStressLevelName: this.getHeatStressLevelName('1'),
// online: 1, // 0-离线,1-在线
// operationModel: 0, // 0-现控,1-平控
// alarm: 0,
// ts: '2019-08-05 23:44',
// },
// {
// // 2-中度热应激 在线 平控 非智控(手控) 有报警
// fieldRegionNo: 'FN108050436279648256',
// fieldRegionName: '3号牛舍',
// temp: 23.5,
// humi: 82,
// heatStressLevel: '2',
// heatStressLevelName: this.getHeatStressLevelName('2'),
// online: 1, // 0-离线,1-在线
// operationModel: 1, // 0-现控,1-平控
// isWisdomModel: 0, // 0-非智控(手控),1-智控
// alarm: 1,
// ts: '2019-08-05 23:44',
// },
// {
// // 3-重度热应激 在线 平控 非智控(自控) 有报警
// fieldRegionNo: 'FN108050436279648256',
// fieldRegionName: '4号牛舍',
// temp: 23.5,
// humi: 82,
// heatStressLevel: '3',
// heatStressLevelName: this.getHeatStressLevelName('3'),
// online: 1, // 0-离线,1-在线
// operationModel: 1, // 0-现控,1-平控
// isWisdomModel: 0, // 0-非智控(自控),1-智控
// alarm: 1,
// ts: '2019-08-05 23:44',
// },
// {
// // 4-II重度热应激 在线 平控 智控 有报警
// fieldRegionNo: 'FN108050436279648256',
// fieldRegionName: '测试用5号牛舍',
// temp: 23.5,
// humi: 82.9,
// NH3: 120.999,
// heatStressLevel: '4',
// heatStressLevelName: this.getHeatStressLevelName('4'),
// online: 1, // 0-离线,1-在线
// operationModel: 4, // 0-现控,1-平控
// isWisdomModel: 1, // 0-非智控(自控),1-智控
// alarm: 1,
// ts: '2019-08-05 23:44',
// },
// ];
// this.displayItems = this.items;
// END--------------------------------------------------------------------
}
this
.
load
.
offLoad
();
}]);
}
}
toControl
(
one
)
{
const
query
=
'/env-detail?no='
+
one
.
fieldRegionNo
;
this
.
tf
.
transfer
({
url
:
'/'
+
one
.
url
,
query
:
query
,
hash
:
''
});
this
.
nav
.
navigateForward
(
query
);
/*const query = '/env-detail?no=' + one.fieldRegionNo;
// this.tf.transfer({
// url: '/' + one.url,
// query: query,
// hash: ''
// });
console.log(one.url + query);
this.nav.navigateForward(one.url + query);*/
}
slideDidChange
()
{
this
.
slide
.
startAutoplay
();
}
...
...
@@ -250,12 +238,22 @@ export class EnvHomePage implements OnInit {
}
doRefresh
(
event
)
{
// this.tempItems = this.items;
setTimeout
(()
=>
{
this
.
getData
(
0
);
event
.
target
.
complete
();
},
2000
);
}
// 混乱的场合 牛舍信息替换为前次数据
// getTmpItemInfo(fieldRegionNo) {
// let tmpItem = null;
// if (this.tempItems !== null && this.tempItems.length > 0) {
// tmpItem = this.tempItems.filter(item => item.fieldRegionNo === fieldRegionNo);
// }
// return tmpItem;
// }
isNetConnected
()
{
if
(
this
.
network
.
type
===
'none'
)
{
this
.
api
.
presentMsgToast
(
'网络连接失败,请确认连接状况'
);
...
...
@@ -263,4 +261,14 @@ export class EnvHomePage implements OnInit {
}
return
true
;
}
toControl
(
one
)
{
const
query
=
'/env-detail?no='
+
one
.
fieldRegionNo
;
this
.
tf
.
transfer
({
url
:
'/'
+
one
.
url
,
query
:
query
,
hash
:
''
});
this
.
nav
.
navigateForward
(
query
);
}
}
src/app/service/api.ts
View file @
06b64e55
...
...
@@ -47,8 +47,10 @@ export class Api {
// 获取水槽信息
getShuiCaoData
:
(
data
)
=>
this
.
trans
(
'post'
,
'/cowshedApp/getShuiCaoData'
,
data
),
// 获取当前牛舍历史数据信息 TODO 追加待
// getShuiCaoData: (data) => this.trans('post', '/cowshedApp/getShuiCaoData', data),
// 获取环境参数曲线
getHistoryByFieldRegionNo
:
(
data
)
=>
this
.
trans
(
'post'
,
'/cowshedApp/getHistoryByFieldRegionNo'
,
data
),
// 获取环境参数表
getHistoryTableByFieldRegionNo
:
(
data
)
=>
this
.
trans
(
'post'
,
'/cowshedApp/getHistoryTableByFieldRegionNo'
,
data
),
};
public
alert
=
{
...
...
@@ -87,6 +89,9 @@ export class Api {
public
control
=
{
controlBatchSwitch
:
(
data
)
=>
this
.
trans
(
'post'
,
'/control/controlBatchSwitch'
,
data
),
controlSwitch
:
(
data
)
=>
this
.
trans
(
'post'
,
'/control/controlSwitch'
,
data
),
controlCowedBatchSwitch
:
(
data
)
=>
this
.
trans
(
'post'
,
'/control/controlCowedBatchSwitch'
,
data
),
controlCowedSwitch
:
(
data
)
=>
this
.
trans
(
'post'
,
'/control/controlCowedSwitch'
,
data
),
};
public
config
=
{
...
...
src/assets/img/level-
best
.png
→
src/assets/img/level-
0
.png
View file @
06b64e55
File moved
src/assets/img/level-
good
.png
→
src/assets/img/level-
1
.png
View file @
06b64e55
File moved
src/assets/img/level-2.png
0 → 100644
View file @
06b64e55
3.79 KB
src/assets/img/level-
bad
.png
→
src/assets/img/level-
3
.png
View file @
06b64e55
File moved
src/assets/img/level-4.png
0 → 100644
View file @
06b64e55
3.79 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment