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
8f091c44
Commit
8f091c44
authored
Dec 05, 2019
by
yating.lin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
风机页面追加刷新
parent
5f8c9752
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
218 additions
and
93 deletions
+218
-93
config.xml
config.xml
+1
-1
env-alarm-detail.page.ts
src/app/envCtrl/env-alarm-detail/env-alarm-detail.page.ts
+1
-1
env-alarm.page.ts
src/app/envCtrl/env-alarm/env-alarm.page.ts
+21
-21
env-cfg.page.ts
src/app/envCtrl/env-cfg/env-cfg.page.ts
+1
-1
env-detail.page.html
src/app/envCtrl/env-detail/env-detail.page.html
+3
-3
env-detail.page.ts
src/app/envCtrl/env-detail/env-detail.page.ts
+18
-6
env-fan.page.ts
src/app/envCtrl/env-fan/env-fan.page.ts
+52
-16
env-home.page.html
src/app/envCtrl/env-home/env-home.page.html
+3
-3
env-home.page.ts
src/app/envCtrl/env-home/env-home.page.ts
+1
-1
env-light.page.ts
src/app/envCtrl/env-light/env-light.page.ts
+38
-7
env-shower.page.ts
src/app/envCtrl/env-shower/env-shower.page.ts
+42
-11
env-waterchannel.page.ts
src/app/envCtrl/env-waterchannel/env-waterchannel.page.ts
+5
-1
constants.ts
src/app/service/constants.ts
+3
-0
loading.ts
src/app/service/loading.ts
+29
-21
No files found.
config.xml
View file @
8f091c44
<?xml version='1.0' encoding='utf-8'?>
<?xml version='1.0' encoding='utf-8'?>
<widget
id=
"com.witium.muchang.test"
version=
"2.9.6.
3
"
xmlns=
"http://www.w3.org/ns/widgets"
xmlns:cdv=
"http://cordova.apache.org/ns/1.0"
>
<widget
id=
"com.witium.muchang.test"
version=
"2.9.6.
4
"
xmlns=
"http://www.w3.org/ns/widgets"
xmlns:cdv=
"http://cordova.apache.org/ns/1.0"
>
<name>
牧场云
</name>
<name>
牧场云
</name>
<description>
test
</description>
<description>
test
</description>
<author
email=
"frank.feng@witium.com"
href=
"http://muchang.witium.com/"
>
Van.chen - frank.feng
</author>
<author
email=
"frank.feng@witium.com"
href=
"http://muchang.witium.com/"
>
Van.chen - frank.feng
</author>
...
...
src/app/envCtrl/env-alarm-detail/env-alarm-detail.page.ts
View file @
8f091c44
...
@@ -318,7 +318,7 @@ export class EnvAlarmDetailPage implements OnInit {
...
@@ -318,7 +318,7 @@ export class EnvAlarmDetailPage implements OnInit {
disposeState
:
1
,
disposeState
:
1
,
isReal
:
real
===
1
?
1
:
0
isReal
:
real
===
1
?
1
:
0
};
};
this
.
loading
.
presentLoading
(
Constants
.
LOADING_SHORT
);
this
.
loading
.
presentLoading
(
Constants
.
LOADING_SHORT
,
true
);
this
.
api
.
troubleLog
.
processingFailure
([
req
,
(
data
)
=>
{
this
.
api
.
troubleLog
.
processingFailure
([
req
,
(
data
)
=>
{
if
(
data
&&
data
.
code
===
1
)
{
if
(
data
&&
data
.
code
===
1
)
{
this
.
api
.
presentMsgToast
(
data
.
message
);
this
.
api
.
presentMsgToast
(
data
.
message
);
...
...
src/app/envCtrl/env-alarm/env-alarm.page.ts
View file @
8f091c44
...
@@ -106,27 +106,27 @@ export class EnvAlarmPage implements OnInit {
...
@@ -106,27 +106,27 @@ export class EnvAlarmPage implements OnInit {
return
time
;
return
time
;
}
}
displayInterval
(
interval
)
{
//
displayInterval(interval) {
let
displayValue
=
''
;
//
let displayValue = '';
switch
(
interval
)
{
//
switch (interval) {
case
12
:
//
case 12:
displayValue
=
'近一年'
;
//
displayValue = '近一年';
break
;
//
break;
case
6
:
//
case 6:
displayValue
=
'近六个月'
;
//
displayValue = '近六个月';
break
;
//
break;
case
3
:
//
case 3:
displayValue
=
'近三个月'
;
//
displayValue = '近三个月';
break
;
//
break;
case
1
:
//
case 1:
displayValue
=
'近一个月'
;
//
displayValue = '近一个月';
break
;
//
break;
default
:
//
default:
displayValue
=
'近一年'
;
//
displayValue = '近一年';
break
;
//
break;
}
//
}
document
.
getElementById
(
this
.
curFieldRegion
.
fieldRegionNo
).
innerText
=
displayValue
;
//
document.getElementById(this.curFieldRegion.fieldRegionNo).innerText = displayValue;
}
//
}
doRefresh
(
event
)
{
doRefresh
(
event
)
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
...
src/app/envCtrl/env-cfg/env-cfg.page.ts
View file @
8f091c44
...
@@ -409,7 +409,7 @@ export class EnvCfgPage implements OnInit {
...
@@ -409,7 +409,7 @@ export class EnvCfgPage implements OnInit {
// this.load.toLoad('加载中...', false);
// this.load.toLoad('加载中...', false);
// this.comm.remain = 150;
// this.comm.remain = 150;
this
.
loading
.
presentLoading
(
Constants
.
LOADING_LONG
);
this
.
loading
.
presentLoading
(
Constants
.
LOADING_LONG
,
true
);
this
.
curCowshed
.
isWisdomModel
=
this
.
curCowshed
.
isWisdomModelChecked
?
1
:
0
;
this
.
curCowshed
.
isWisdomModel
=
this
.
curCowshed
.
isWisdomModelChecked
?
1
:
0
;
// 回舍时默认设备都为打开状态
// 回舍时默认设备都为打开状态
this
.
curCowshed
.
back
.
forEach
(
one
=>
(
one
.
flag
=
true
));
this
.
curCowshed
.
back
.
forEach
(
one
=>
(
one
.
flag
=
true
));
...
...
src/app/envCtrl/env-detail/env-detail.page.html
View file @
8f091c44
...
@@ -10,9 +10,9 @@
...
@@ -10,9 +10,9 @@
</ion-toolbar>
</ion-toolbar>
<div
class=
"top"
>
<div
class=
"top"
>
<span
[
ngClass
]="{'
online
'
:
item
.
online
,
'
offline
'
:
!
item
.
online
}"
>
{{item.online ? '在线' : '离线'}}
</span>
<span
[
ngClass
]="{'
online
'
:
item
.
online
,
'
offline
'
:
!
item
.
online
}"
>
{{item.online ? '在线' : '离线'}}
</span>
<span
*
ngIf=
"item.operationModel === 1 || item.operationModel === 0"
class=
"online"
>
{{item.operationModel ? '远控' :'现控'}}
</span>
<span
*
ngIf=
"item.o
nline && item.o
perationModel === 1 || item.operationModel === 0"
class=
"online"
>
{{item.operationModel ? '远控' :'现控'}}
</span>
<span
*
ngIf=
"item.operationModel === 4"
class=
"offline"
>
现控
</span>
<span
*
ngIf=
"item.o
nline && item.o
perationModel === 4"
class=
"offline"
>
现控
</span>
<span
*
ngIf=
"item.operationModel === 1"
[
ngClass
]="{'
online
'
:
item
.
isWisdomModel
,
'
offline
'
:
!
item
.
isWisdomModel
}"
class=
"online"
>
智控
</span>
<span
*
ngIf=
"item.o
nline && item.o
perationModel === 1"
[
ngClass
]="{'
online
'
:
item
.
isWisdomModel
,
'
offline
'
:
!
item
.
isWisdomModel
}"
class=
"online"
>
智控
</span>
<span
*
ngIf=
"item.ts"
class=
"right font-ts"
>
{{item.ts | date: 'yyyy-MM-dd HH:mm'}}
</span>
<span
*
ngIf=
"item.ts"
class=
"right font-ts"
>
{{item.ts | date: 'yyyy-MM-dd HH:mm'}}
</span>
</div>
</div>
<div
style=
"background-color: #F0F0F0;"
align=
"center"
>
<div
style=
"background-color: #F0F0F0;"
align=
"center"
>
...
...
src/app/envCtrl/env-detail/env-detail.page.ts
View file @
8f091c44
...
@@ -6,6 +6,7 @@ import {Load} from '../../service/load';
...
@@ -6,6 +6,7 @@ import {Load} from '../../service/load';
import
{
Transfer
}
from
'../../service/transfer'
;
import
{
Transfer
}
from
'../../service/transfer'
;
import
{
Loading
}
from
'../../service/loading'
;
import
{
Loading
}
from
'../../service/loading'
;
import
{
Constants
}
from
'../../service/constants'
;
import
{
Constants
}
from
'../../service/constants'
;
import
{
EventService
}
from
'../../service/event'
;
@
Component
({
@
Component
({
selector
:
'v-env-detail'
,
selector
:
'v-env-detail'
,
...
@@ -19,7 +20,8 @@ export class EnvDetailPage implements OnInit {
...
@@ -19,7 +20,8 @@ export class EnvDetailPage implements OnInit {
private
ac
:
ActivatedRoute
,
private
ac
:
ActivatedRoute
,
private
load
:
Load
,
private
load
:
Load
,
private
tf
:
Transfer
,
private
tf
:
Transfer
,
public
loading
:
Loading
)
{
public
loading
:
Loading
,
public
eventService
:
EventService
)
{
this
.
ac
.
queryParams
.
subscribe
((
data
)
=>
{
this
.
ac
.
queryParams
.
subscribe
((
data
)
=>
{
if
(
data
.
no
)
{
if
(
data
.
no
)
{
this
.
fieldRegionNo
=
data
.
no
;
this
.
fieldRegionNo
=
data
.
no
;
...
@@ -84,8 +86,8 @@ export class EnvDetailPage implements OnInit {
...
@@ -84,8 +86,8 @@ export class EnvDetailPage implements OnInit {
this
.
comm
.
isLoading
=
false
;
this
.
comm
.
isLoading
=
false
;
this
.
comm
.
remain
=
0
;
this
.
comm
.
remain
=
0
;
this
.
ac
.
queryParams
.
subscribe
((
data
)
=>
{
this
.
ac
.
queryParams
.
subscribe
((
data
)
=>
{
if
(
data
.
n
o
)
{
if
(
data
.
fieldRegionN
o
)
{
this
.
fieldRegionNo
=
data
.
n
o
;
this
.
fieldRegionNo
=
data
.
fieldRegionN
o
;
this
.
operationModel
=
data
.
operationModel
;
this
.
operationModel
=
data
.
operationModel
;
this
.
getData
(
0
);
this
.
getData
(
0
);
}
}
...
@@ -216,7 +218,7 @@ export class EnvDetailPage implements OnInit {
...
@@ -216,7 +218,7 @@ export class EnvDetailPage implements OnInit {
opt
.
ts
=
new
Date
().
valueOf
();
opt
.
ts
=
new
Date
().
valueOf
();
// this.comm.remain = 20;
// this.comm.remain = 20;
this
.
loading
.
presentLoading
(
Constants
.
LOADING_LONG
);
this
.
loading
.
presentLoading
(
Constants
.
LOADING_LONG
ER
,
true
);
this
.
api
.
control
.
controlCowedSwitch
([
opt
,
(
data
)
=>
{
this
.
api
.
control
.
controlCowedSwitch
([
opt
,
(
data
)
=>
{
// if (data && data.code === 1) {
// if (data && data.code === 1) {
// this.getData(1);
// this.getData(1);
...
@@ -226,9 +228,19 @@ export class EnvDetailPage implements OnInit {
...
@@ -226,9 +228,19 @@ export class EnvDetailPage implements OnInit {
// this.api.presentMsgToast(data.message);
// this.api.presentMsgToast(data.message);
// }
// }
this
.
getData
(
0
);
this
.
getData
(
0
);
this
.
api
.
presentMsgToast
(
data
.
message
);
this
.
comm
.
remain
=
0
;
this
.
comm
.
remain
=
0
;
this
.
loading
.
closeLoading
();
if
(
data
&&
data
.
code
===
1
)
{
this
.
api
.
presentMsgToast
(
data
.
message
);
// '传输成功, 设备操作中'
this
.
eventService
.
event
.
emit
(
'inOutHouseController'
);
// setTimeout(() => {
// this.loading.closeLoading();
// this.eventService.event.emit('inOutHouseController');
// }, 65000);
}
else
{
this
.
api
.
presentMsgToast
(
data
.
message
);
}
}]);
}]);
}
}
}
}
...
...
src/app/envCtrl/env-fan/env-fan.page.ts
View file @
8f091c44
...
@@ -6,6 +6,7 @@ import { AlertController } from '@ionic/angular';
...
@@ -6,6 +6,7 @@ import { AlertController } from '@ionic/angular';
import
{
Constants
}
from
'../../service/constants'
;
import
{
Constants
}
from
'../../service/constants'
;
import
{
CUSTOM_ELEMENTS_SCHEMA
}
from
'@angular/core'
;
import
{
CUSTOM_ELEMENTS_SCHEMA
}
from
'@angular/core'
;
import
{
Loading
}
from
'../../service/loading'
;
import
{
Loading
}
from
'../../service/loading'
;
import
{
EventService
}
from
'../../service/event'
;
@
Component
({
@
Component
({
...
@@ -24,6 +25,8 @@ export class EnvFanPage implements OnInit {
...
@@ -24,6 +25,8 @@ export class EnvFanPage implements OnInit {
// 模式状态
// 模式状态
controlModel
=
0
;
controlModel
=
0
;
// 是否在配置页中勾选风机
enabled
=
0
;
// 各设备信息
// 各设备信息
devices
=
[];
devices
=
[];
// 一鍵控制按钮
// 一鍵控制按钮
...
@@ -44,16 +47,20 @@ export class EnvFanPage implements OnInit {
...
@@ -44,16 +47,20 @@ export class EnvFanPage implements OnInit {
commTmr
:
any
;
commTmr
:
any
;
constructor
(
private
api
:
Api
,
private
ac
:
ActivatedRoute
,
private
load
:
Load
,
private
alertController
:
AlertController
,
constructor
(
private
api
:
Api
,
private
ac
:
ActivatedRoute
,
private
load
:
Load
,
private
alertController
:
AlertController
,
public
loading
:
Loading
)
{
public
loading
:
Loading
,
public
eventService
:
EventService
)
{
this
.
ac
.
queryParams
.
subscribe
((
data
)
=>
{
this
.
ac
.
queryParams
.
subscribe
((
data
)
=>
{
if
(
data
&&
data
.
no
!==
null
)
{
if
(
data
&&
data
.
fieldRegionNo
!==
undefined
&&
data
.
fieldRegionNo
!==
null
&&
data
.
fieldRegionNo
!==
''
)
{
this
.
fieldRegionNo
=
data
.
n
o
;
this
.
fieldRegionNo
=
data
.
fieldRegionN
o
;
this
.
operationModel
=
data
.
operationModel
;
this
.
operationModel
=
data
.
operationModel
;
}
}
});
});
}
}
ionViewWillEnter
()
{
this
.
init
();
}
ngOnInit
()
{
ngOnInit
()
{
// this.ionViewWillEnter();
// this.ionViewWillEnter();
this
.
comm
.
remain
=
0
;
this
.
comm
.
remain
=
0
;
...
@@ -71,10 +78,11 @@ export class EnvFanPage implements OnInit {
...
@@ -71,10 +78,11 @@ export class EnvFanPage implements OnInit {
}
}
},
1000
)
;
},
1000
)
;
this
.
init
();
this
.
init
();
}
// 订阅详情页【在离舍】开关
this
.
eventService
.
event
.
on
(
'inOutHouseController'
,
()
=>
{
ionViewWillEnter
()
{
console
.
log
(
'inOutHouseController'
);
this
.
init
();
this
.
getData
(
0
);
});
}
}
ionViewWillLeave
()
{
ionViewWillLeave
()
{
...
@@ -82,19 +90,25 @@ export class EnvFanPage implements OnInit {
...
@@ -82,19 +90,25 @@ export class EnvFanPage implements OnInit {
}
}
init
()
{
init
()
{
this
.
ac
.
queryParams
.
subscribe
((
data
)
=>
{
if
(
this
.
fieldRegionNo
!==
undefined
&&
this
.
fieldRegionNo
!==
null
&&
this
.
fieldRegionNo
!==
''
)
{
if
(
data
&&
data
.
no
!==
null
)
{
this
.
getData
(
0
);
this
.
fieldRegionNo
=
data
.
no
;
}
else
{
this
.
operationModel
=
data
.
operationModel
;
this
.
ac
.
queryParams
.
subscribe
((
data
)
=>
{
this
.
getData
(
0
);
if
(
data
&&
data
.
fieldRegionNo
!==
undefined
&&
data
.
fieldRegionNo
!==
null
&&
data
.
fieldRegionNo
!==
''
)
{
}
this
.
fieldRegionNo
=
data
.
fieldRegionNo
;
this
.
operationModel
=
data
.
operationModel
;
this
.
getData
(
0
);
}
});
});
}
}
}
getData
(
time
)
{
getData
(
time
)
{
console
.
log
();
if
(
time
)
{
if
(
time
)
{
this
.
load
.
toLoad
(
'加载中...'
,
false
);
this
.
load
.
toLoad
(
'加载中...'
,
false
);
}
}
this
.
loading
.
presentLoading
(
Constants
.
LOADING_SHORTER
,
false
);
this
.
api
.
cowshedApp
.
getFengJiData
([{
fieldRegionNo
:
this
.
fieldRegionNo
},
(
data
)
=>
{
this
.
api
.
cowshedApp
.
getFengJiData
([{
fieldRegionNo
:
this
.
fieldRegionNo
},
(
data
)
=>
{
if
(
data
&&
data
.
fieldRegionNo
)
{
if
(
data
&&
data
.
fieldRegionNo
)
{
this
.
fieldRegionNo
=
data
.
fieldRegionNo
;
this
.
fieldRegionNo
=
data
.
fieldRegionNo
;
...
@@ -104,9 +118,11 @@ export class EnvFanPage implements OnInit {
...
@@ -104,9 +118,11 @@ export class EnvFanPage implements OnInit {
this
.
devices
.
forEach
(
device
=>
{
this
.
devices
.
forEach
(
device
=>
{
device
.
op
=
device
.
state
===
1
;
device
.
op
=
device
.
state
===
1
;
});
});
this
.
enabled
=
data
.
enabled
;
this
.
initButtons
();
this
.
initButtons
();
this
.
setConfusionModelControll
();
this
.
setConfusionModelControll
();
this
.
resetButtons
();
}
}
this
.
load
.
offLoad
();
this
.
load
.
offLoad
();
}]);
}]);
...
@@ -131,6 +147,25 @@ export class EnvFanPage implements OnInit {
...
@@ -131,6 +147,25 @@ export class EnvFanPage implements OnInit {
});
});
}
}
resetButtons
()
{
console
.
log
(
'reset buttons'
);
this
.
api
.
cowshedApp
.
getRealDataByFieldRegionNo
([{
fieldRegionNo
:
this
.
fieldRegionNo
},
(
data
)
=>
{
if
(
data
&&
data
.
inHouse
)
{
const
inHouse
=
data
.
inHouse
.
inHouse
;
const
isInHouse
=
inHouse
===
0
;
// 离舍-0 在舍-1
// 离舍的场合,配置页被勾选: 所有按钮非活性
if
(
isInHouse
&&
this
.
enabled
)
{
console
.
log
(
'离舍时,开关非活性'
);
this
.
batchSwitch
.
disabled
=
isInHouse
;
this
.
devices
.
forEach
((
device
)
=>
{
device
.
disabled
=
isInHouse
;
});
}
}
this
.
loading
.
closeLoading
();
}]);
}
toggle
(
btn
)
{
toggle
(
btn
)
{
this
.
opChangeComfirm
(
btn
);
this
.
opChangeComfirm
(
btn
);
}
}
...
@@ -143,6 +178,7 @@ export class EnvFanPage implements OnInit {
...
@@ -143,6 +178,7 @@ export class EnvFanPage implements OnInit {
// subHeader: '确定要' + msgOp + ' ' + msgHeader + ' 这个泵吗?',
// subHeader: '确定要' + msgOp + ' ' + msgHeader + ' 这个泵吗?',
message
:
'所有'
+
msgHeader
+
'即将'
+
msgOp
+
',要继续吗?'
,
message
:
'所有'
+
msgHeader
+
'即将'
+
msgOp
+
',要继续吗?'
,
mode
:
'ios'
,
mode
:
'ios'
,
backdropDismiss
:
false
,
buttons
:
[
buttons
:
[
{
{
text
:
'取消'
,
text
:
'取消'
,
...
@@ -173,7 +209,7 @@ export class EnvFanPage implements OnInit {
...
@@ -173,7 +209,7 @@ export class EnvFanPage implements OnInit {
ts
:
parseInt
((
new
Date
().
getTime
()
/
1000
).
toString
(),
10
)
ts
:
parseInt
((
new
Date
().
getTime
()
/
1000
).
toString
(),
10
)
};
};
// this.comm.remain = 150;
// this.comm.remain = 150;
this
.
loading
.
presentLoading
(
Constants
.
LOADING_LONG
);
this
.
loading
.
presentLoading
(
Constants
.
LOADING_LONG
,
true
);
// 一键开启设备
// 一键开启设备
this
.
api
.
control
.
controlCowedBatchSwitch
([
req
,
(
data
)
=>
{
this
.
api
.
control
.
controlCowedBatchSwitch
([
req
,
(
data
)
=>
{
// if (data.code === 1) {
// if (data.code === 1) {
...
@@ -214,7 +250,7 @@ export class EnvFanPage implements OnInit {
...
@@ -214,7 +250,7 @@ export class EnvFanPage implements OnInit {
};
};
// this.comm.remain = 60;
// this.comm.remain = 60;
this
.
loading
.
presentLoading
(
Constants
.
LOADING_SHORT
);
this
.
loading
.
presentLoading
(
Constants
.
LOADING_SHORT
,
true
);
this
.
api
.
control
.
controlCowedSwitch
([
req
,
(
data
)
=>
{
this
.
api
.
control
.
controlCowedSwitch
([
req
,
(
data
)
=>
{
if
(
data
&&
data
.
code
===
1
)
{
if
(
data
&&
data
.
code
===
1
)
{
...
...
src/app/envCtrl/env-home/env-home.page.html
View file @
8f091c44
...
@@ -71,9 +71,9 @@
...
@@ -71,9 +71,9 @@
<!--<span *ngIf="item.ts" class="right">{{item.ts | date: 'yyyy-MM-dd HH:mm'}}</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>
<div
[
ngClass
]="{'
online
'
:
item
.
online
,
'
offline
'
:
!
item
.
online
}"
>
{{item.online ? '在线' : '离线'}}
</div>
<!-- 1:远控 0:现控 4:混乱 -->
<!-- 1:远控 0:现控 4:混乱 -->
<div
*
ngIf=
"item.o
perationModel === 1 || item.operationModel === 0
"
class=
"online"
>
{{item.operationModel === 1 ? '远控' :'现控'}}
</div>
<div
*
ngIf=
"item.o
nline && (item.operationModel === 1 || item.operationModel === 0)
"
class=
"online"
>
{{item.operationModel === 1 ? '远控' :'现控'}}
</div>
<div
*
ngIf=
"item.operationModel === 4"
class=
"offline"
>
现控
</div>
<div
*
ngIf=
"item.o
nline && item.o
perationModel === 4"
class=
"offline"
>
现控
</div>
<div
*
ngIf=
"item.operationModel === 1"
[
ngClass
]="{'
online
'
:
item
.
isWisdomModel
,
'
offline
'
:
!
item
.
isWisdomModel
}"
class=
"online"
>
智控
</div>
<div
*
ngIf=
"item.o
nline && item.o
perationModel === 1"
[
ngClass
]="{'
online
'
:
item
.
isWisdomModel
,
'
offline
'
:
!
item
.
isWisdomModel
}"
class=
"online"
>
智控
</div>
<div
*
ngIf=
"item.ts !== null"
class=
"right font-note"
>
{{item.ts | date: 'yyyy-MM-dd HH:mm'}}
</div>
<div
*
ngIf=
"item.ts !== null"
class=
"right font-note"
>
{{item.ts | date: 'yyyy-MM-dd HH:mm'}}
</div>
</div>
</div>
</div>
</div>
...
...
src/app/envCtrl/env-home/env-home.page.ts
View file @
8f091c44
...
@@ -225,7 +225,7 @@ export class EnvHomePage implements OnInit {
...
@@ -225,7 +225,7 @@ export class EnvHomePage implements OnInit {
}
}
toControl
(
one
)
{
toControl
(
one
)
{
const
query
=
'/env-detail?
n
o='
+
one
.
fieldRegionNo
+
'&operationModel='
+
one
.
operationModel
;
const
query
=
'/env-detail?
fieldRegionN
o='
+
one
.
fieldRegionNo
+
'&operationModel='
+
one
.
operationModel
;
this
.
tf
.
transfer
({
this
.
tf
.
transfer
({
url
:
'/'
+
one
.
url
,
url
:
'/'
+
one
.
url
,
query
:
query
,
query
:
query
,
...
...
src/app/envCtrl/env-light/env-light.page.ts
View file @
8f091c44
...
@@ -6,6 +6,7 @@ import {AlertController} from '@ionic/angular';
...
@@ -6,6 +6,7 @@ import {AlertController} from '@ionic/angular';
import
{
Constants
}
from
'../../service/constants'
;
import
{
Constants
}
from
'../../service/constants'
;
import
{
CUSTOM_ELEMENTS_SCHEMA
}
from
'@angular/core'
;
import
{
CUSTOM_ELEMENTS_SCHEMA
}
from
'@angular/core'
;
import
{
Loading
}
from
'../../service/loading'
;
import
{
Loading
}
from
'../../service/loading'
;
import
{
EventService
}
from
'../../service/event'
;
@
Component
({
@
Component
({
selector
:
'v-env-light'
,
selector
:
'v-env-light'
,
...
@@ -34,6 +35,8 @@ export class EnvLightPage implements OnInit {
...
@@ -34,6 +35,8 @@ export class EnvLightPage implements OnInit {
// 当前月份
// 当前月份
curDate
=
0
;
curDate
=
0
;
// 是否在配置页中勾选照明
enabled
=
0
;
// 各设备信息
// 各设备信息
devices
=
[];
devices
=
[];
// 一鍵控制信息
// 一鍵控制信息
...
@@ -54,13 +57,18 @@ export class EnvLightPage implements OnInit {
...
@@ -54,13 +57,18 @@ export class EnvLightPage implements OnInit {
commTmr
:
any
;
commTmr
:
any
;
constructor
(
private
api
:
Api
,
private
ac
:
ActivatedRoute
,
private
load
:
Load
,
private
route
:
ActivatedRoute
,
constructor
(
private
api
:
Api
,
private
ac
:
ActivatedRoute
,
private
load
:
Load
,
private
route
:
ActivatedRoute
,
private
alertControlle
:
AlertController
,
public
loading
:
Loading
)
{
private
alertControlle
:
AlertController
,
public
loading
:
Loading
,
private
eventService
:
EventService
)
{
}
}
ionViewWillLeave
()
{
ionViewWillLeave
()
{
clearInterval
(
this
.
commTmr
);
clearInterval
(
this
.
commTmr
);
}
}
ionViewWillEnter
()
{
console
.
log
(
'ionViewWillEnter_light'
);
this
.
init
();
}
ngOnInit
()
{
ngOnInit
()
{
console
.
log
(
'env-light: ngOnInit'
);
console
.
log
(
'env-light: ngOnInit'
);
this
.
comm
.
remain
=
0
;
this
.
comm
.
remain
=
0
;
...
@@ -78,11 +86,12 @@ export class EnvLightPage implements OnInit {
...
@@ -78,11 +86,12 @@ export class EnvLightPage implements OnInit {
}
}
},
1000
);
},
1000
);
this
.
init
();
this
.
init
();
}
ionViewWillEnter
()
{
// 订阅详情页【在离舍】开关
console
.
log
(
'ionViewWillEnter_light'
);
this
.
eventService
.
event
.
on
(
'inOutHouseController'
,
()
=>
{
this
.
init
();
console
.
log
(
'inOutHouseController'
);
this
.
getData
(
0
);
});
}
}
init
()
{
init
()
{
...
@@ -99,6 +108,7 @@ export class EnvLightPage implements OnInit {
...
@@ -99,6 +108,7 @@ export class EnvLightPage implements OnInit {
if
(
time
)
{
if
(
time
)
{
this
.
load
.
toLoad
(
'加载中...'
,
false
);
this
.
load
.
toLoad
(
'加载中...'
,
false
);
}
}
this
.
loading
.
presentLoading
(
Constants
.
LOADING_SHORTER
,
false
);
this
.
api
.
cowshedApp
.
getZhaoMingData
([{
'fieldRegionNo'
:
this
.
fieldRegionNo
},
(
data
)
=>
{
this
.
api
.
cowshedApp
.
getZhaoMingData
([{
'fieldRegionNo'
:
this
.
fieldRegionNo
},
(
data
)
=>
{
if
(
data
)
{
if
(
data
)
{
this
.
fieldRegionNo
=
data
.
fieldRegionNo
;
this
.
fieldRegionNo
=
data
.
fieldRegionNo
;
...
@@ -113,9 +123,11 @@ export class EnvLightPage implements OnInit {
...
@@ -113,9 +123,11 @@ export class EnvLightPage implements OnInit {
this
.
devices
.
forEach
(
device
=>
{
this
.
devices
.
forEach
(
device
=>
{
device
.
op
=
device
.
state
===
1
?
true
:
false
;
device
.
op
=
device
.
state
===
1
?
true
:
false
;
});
});
this
.
enabled
=
data
.
enabled
;
this
.
initButtons
();
this
.
initButtons
();
this
.
setConfusionModelControll
();
this
.
setConfusionModelControll
();
this
.
resetButtons
();
}
}
this
.
load
.
offLoad
();
this
.
load
.
offLoad
();
}]);
}]);
...
@@ -160,6 +172,24 @@ export class EnvLightPage implements OnInit {
...
@@ -160,6 +172,24 @@ export class EnvLightPage implements OnInit {
});
});
}
}
resetButtons
()
{
this
.
api
.
cowshedApp
.
getRealDataByFieldRegionNo
([{
fieldRegionNo
:
this
.
fieldRegionNo
},
(
data
)
=>
{
if
(
data
&&
data
.
inHouse
)
{
const
inHouse
=
data
.
inHouse
.
inHouse
;
const
isInHouse
=
inHouse
===
0
;
// 离舍-0 在舍-1
// 离舍的场合,配置页被勾选: 所有按钮非活性
if
(
isInHouse
&&
this
.
enabled
)
{
console
.
log
(
'离舍时,开关非活性'
);
this
.
batchSwitch
.
disabled
=
isInHouse
;
this
.
devices
.
forEach
((
device
)
=>
{
device
.
disabled
=
isInHouse
;
});
}
}
this
.
loading
.
closeLoading
();
}]);
}
toggle
(
btn
)
{
toggle
(
btn
)
{
this
.
opChangeComfirm
(
btn
);
this
.
opChangeComfirm
(
btn
);
}
}
...
@@ -178,6 +208,7 @@ export class EnvLightPage implements OnInit {
...
@@ -178,6 +208,7 @@ export class EnvLightPage implements OnInit {
header
:
'请注意'
,
header
:
'请注意'
,
message
:
msgContent
,
message
:
msgContent
,
mode
:
'ios'
,
mode
:
'ios'
,
backdropDismiss
:
false
,
buttons
:
[
buttons
:
[
{
{
text
:
'取消'
,
text
:
'取消'
,
...
@@ -208,7 +239,7 @@ export class EnvLightPage implements OnInit {
...
@@ -208,7 +239,7 @@ export class EnvLightPage implements OnInit {
ts
:
parseInt
((
new
Date
().
getTime
()
/
1000
).
toString
(),
10
)
ts
:
parseInt
((
new
Date
().
getTime
()
/
1000
).
toString
(),
10
)
};
};
// this.comm.remain = 150;
// this.comm.remain = 150;
this
.
loading
.
presentLoading
(
Constants
.
LOADING_LONG
);
this
.
loading
.
presentLoading
(
Constants
.
LOADING_LONG
,
true
);
// 一键开启设备
// 一键开启设备
this
.
api
.
control
.
controlCowedBatchSwitch
([
req
,
(
data
)
=>
{
this
.
api
.
control
.
controlCowedBatchSwitch
([
req
,
(
data
)
=>
{
...
@@ -246,7 +277,7 @@ export class EnvLightPage implements OnInit {
...
@@ -246,7 +277,7 @@ export class EnvLightPage implements OnInit {
ts
:
parseInt
((
new
Date
().
getTime
()
/
1000
).
toString
(),
10
)
ts
:
parseInt
((
new
Date
().
getTime
()
/
1000
).
toString
(),
10
)
};
};
// this.comm.remain = 60;
// this.comm.remain = 60;
this
.
loading
.
presentLoading
(
Constants
.
LOADING_SHORT
);
this
.
loading
.
presentLoading
(
Constants
.
LOADING_SHORT
,
true
);
this
.
api
.
control
.
controlCowedSwitch
([
req
,
(
data
)
=>
{
this
.
api
.
control
.
controlCowedSwitch
([
req
,
(
data
)
=>
{
if
(
data
&&
data
.
code
===
1
)
{
if
(
data
&&
data
.
code
===
1
)
{
this
.
comm
.
remain
=
0
;
this
.
comm
.
remain
=
0
;
...
...
src/app/envCtrl/env-shower/env-shower.page.ts
View file @
8f091c44
...
@@ -4,6 +4,7 @@ import {ActivatedRoute} from '@angular/router';
...
@@ -4,6 +4,7 @@ import {ActivatedRoute} from '@angular/router';
import
{
Load
}
from
'../../service/load'
;
import
{
Load
}
from
'../../service/load'
;
import
{
Constants
}
from
'../../service/constants'
;
import
{
Constants
}
from
'../../service/constants'
;
import
{
Loading
}
from
'../../service/loading'
;
import
{
Loading
}
from
'../../service/loading'
;
import
{
EventService
}
from
'../../service/event'
;
@
Component
({
@
Component
({
selector
:
'v-env-shower'
,
selector
:
'v-env-shower'
,
...
@@ -42,6 +43,9 @@ export class EnvShowerPage implements OnInit {
...
@@ -42,6 +43,9 @@ export class EnvShowerPage implements OnInit {
b
:
0
,
// A区喷淋时间
b
:
0
,
// A区喷淋时间
offset
:
0
offset
:
0
};
};
// 是否在配置页中勾选喷淋
enabled
=
0
;
// 各设备信息
// 各设备信息
param
:
any
=
[{
param
:
any
=
[{
fieldDeviceNo
:
''
,
fieldDeviceNo
:
''
,
...
@@ -71,7 +75,7 @@ export class EnvShowerPage implements OnInit {
...
@@ -71,7 +75,7 @@ export class EnvShowerPage implements OnInit {
{
modelId
:
3
,
modelValue
:
'智控模式'
}];
{
modelId
:
3
,
modelValue
:
'智控模式'
}];
constructor
(
private
api
:
Api
,
private
ac
:
ActivatedRoute
,
private
load
:
Load
,
private
route
:
ActivatedRoute
,
constructor
(
private
api
:
Api
,
private
ac
:
ActivatedRoute
,
private
load
:
Load
,
private
route
:
ActivatedRoute
,
public
loading
:
Loading
)
{
public
loading
:
Loading
,
public
eventService
:
EventService
)
{
this
.
param
[
0
].
fieldDeviceName
=
'A区'
;
this
.
param
[
0
].
fieldDeviceName
=
'A区'
;
this
.
param
[
1
].
fieldDeviceName
=
'B区'
;
this
.
param
[
1
].
fieldDeviceName
=
'B区'
;
// this.route.paramMap.subscribe(params => {
// this.route.paramMap.subscribe(params => {
...
@@ -80,6 +84,15 @@ export class EnvShowerPage implements OnInit {
...
@@ -80,6 +84,15 @@ export class EnvShowerPage implements OnInit {
// });
// });
}
}
ionViewWillEnter
()
{
console
.
log
(
'ionViewWillEnter_shower'
);
this
.
init
();
}
ionViewWillLeave
()
{
clearInterval
(
this
.
commTmr
);
}
ngOnInit
()
{
ngOnInit
()
{
this
.
comm
.
remain
=
0
;
this
.
comm
.
remain
=
0
;
this
.
comm
.
isLoading
=
false
;
this
.
comm
.
isLoading
=
false
;
...
@@ -96,15 +109,11 @@ export class EnvShowerPage implements OnInit {
...
@@ -96,15 +109,11 @@ export class EnvShowerPage implements OnInit {
}
}
},
1000
)
;
},
1000
)
;
this
.
init
();
this
.
init
();
}
// 订阅详情页【在离舍】开关
this
.
eventService
.
event
.
on
(
'inOutHouseController'
,
()
=>
{
ionViewWillEnter
()
{
console
.
log
(
'inOutHouseController'
);
console
.
log
(
'ionViewWillEnter_shower'
);
this
.
getData
(
0
);
this
.
init
();
});
}
ionViewWillLeave
()
{
clearInterval
(
this
.
commTmr
);
}
}
init
()
{
init
()
{
...
@@ -119,6 +128,7 @@ export class EnvShowerPage implements OnInit {
...
@@ -119,6 +128,7 @@ export class EnvShowerPage implements OnInit {
if
(
time
)
{
if
(
time
)
{
this
.
load
.
toLoad
(
'加载中...'
,
false
);
this
.
load
.
toLoad
(
'加载中...'
,
false
);
}
}
this
.
loading
.
presentLoading
(
Constants
.
LOADING_SHORTER
,
false
);
this
.
api
.
cowshedApp
.
getPenLinData
([{
fieldRegionNo
:
this
.
fieldRegionNo
},
(
data
)
=>
{
this
.
api
.
cowshedApp
.
getPenLinData
([{
fieldRegionNo
:
this
.
fieldRegionNo
},
(
data
)
=>
{
if
(
data
)
{
if
(
data
)
{
this
.
fieldRegionNo
=
data
.
fieldRegionNo
;
this
.
fieldRegionNo
=
data
.
fieldRegionNo
;
...
@@ -139,8 +149,12 @@ export class EnvShowerPage implements OnInit {
...
@@ -139,8 +149,12 @@ export class EnvShowerPage implements OnInit {
if
(
this
.
param
[
1
])
{
if
(
this
.
param
[
1
])
{
this
.
fieldDeviceNameB
=
this
.
param
[
1
].
fieldDeviceName
;
this
.
fieldDeviceNameB
=
this
.
param
[
1
].
fieldDeviceName
;
}
}
this
.
enabled
=
data
.
enabled
;
this
.
initButtons
();
this
.
initButtons
();
this
.
setConfusionModelControll
();
this
.
setConfusionModelControll
();
this
.
resetButtons
();
}
}
this
.
load
.
offLoad
();
this
.
load
.
offLoad
();
}]);
}]);
...
@@ -168,6 +182,23 @@ export class EnvShowerPage implements OnInit {
...
@@ -168,6 +182,23 @@ export class EnvShowerPage implements OnInit {
});
});
}
}
resetButtons
()
{
this
.
api
.
cowshedApp
.
getRealDataByFieldRegionNo
([{
fieldRegionNo
:
this
.
fieldRegionNo
},
(
data
)
=>
{
if
(
data
&&
data
.
inHouse
)
{
const
inHouse
=
data
.
inHouse
.
inHouse
;
const
isInHouse
=
inHouse
===
0
;
// 离舍-0 在舍-1
// 离舍的场合,配置页被勾选: 所有按钮非活性
if
(
isInHouse
&&
this
.
enabled
)
{
console
.
log
(
'离舍时,开关非活性'
);
this
.
param
.
forEach
((
device
)
=>
{
device
.
disabled
=
isInHouse
;
});
}
}
this
.
loading
.
closeLoading
();
}]);
}
// 单个设备控制
// 单个设备控制
deviceCheck
(
btn
)
{
deviceCheck
(
btn
)
{
const
req
=
{
const
req
=
{
...
@@ -177,7 +208,7 @@ export class EnvShowerPage implements OnInit {
...
@@ -177,7 +208,7 @@ export class EnvShowerPage implements OnInit {
ts
:
parseInt
((
new
Date
().
getTime
()
/
1000
).
toString
(),
10
)
ts
:
parseInt
((
new
Date
().
getTime
()
/
1000
).
toString
(),
10
)
};
};
// this.comm.remain = 60;
// this.comm.remain = 60;
this
.
loading
.
presentLoading
(
Constants
.
LOADING_SHORT
);
this
.
loading
.
presentLoading
(
Constants
.
LOADING_SHORT
,
true
);
this
.
api
.
control
.
controlCowedSwitch
([
req
,
(
data
)
=>
{
this
.
api
.
control
.
controlCowedSwitch
([
req
,
(
data
)
=>
{
if
(
data
&&
data
.
code
===
1
)
{
if
(
data
&&
data
.
code
===
1
)
{
this
.
comm
.
remain
=
0
;
this
.
comm
.
remain
=
0
;
...
...
src/app/envCtrl/env-waterchannel/env-waterchannel.page.ts
View file @
8f091c44
...
@@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core';
...
@@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core';
import
{
Api
}
from
'../../service/api'
;
import
{
Api
}
from
'../../service/api'
;
import
{
ActivatedRoute
}
from
'@angular/router'
;
import
{
ActivatedRoute
}
from
'@angular/router'
;
import
{
Load
}
from
'../../service/load'
;
import
{
Load
}
from
'../../service/load'
;
import
{
Constants
}
from
'../../service/constants'
;
import
{
Loading
}
from
'../../service/loading'
;
@
Component
({
@
Component
({
selector
:
'v-env-waterchannel'
,
selector
:
'v-env-waterchannel'
,
...
@@ -20,7 +22,7 @@ export class EnvWaterchannelPage implements OnInit {
...
@@ -20,7 +22,7 @@ export class EnvWaterchannelPage implements OnInit {
isLoading
:
true
isLoading
:
true
};
};
constructor
(
private
api
:
Api
,
private
ac
:
ActivatedRoute
,
private
load
:
Load
,
private
route
:
ActivatedRoute
)
{
}
constructor
(
private
api
:
Api
,
private
ac
:
ActivatedRoute
,
private
load
:
Load
,
private
route
:
ActivatedRoute
,
public
loading
:
Loading
)
{
}
ngOnInit
()
{
ngOnInit
()
{
// this.ac.queryParams.subscribe((data) => {
// this.ac.queryParams.subscribe((data) => {
...
@@ -47,11 +49,13 @@ export class EnvWaterchannelPage implements OnInit {
...
@@ -47,11 +49,13 @@ export class EnvWaterchannelPage implements OnInit {
if
(
time
)
{
if
(
time
)
{
this
.
load
.
toLoad
(
'加载中...'
,
false
);
this
.
load
.
toLoad
(
'加载中...'
,
false
);
}
}
this
.
loading
.
presentLoading
(
Constants
.
LOADING_SHORTER
,
false
);
this
.
api
.
cowshedApp
.
getShuiCaoData
([{
fieldRegionNo
:
this
.
fieldRegionNo
},
(
data
)
=>
{
this
.
api
.
cowshedApp
.
getShuiCaoData
([{
fieldRegionNo
:
this
.
fieldRegionNo
},
(
data
)
=>
{
if
(
data
)
{
if
(
data
)
{
this
.
devices
=
data
.
param
;
this
.
devices
=
data
.
param
;
}
}
this
.
load
.
offLoad
();
this
.
load
.
offLoad
();
this
.
loading
.
closeLoading
();
}]);
}]);
}
}
}
}
src/app/service/constants.ts
View file @
8f091c44
...
@@ -16,8 +16,11 @@ export class Constants {
...
@@ -16,8 +16,11 @@ export class Constants {
public
static
CONTROLL_WISDOM
=
3
;
// 智慧控制
public
static
CONTROLL_WISDOM
=
3
;
// 智慧控制
public
static
CONTROLL_CONFUSION
=
4
;
// 混乱
public
static
CONTROLL_CONFUSION
=
4
;
// 混乱
// 刷新时间(秒)
public
static
LOADING_SHORTER
=
0.3
;
// 单个开关
public
static
LOADING_SHORT
=
10
;
// 单个开关
public
static
LOADING_SHORT
=
10
;
// 单个开关
public
static
LOADING_LONG
=
40
;
// 一键控制等
public
static
LOADING_LONG
=
40
;
// 一键控制等
public
static
LOADING_LONGER
=
60
;
// 一键控制等
}
}
src/app/service/loading.ts
View file @
8f091c44
...
@@ -7,37 +7,45 @@ export class Loading {
...
@@ -7,37 +7,45 @@ export class Loading {
}
}
loading
:
any
;
loading
:
any
;
loadingIsOpen
:
any
;
countdown
=
0
;
countdown
=
0
;
interval
:
any
;
interval
:
any
;
async
presentLoading
(
time
)
{
async
presentLoading
(
time
,
showMessage
)
{
clearInterval
(
this
.
interval
);
if
(
this
.
loadingIsOpen
)
{
this
.
countdown
=
time
;
clearInterval
(
this
.
interval
);
this
.
loading
=
await
this
.
loadingController
.
create
({
}
else
{
mode
:
'ios'
,
console
.
log
(
'loading is open'
);
spinner
:
'circles'
,
this
.
loadingIsOpen
=
true
;
message
:
'通信中,还剩 '
+
time
+
' 秒'
,
this
.
countdown
=
time
;
cssClass
:
'main-color'
,
this
.
loading
=
await
this
.
loadingController
.
create
({
duration
:
time
*
1000
mode
:
'ios'
,
});
spinner
:
'circles'
,
this
.
loading
.
present
();
message
:
showMessage
?
'通信中,还剩 '
+
time
+
' 秒'
:
''
,
this
.
interval
=
window
.
setInterval
(()
=>
{
cssClass
:
'main-color'
,
if
(
this
.
countdown
>
0
)
{
duration
:
time
*
1000
this
.
countdown
--
;
});
this
.
loading
.
message
=
'通信中,还剩 '
+
this
.
countdown
+
' 秒'
;
this
.
loading
.
present
();
}
else
{
this
.
interval
=
window
.
setInterval
(()
=>
{
this
.
loading
.
message
=
''
;
if
(
this
.
countdown
>
0
)
{
}
this
.
countdown
--
;
},
1000
)
this
.
loading
.
message
=
showMessage
?
'通信中,还剩 '
+
this
.
countdown
+
' 秒'
:
''
;
}
else
{
this
.
loading
.
message
=
''
;
}
},
1000
)
const
{
role
,
data
}
=
await
this
.
loading
.
onDidDismiss
();
const
{
role
,
data
}
=
await
this
.
loading
.
onDidDismiss
();
console
.
log
(
'Loading dismissed!'
);
console
.
log
(
'Loading dismissed!'
);
}
}
}
async
closeLoading
()
{
async
closeLoading
()
{
if
(
this
.
loading
!==
undefined
||
this
.
loading
!==
null
)
{
if
(
this
.
loading
!==
undefined
||
this
.
loading
!==
null
)
{
console
.
log
(
'loading is close'
);
this
.
loading
.
dismiss
();
this
.
loading
.
dismiss
();
this
.
loading
.
onDidDismiss
();
this
.
loading
.
onDidDismiss
();
this
.
loadingIsOpen
=
false
;
clearInterval
(
this
.
interval
);
clearInterval
(
this
.
interval
);
}
}
}
}
...
...
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