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
80b92e88
Commit
80b92e88
authored
Sep 10, 2019
by
yating.lin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
牛舍历史数据
parent
a8ade56b
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
301 additions
and
118 deletions
+301
-118
env-detail.page.ts
src/app/envCtrl/env-detail/env-detail.page.ts
+1
-8
env-fan.page.html
src/app/envCtrl/env-fan/env-fan.page.html
+1
-1
env-fan.page.scss
src/app/envCtrl/env-fan/env-fan.page.scss
+1
-1
env-fan.page.ts
src/app/envCtrl/env-fan/env-fan.page.ts
+3
-3
env-history.module.ts
src/app/envCtrl/env-history/env-history.module.ts
+10
-6
env-history.page.html
src/app/envCtrl/env-history/env-history.page.html
+41
-1
env-history.page.scss
src/app/envCtrl/env-history/env-history.page.scss
+46
-0
env-history.page.ts
src/app/envCtrl/env-history/env-history.page.ts
+68
-0
env-light.module.ts
src/app/envCtrl/env-light/env-light.module.ts
+9
-7
env-light.page.html
src/app/envCtrl/env-light/env-light.page.html
+5
-19
env-light.page.scss
src/app/envCtrl/env-light/env-light.page.scss
+6
-0
env-light.page.ts
src/app/envCtrl/env-light/env-light.page.ts
+72
-64
env-shower.module.ts
src/app/envCtrl/env-shower/env-shower.module.ts
+9
-7
env-shower.page.html
src/app/envCtrl/env-shower/env-shower.page.html
+2
-1
env-shower.page.scss
src/app/envCtrl/env-shower/env-shower.page.scss
+6
-0
env-shower.page.ts
src/app/envCtrl/env-shower/env-shower.page.ts
+21
-0
No files found.
src/app/envCtrl/env-detail/env-detail.page.ts
View file @
80b92e88
...
...
@@ -109,14 +109,7 @@ export class EnvDetailPage implements OnInit {
}
toHistory
(
item
)
{
this
.
tf
.
transfer
({
url
:
'/env-history'
});
const
query
=
'?no='
+
item
.
fieldRegionNo
;
this
.
tf
.
transfer
({
url
:
'/env-history'
,
query
:
query
,
hash
:
''
});
const
query
=
'env-history?no='
+
item
.
fieldRegionNo
;
this
.
nav
.
navigateForward
(
query
);
}
}
src/app/envCtrl/env-fan/env-fan.page.html
View file @
80b92e88
...
...
@@ -34,7 +34,7 @@
<ion-card-content>
<!--<ion-toggle slot="middle" [checked]="device.state"></ion-toggle>-->
<v-switch
class=
"btn-switch"
(
click
)="
deviceCheck
(
device
)"
[
value
]="
device
.
op
"
[
disabled
]="
device
.
disabled
"
[
loading
]="
device
.
load
"
></v-switch>
<v-switch
class=
"btn-switch"
(
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 @
80b92e88
...
...
@@ -8,5 +8,5 @@
.btn-switch
{
float
:
none
;
display
:
inline-block
;
margin-top
:
5px
margin-top
:
5px
;
}
src/app/envCtrl/env-fan/env-fan.page.ts
View file @
80b92e88
...
...
@@ -20,7 +20,7 @@ export class EnvFanPage implements OnInit {
// 各设备信息
devices
=
[];
// 一鍵控制按钮
(默认开启:1)
// 一鍵控制按钮
batchSwitch
=
{
op
:
undefined
,
type
:
undefined
,
load
:
undefined
,
disabled
:
undefined
};
controlModelOptions
=
[
...
...
@@ -87,7 +87,6 @@ export class EnvFanPage implements OnInit {
}
// 一键控制
allCheck
(
btn
)
{
debugger
;
btn
.
load
=
true
;
const
req
=
{
fieldRegionNo
:
this
.
fieldRegionNo
,
...
...
@@ -117,9 +116,10 @@ export class EnvFanPage implements OnInit {
// 单个设备控制
deviceCheck
(
btn
)
{
btn
.
loading
=
true
;
const
req
=
{
fieldDeviceNo
:
btn
.
fieldDeviceNo
,
op
:
btn
.
op
?
0
:
1
,
op
:
btn
.
state
?
0
:
1
,
ts
:
parseInt
((
new
Date
().
getTime
()
/
1000
).
toString
(),
10
)
};
this
.
comm
.
remain
=
20
;
...
...
src/app/envCtrl/env-history/env-history.module.ts
View file @
80b92e88
...
...
@@ -6,6 +6,8 @@ import { Routes, RouterModule } from '@angular/router';
import
{
IonicModule
}
from
'@ionic/angular'
;
import
{
EnvHistoryPage
}
from
'./env-history.page'
;
import
{
NgxDatatableModule
}
from
'@swimlane/ngx-datatable'
;
import
{
NgxEchartsCoreModule
}
from
'ngx-echarts/core'
;
const
routes
:
Routes
=
[
{
...
...
@@ -15,12 +17,14 @@ const routes: Routes = [
];
@
NgModule
({
imports
:
[
CommonModule
,
FormsModule
,
IonicModule
,
RouterModule
.
forChild
(
routes
)
],
imports
:
[
CommonModule
,
FormsModule
,
IonicModule
,
RouterModule
.
forChild
(
routes
),
NgxDatatableModule
,
NgxEchartsCoreModule
],
declarations
:
[
EnvHistoryPage
]
})
export
class
EnvHistoryPageModule
{}
src/app/envCtrl/env-history/env-history.page.html
View file @
80b92e88
...
...
@@ -4,7 +4,47 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-content
color=
'light'
style=
"height: 100%"
>
<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>
</div>
</ion-content>
src/app/envCtrl/env-history/env-history.page.scss
View file @
80b92e88
@import
'~@swimlane/ngx-datatable/release/index.css'
;
@import
'~@swimlane/ngx-datatable/release/themes/material.css'
;
@import
'~@swimlane/ngx-datatable/release/assets/icons.css'
;
.perfect
{
width
:
30px
;
height
:
30px
;
background-color
:green
;
border-radius
:
17%
;
-moz-border-radius
:
17%
;
-webkit-border-radius
:
17%
;
font-size
:
25px
;
color
:white
;
}
.good
{
width
:
30px
;
height
:
30px
;
background-color
:yellow
;
border-radius
:
17%
;
-moz-border-radius
:
17%
;
-webkit-border-radius
:
17%
;
font-size
:
25px
;
color
:white
;
}
.bad
{
width
:
30px
;
height
:
30px
;
background-color
:red
;
border-radius
:
17%
;
-moz-border-radius
:
17%
;
-webkit-border-radius
:
17%
;
font-size
:
25px
;
color
:white
;
}
.demo-chart
{
width
:
100%
;
height
:
230px
;
}
.title
{
text-align
:
center
;
padding-left
:
0px
}
src/app/envCtrl/env-history/env-history.page.ts
View file @
80b92e88
...
...
@@ -2,6 +2,7 @@ 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'
;
@
Component
({
selector
:
'v-env-history'
,
...
...
@@ -13,11 +14,78 @@ export class EnvHistoryPage implements OnInit {
constructor
(
private
api
:
Api
,
private
ac
:
ActivatedRoute
,
private
load
:
Load
)
{
}
item
=
{
fieldRegionNo
:
''
};
// TODO 以下为假数据 待删除
analResult
=
'优'
;
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'
},
];
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'
];
}
}
getData
(
time
)
{
...
...
src/app/envCtrl/env-light/env-light.module.ts
View file @
80b92e88
...
...
@@ -6,6 +6,7 @@ import { Routes, RouterModule } from '@angular/router';
import
{
IonicModule
}
from
'@ionic/angular'
;
import
{
EnvLightPage
}
from
'./env-light.page'
;
import
{
WtModule
}
from
'../../components/wt/wt.module'
;
const
routes
:
Routes
=
[
{
...
...
@@ -15,12 +16,13 @@ const routes: Routes = [
];
@
NgModule
({
imports
:
[
CommonModule
,
FormsModule
,
IonicModule
,
RouterModule
.
forChild
(
routes
)
],
declarations
:
[
EnvLightPage
]
imports
:
[
CommonModule
,
FormsModule
,
IonicModule
,
RouterModule
.
forChild
(
routes
),
WtModule
],
declarations
:
[
EnvLightPage
]
})
export
class
EnvLightPageModule
{}
src/app/envCtrl/env-light/env-light.page.html
View file @
80b92e88
...
...
@@ -32,9 +32,10 @@
border-left: 5px solid #28c9bd;
line-height: 25px;
margin-bottom: 5px;"
>
控制/状态
</h1>
<ion-item
*
ngIf=
"
batchSwitch
"
lines=
"full"
insert=
"false"
>
<ion-item
*
ngIf=
"
devices
"
lines=
"full"
insert=
"false"
>
<ion-label>
一键控制
</ion-label>
<ion-toggle
slot=
"end"
[
checked
]="
batchSwitch
.
op
"
></ion-toggle>
<!-- <ion-toggle slot="end" [checked]="batchSwitch.op"></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"
>
...
...
@@ -43,25 +44,10 @@
</ion-card-header>
<ion-card-content>
<ion-toggle
slot=
"middle"
[
checked
]="
device
.
state
"
></ion-toggle>
<!-- <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-card-content>
</ion-card>
</div>
<!--<ion-item *ngIf="batchSwitch" lines="full" insert="false">-->
<!--<ion-label>一键控制</ion-label>-->
<!--<ion-toggle slot="end" [checked]="batchSwitch.op"></ion-toggle>-->
<!--</ion-item>-->
<!--<div>-->
<!--<ion-card *ngFor="let a of workarea.param" class="card" color="white">-->
<!--<ion-card-header>-->
<!--<ion-card-subtitle>{{a.name}}</ion-card-subtitle>-->
<!--</ion-card-header>-->
<!--<ion-card-content>-->
<!--<v-switch [value]="a.runningState" (click)="toggle(a)" style="float: none;display: inline-block;margin-top: 5px"></v-switch>-->
<!--</ion-card-content>-->
<!--</ion-card>-->
<!--</div>-->
</ion-content>
src/app/envCtrl/env-light/env-light.page.scss
View file @
80b92e88
...
...
@@ -12,4 +12,10 @@ i.vo {
margin
:
10px
10px
5px
5px
;
}
.btn-switch
{
float
:
none
;
display
:
inline-block
;
margin-top
:
5px
;
}
src/app/envCtrl/env-light/env-light.page.ts
View file @
80b92e88
...
...
@@ -4,13 +4,11 @@ import {ActivatedRoute} from '@angular/router';
import
{
Load
}
from
'../../service/load'
;
@
Component
({
selector
:
'v-env-light'
,
templateUrl
:
'./env-light.page.html'
,
styleUrls
:
[
'./env-light.page.scss'
],
selector
:
'v-env-light'
,
templateUrl
:
'./env-light.page.html'
,
styleUrls
:
[
'./env-light.page.scss'
],
})
export
class
EnvLightPage
implements
OnInit
{
// @Input() fieldRegionNo: string;
/* 照明 */
// 牧场区域编号
fieldRegionNo
=
''
;
...
...
@@ -32,57 +30,27 @@ export class EnvLightPage implements OnInit {
// 各设备信息
devices
=
[];
// 一鍵控制信息
batchSwitch
=
{
op
:
0
,
type
:
'照明'
};
batchSwitch
=
{
op
:
undefined
,
type
:
undefined
,
load
:
undefined
,
disabled
:
undefined
};
controlModelOptions
=
[
{
modelId
:
0
,
modelValue
:
'手控模式'
},
{
modelId
:
1
,
modelValue
:
'自控模式'
},
{
modelId
:
2
,
modelValue
:
'智慧控制'
}];
// workModeSetting = { 'workMode' : '1',
// 'DeviceNo' : '',
// 'workModeOld' : '1'};
// 发送指令延时判断
comm
=
{
remain
:
20
,
isLoading
:
true
remain
:
20
,
isLoading
:
true
};
// allBtns = [{v: 1}];
// fieldRegionNo = '';
// fieldRegionName = '';
lightMode
=
{
name
:
'July'
,
openTime
:
'19:00'
,
closeTime
:
'05:00'
};
// workarea = {
// param: [
// {
// name: '1号组',
// runningState: true,
// },
// {
// name: '2号组',
// runningState:false,
// }
// ]
// };
constructor
(
private
api
:
Api
,
private
ac
:
ActivatedRoute
,
private
load
:
Load
,
private
route
:
ActivatedRoute
)
{
}
ngOnInit
()
{
// this.ac.queryParams.subscribe((data) => {
// this.fieldRegionNo = data.no;
// });
this
.
route
.
paramMap
.
subscribe
(
params
=>
{
this
.
fieldRegionNo
=
params
.
get
(
'fieldRegionNo'
);
});
this
.
getData
(
0
);
}
constructor
(
private
api
:
Api
,
private
ac
:
ActivatedRoute
,
private
load
:
Load
,
private
route
:
ActivatedRoute
)
{
}
toggle
(
a
)
{
console
.
log
(
'123'
);
ngOnInit
()
{
this
.
route
.
paramMap
.
subscribe
(
params
=>
{
this
.
fieldRegionNo
=
params
.
get
(
'fieldRegionNo'
);
});
this
.
getData
(
0
);
}
getData
(
time
)
{
...
...
@@ -90,7 +58,7 @@ export class EnvLightPage implements OnInit {
if
(
time
)
{
this
.
load
.
toLoad
(
'加载中...'
,
false
);
}
this
.
api
.
cowshedApp
.
getZhaoMingData
([{
'fieldRegionNo'
:
this
.
fieldRegionNo
},
(
data
)
=>
{
this
.
api
.
cowshedApp
.
getZhaoMingData
([{
'fieldRegionNo'
:
this
.
fieldRegionNo
},
(
data
)
=>
{
if
(
data
)
{
this
.
fieldRegionNo
=
data
.
fieldRegionNo
;
this
.
fieldDeviceType
=
data
.
fieldDeviceType
;
...
...
@@ -109,41 +77,81 @@ export class EnvLightPage implements OnInit {
// this.controlModel = 2;
this
.
on
=
'19:00'
;
this
.
off
=
'05:00'
;
// 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
.
allCheck
(
this
.
batchSwitch
);
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
}];
// [智控(2)]的状态下:非活性(true) 以外:活性(false)
const
allDisabled
=
this
.
controlModel
===
2
?
true
:
false
;
this
.
batchSwitch
.
disabled
=
allDisabled
;
this
.
devices
.
forEach
((
device
,
i
)
=>
{
device
.
disabled
=
allDisabled
;
});
// 设置[一键控制]按钮(默认: 开启)
// 当任意子按钮[关闭]的状态下: 关闭 以外:开启
this
.
batchSwitch
.
op
=
1
;
this
.
devices
.
map
((
device
)
=>
{
if
(
device
.
state
===
0
)
{
this
.
batchSwitch
.
op
=
0
;
}
});
}
}]);
}
allCheck
(
batchSwitch
)
{
batchSwitch
.
type
=
this
.
fieldDeviceType
;
// 一键控制
allCheck
(
btn
)
{
btn
.
load
=
true
;
const
req
=
{
fieldRegionNo
:
this
.
fieldRegionNo
,
op
:
b
atchSwitch
.
op
,
// op: batchSwitch
.op ? 0 : 1,
fieldDeviceType
:
batchSwitch
.
t
ype
,
op
:
b
tn
.
op
?
0
:
1
,
type
:
this
.
fieldDeviceT
ype
,
ts
:
parseInt
((
new
Date
().
getTime
()
/
1000
).
toString
(),
10
)
};
this
.
comm
.
remain
=
120
;
// 一键开启设备
this
.
api
.
control
.
controlBatchSwitch
([
req
,
(
data
)
=>
{
if
(
data
.
code
===
1
)
{
this
.
batchSwitch
.
op
=
data
.
op
;
this
.
getData
(
1
)
;
this
.
api
.
presentMsgToast
(
data
.
message
);
}
else
{
this
.
api
.
presentMsgToast
(
data
.
message
);
}
this
.
comm
.
remain
=
0
;
// batchSwitch.state = false;
btn
.
load
=
false
;
}]);
// 子按钮状态
this
.
devices
.
forEach
((
device
,
i
)
=>
{
device
.
state
=
btn
.
op
?
0
:
1
;
});
}
// 单个设备控制
deviceCheck
(
btn
)
{
btn
.
loading
=
true
;
const
req
=
{
fieldDeviceNo
:
btn
.
fieldDeviceNo
,
op
:
btn
.
state
?
0
:
1
,
ts
:
parseInt
((
new
Date
().
getTime
()
/
1000
).
toString
(),
10
)
};
this
.
comm
.
remain
=
20
;
this
.
api
.
control
.
controlSwitch
([
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
;
}]);
// TODO 测试用准备数据
// this.batchSwitch.op = 0;
}
}
src/app/envCtrl/env-shower/env-shower.module.ts
View file @
80b92e88
...
...
@@ -6,6 +6,7 @@ import { Routes, RouterModule } from '@angular/router';
import
{
IonicModule
}
from
'@ionic/angular'
;
import
{
EnvShowerPage
}
from
'./env-shower.page'
;
import
{
WtModule
}
from
'../../components/wt/wt.module'
;
const
routes
:
Routes
=
[
{
...
...
@@ -15,12 +16,13 @@ const routes: Routes = [
];
@
NgModule
({
imports
:
[
CommonModule
,
FormsModule
,
IonicModule
,
RouterModule
.
forChild
(
routes
)
],
declarations
:
[
EnvShowerPage
]
imports
:
[
CommonModule
,
FormsModule
,
IonicModule
,
RouterModule
.
forChild
(
routes
),
WtModule
],
declarations
:
[
EnvShowerPage
]
})
export
class
EnvShowerPageModule
{}
src/app/envCtrl/env-shower/env-shower.page.html
View file @
80b92e88
...
...
@@ -57,7 +57,8 @@
<ion-card-content
style=
"margin: 0px; padding-top:0px;"
>
<span
class=
"content"
>
压力 {{a.press}} MPa
</span><br>
<ion-toggle
[
checked
]="
a
.
state
"
></ion-toggle>
<!-- <ion-toggle [checked]="a.state"></ion-toggle>-->
<v-switch
class=
"btn-switch"
(
click
)="
deviceCheck
(
a
)"
[
value
]="
a
.
state
"
[
loading
]="
a
.
load
"
></v-switch>
</ion-card-content>
</ion-card>
</div>
...
...
src/app/envCtrl/env-shower/env-shower.page.scss
View file @
80b92e88
...
...
@@ -13,3 +13,9 @@
.content
{
font-size
:
13px
;
}
.btn-switch
{
float
:
none
;
display
:
inline-block
;
margin-top
:
5px
;
}
src/app/envCtrl/env-shower/env-shower.page.ts
View file @
80b92e88
...
...
@@ -67,4 +67,25 @@ export class EnvShowerPage implements OnInit {
}]);
}
// 单个设备控制
deviceCheck
(
btn
)
{
const
req
=
{
fieldDeviceNo
:
btn
.
fieldDeviceNo
,
op
:
btn
.
state
?
0
:
1
,
ts
:
parseInt
((
new
Date
().
getTime
()
/
1000
).
toString
(),
10
)
};
this
.
comm
.
remain
=
20
;
this
.
api
.
control
.
controlSwitch
([
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
;
}]);
}
}
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