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
eba7dfa5
Commit
eba7dfa5
authored
Nov 12, 2019
by
yating.lin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微调
parent
9ca886ba
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
30 deletions
+67
-30
env-fan.page.html
src/app/envCtrl/env-fan/env-fan.page.html
+3
-3
env-fan.page.ts
src/app/envCtrl/env-fan/env-fan.page.ts
+60
-27
env-shower.page.ts
src/app/envCtrl/env-shower/env-shower.page.ts
+4
-0
No files found.
src/app/envCtrl/env-fan/env-fan.page.html
View file @
eba7dfa5
...
...
@@ -24,7 +24,7 @@
<ion-item
*
ngIf=
"batchSwitch"
lines=
"full"
insert=
"false"
>
<ion-label>
一键控制
</ion-label>
<ion-toggle
slot=
"end"
[
checked
]="
batchSwitch
.
op =
==
1
"
[
disabled
]="
batchSwitch
.
disabled
"
[(
ngModel
)]="
batchSwitch
.
op
"
(
load
)="
batchSwitch
.
load
"
(
click
)="
allCheck
(
batchSwitch
)"
></ion-toggle>
(
load
)="
batchSwitch
.
load
"
(
ionChange
)="
toggle
(
batchSwitch
)"
></ion-toggle>
<!--<v-switch (click)="allCheck(batchSwitch)" [value]="batchSwitch.op" [disabled]="batchSwitch.disabled" [loading]="batchSwitch.load"></v-switch>-->
</ion-item>
<div>
...
...
@@ -36,9 +36,9 @@
<ion-card-content
class=
"cardContent"
>
<!--<ion-toggle slot="middle" [checked]="device.state"></ion-toggle>-->
<ion-toggle
class=
"btn-switch"
*
ngIf=
"device.alarm === 0"
[
checked
]="
batchSwitch
.
op =
==
1
"
[
disabled
]="
device
.
disabled
"
[(
ngModel
)]="
device
.
state
"
(
click
)="
deviceCheck
(
device
)"
></ion-toggle>
(
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>
(
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>
...
...
src/app/envCtrl/env-fan/env-fan.page.ts
View file @
eba7dfa5
...
...
@@ -21,7 +21,7 @@ export class EnvFanPage implements OnInit {
// 各设备信息
devices
=
[];
// 一鍵控制按钮
batchSwitch
=
{
op
:
undefined
,
type
:
undefined
,
load
:
undefined
,
disabled
:
undefined
};
batchSwitch
=
{
op
:
undefined
,
type
:
undefined
,
load
:
false
,
disabled
:
undefined
};
controlModelOptions
=
[
{
modelId
:
0
,
modelValue
:
'手控模式'
},
...
...
@@ -50,14 +50,14 @@ export class EnvFanPage implements OnInit {
this
.
load
.
toLoad
(
'加载中...'
,
false
);
}
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
();
}
//
if (data && data.fieldRegionNo) {
//
this.fieldRegionNo = data.fieldRegionNo;
//
this.fieldDeviceType = data.fieldDeviceType;
//
this.controlModel = data.controlModel;
//
this.devices = data.param;
//
//
this.initButtons();
//
}
// START--------------------------------------------------------------------
// TODO 测试用准备数据
...
...
@@ -75,7 +75,8 @@ export class EnvFanPage implements OnInit {
}
initButtons
()
{
// [手控(0)]的状态下:活性(false) 以外:非活性(true)
// 各个按钮表示状态
// [手控(0)]的状态:活性(false) 以外:非活性(true)
const
allDisabled
=
this
.
controlModel
===
0
?
false
:
true
;
this
.
batchSwitch
.
disabled
=
allDisabled
;
this
.
devices
.
forEach
((
device
,
i
)
=>
{
...
...
@@ -92,6 +93,39 @@ export class EnvFanPage implements OnInit {
});
}
toggle
(
btn
)
{
// a.loading = true;
this
.
opChangeComfirm
(
btn
);
}
async
opChangeComfirm
(
btn
)
{
const
msgHeader
=
this
.
fieldDeviceType
;
const
msgOp
=
btn
.
op
?
'关闭'
:
'打开'
;
const
alert
=
await
this
.
alertControlle
.
create
({
header
:
'请注意'
,
// subHeader: '确定要' + msgOp + ' ' + msgHeader + ' 这个泵吗?',
message
:
'所有'
+
msgHeader
+
'即将'
+
msgOp
+
',要继续吗?'
,
mode
:
'ios'
,
buttons
:
[
{
text
:
'取消'
,
cssClass
:
'width: 40%'
,
handler
:
()
=>
{
this
.
batchSwitch
.
op
=
btn
.
op
===
0
?
1
:
0
;
}
},
{
text
:
'确定'
,
cssClass
:
'width: 40%'
,
handler
:
()
=>
{
this
.
allCheck
(
btn
);
}
}
]
});
await
alert
.
present
();
}
// 一键控制
allCheck
(
btn
)
{
btn
.
load
=
true
;
...
...
@@ -105,20 +139,17 @@ export class EnvFanPage implements OnInit {
// 一键开启设备
this
.
api
.
control
.
controlCowedBatchSwitch
([
req
,
(
data
)
=>
{
if
(
data
.
code
===
1
)
{
this
.
getData
(
1
);
this
.
api
.
presentMsgToast
(
data
.
message
);
}
else
{
// if (data.code === 1) {
// // 子按钮状态
// this.devices.forEach((device, i) => {
// device.state = btn.op ? 0 : 1;
// });
// }
this
.
api
.
presentMsgToast
(
data
.
message
);
}
this
.
getData
(
0
);
this
.
comm
.
remain
=
0
;
btn
.
load
=
false
;
}]);
// 子按钮状态
this
.
devices
.
forEach
((
device
,
i
)
=>
{
device
.
state
=
btn
.
op
?
0
:
1
;
});
}
// 单个设备控制
...
...
@@ -132,12 +163,14 @@ export class EnvFanPage implements OnInit {
};
this
.
comm
.
remain
=
20
;
this
.
api
.
control
.
controlCowedSwitch
([
req
,
(
data
)
=>
{
if
(
data
&&
data
.
code
===
1
)
{
this
.
getData
(
1
);
this
.
api
.
presentMsgToast
(
data
.
message
);
}
else
{
// if (data && data.code === 1) {
// this.getData(0);
// this.api.presentMsgToast(data.message);
// } else {
// this.api.presentMsgToast(data.message);
// }
this
.
getData
(
0
);
this
.
api
.
presentMsgToast
(
data
.
message
);
}
this
.
comm
.
remain
=
0
;
// btn.load = false;
}]);
...
...
src/app/envCtrl/env-shower/env-shower.page.ts
View file @
eba7dfa5
...
...
@@ -47,6 +47,10 @@ export class EnvShowerPage implements OnInit {
constructor
(
private
api
:
Api
,
private
ac
:
ActivatedRoute
,
private
load
:
Load
,
private
route
:
ActivatedRoute
)
{
}
ngOnInit
()
{
this
.
init
();
}
init
()
{
this
.
route
.
paramMap
.
subscribe
(
params
=>
{
this
.
fieldRegionNo
=
params
.
get
(
'fieldRegionNo'
);
});
this
.
getData
(
0
);
}
...
...
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