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
072dfe3d
Commit
072dfe3d
authored
Dec 09, 2019
by
yating.lin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
整理按钮活性非活性控制
parent
ee5a8176
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
159 additions
and
108 deletions
+159
-108
app-routing.module.ts
src/app/app-routing.module.ts
+3
-3
env-alarm.page.ts
src/app/envCtrl/env-alarm/env-alarm.page.ts
+2
-1
env-detail.page.ts
src/app/envCtrl/env-detail/env-detail.page.ts
+12
-7
env-fan.page.ts
src/app/envCtrl/env-fan/env-fan.page.ts
+54
-34
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
+55
-53
env-shower.page.ts
src/app/envCtrl/env-shower/env-shower.page.ts
+32
-9
No files found.
src/app/app-routing.module.ts
View file @
072dfe3d
...
...
@@ -57,9 +57,9 @@ const routes: Routes = [
component
:
EnvDetailPage
,
children
:
[
{
path
:
'fan'
,
component
:
EnvFanPage
},
{
path
:
'shower/:fieldRegionNo/:operationModel'
,
component
:
EnvShowerPage
},
{
path
:
'light/:fieldRegionNo/:operationModel'
,
component
:
EnvLightPage
},
{
path
:
'waterchannel/:fieldRegionNo/:operationModel'
,
component
:
EnvWaterchannelPage
},
{
path
:
'shower/:fieldRegionNo/:operationModel
/:online
'
,
component
:
EnvShowerPage
},
{
path
:
'light/:fieldRegionNo/:operationModel
/:online
'
,
component
:
EnvLightPage
},
{
path
:
'waterchannel/:fieldRegionNo/:operationModel
/:online
'
,
component
:
EnvWaterchannelPage
},
{
path
:
''
,
redirectTo
:
'fan'
,
pathMatch
:
'prefix'
},
]
...
...
src/app/envCtrl/env-alarm/env-alarm.page.ts
View file @
072dfe3d
...
...
@@ -132,7 +132,8 @@ export class EnvAlarmPage implements OnInit {
setTimeout
(()
=>
{
this
.
init
();
event
.
target
.
complete
();
// 通知刷新告警barge
this
.
eventService
.
event
.
emit
(
'refreshAlarmInfo'
);
},
1500
);
}
...
...
src/app/envCtrl/env-detail/env-detail.page.ts
View file @
072dfe3d
...
...
@@ -106,7 +106,7 @@ export class EnvDetailPage implements OnInit {
this
.
setInHouseInfo
(
data
.
inHouse
);
this
.
initLayout
(
environmentConfigJson
);
this
.
set
ConfusionModelControll
();
this
.
set
InHouseDisable
();
}
}]);
}
...
...
@@ -129,9 +129,9 @@ export class EnvDetailPage implements OnInit {
initLayout
(
environmentConfigJson
)
{
this
.
fanLink
=
'/env-detail/fan/'
;
this
.
showerLink
=
'/env-detail/shower/'
+
this
.
fieldRegionNo
+
'/'
+
this
.
item
.
operationModel
;
this
.
lightLink
=
'/env-detail/light/'
+
this
.
fieldRegionNo
+
'/'
+
this
.
item
.
operationModel
;
this
.
waterchannelLink
=
'/env-detail/waterchannel/'
+
this
.
fieldRegionNo
+
'/'
+
this
.
item
.
operationModel
;
this
.
showerLink
=
'/env-detail/shower/'
+
this
.
fieldRegionNo
+
'/'
+
this
.
item
.
operationModel
+
'/'
+
this
.
item
.
online
;
this
.
lightLink
=
'/env-detail/light/'
+
this
.
fieldRegionNo
+
'/'
+
this
.
item
.
operationModel
+
'/'
+
this
.
item
.
online
;
this
.
waterchannelLink
=
'/env-detail/waterchannel/'
+
this
.
fieldRegionNo
+
'/'
+
this
.
item
.
operationModel
+
'/'
+
this
.
item
.
online
;
if
(
this
.
item
)
{
this
.
item
.
heatStressColor
=
this
.
item
.
heatStressLevel
===
0
?
'#62C7CC'
:
...
...
@@ -256,9 +256,14 @@ export class EnvDetailPage implements OnInit {
// }, 2000);
// }
setConfusionModelControll
()
{
// 混乱模式
if
(
+
this
.
item
.
operationModel
===
Constants
.
CONTROLL_CONFUSION
)
{
setInHouseDisable
()
{
// 以下场合 非活性
// 1.离线 2.在线&现控 3.在线&混乱
const
online
=
+
this
.
item
.
online
;
// 0-离线,1-在线
const
operationModel
=
+
this
.
item
.
operationModel
;
// 0-现控,1-远控,4-混乱
if
(
online
===
0
||
(
online
===
1
&&
operationModel
===
0
)
||
(
online
===
1
&&
operationModel
===
4
))
{
this
.
inHouseDisabled
=
true
;
}
else
{
this
.
inHouseDisabled
=
false
;
...
...
src/app/envCtrl/env-fan/env-fan.page.ts
View file @
072dfe3d
...
...
@@ -20,6 +20,7 @@ export class EnvFanPage implements OnInit {
// 牧场区域编号
fieldRegionNo
=
''
;
operationModel
=
0
;
online
=
1
;
// 牧场设备类型
fieldDeviceType
=
''
;
// 模式状态
...
...
@@ -52,8 +53,8 @@ export class EnvFanPage implements OnInit {
if
(
data
&&
data
.
fieldRegionNo
!==
undefined
&&
data
.
fieldRegionNo
!==
null
&&
data
.
fieldRegionNo
!==
''
)
{
this
.
fieldRegionNo
=
data
.
fieldRegionNo
;
this
.
operationModel
=
data
.
operationModel
;
this
.
online
=
data
.
online
;
}
});
}
...
...
@@ -120,23 +121,14 @@ export class EnvFanPage implements OnInit {
});
this
.
enabled
=
data
.
enabled
;
this
.
initButtons
();
this
.
setConfusionModelControll
();
this
.
resetButtons
();
this
.
initButtonOpen
();
this
.
initButtonDisable
();
}
this
.
load
.
offLoad
();
}]);
}
initButtons
()
{
// 各个按钮表示状态
// 一键控制 远控的场合,活性(Disabled = false)
const
allDisabled
=
!
(
this
.
controlModel
===
Constants
.
CONTROLL_REMOTR
);
this
.
batchSwitch
.
disabled
=
allDisabled
;
this
.
devices
.
forEach
((
device
)
=>
{
device
.
disabled
=
allDisabled
;
});
initButtonOpen
()
{
// [一键控制]按钮(默认: 开启)
// 当任意子按钮[关闭]的状态下: 关闭 以外:开启
this
.
batchSwitch
.
op
=
true
;
...
...
@@ -147,20 +139,58 @@ export class EnvFanPage implements OnInit {
});
}
resetButtons
()
{
console
.
log
(
'reset buttons'
);
initButtonDisable
()
{
// 各个按钮表示状态
let
batchDisable
=
false
;
let
oneDisable
=
false
;
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
;
});
const
online
=
+
this
.
online
;
// 0-离线,1-在线
const
operationModel
=
+
this
.
operationModel
;
// 0-现控,1-远控,4-混乱
const
inHouse
=
data
.
inHouse
.
inHouse
?
+
data
.
inHouse
.
inHouse
:
0
;
// 0-离舍,1-在舍
const
enable
=
+
this
.
enabled
;
// 配置页打钩
const
controlModel
=
this
.
controlModel
;
// 1.离线 2.在线&现控 3.在线&混乱
if
(
online
===
0
||
(
online
===
1
&&
operationModel
===
0
)
||
(
online
===
1
&&
operationModel
===
4
))
{
batchDisable
=
true
;
oneDisable
=
true
;
// 在线+远控
}
else
if
(
online
===
1
&&
operationModel
===
1
)
{
// 4.在线+远控+离舍+配置页勾选
if
(
inHouse
===
0
&&
enable
===
1
)
{
batchDisable
=
true
;
oneDisable
=
true
;
}
else
if
(
inHouse
===
0
&&
enable
===
0
)
{
// 5.在线+远控+离舍+配置页未勾选+手控
if
(
controlModel
===
1
)
{
batchDisable
=
false
;
oneDisable
=
false
;
// 6.在线+远控+离舍+配置页未勾选+自控
}
else
if
(
controlModel
===
2
)
{
batchDisable
=
true
;
oneDisable
=
true
;
}
}
else
if
(
inHouse
===
1
)
{
// 7.在线+远控+在舍+手控
if
(
controlModel
===
1
)
{
batchDisable
=
false
;
oneDisable
=
false
;
// 8.在线+远控+在舍+自控
}
else
if
(
controlModel
===
2
)
{
batchDisable
=
true
;
oneDisable
=
true
;
}
}
}
this
.
batchSwitch
.
disabled
=
batchDisable
;
this
.
devices
.
forEach
((
device
)
=>
{
device
.
disabled
=
oneDisable
;
});
}
this
.
loading
.
closeLoading
();
}]);
...
...
@@ -265,14 +295,4 @@ export class EnvFanPage implements OnInit {
// this.comm.remain = 0;
}]);
}
setConfusionModelControll
()
{
// 混乱模式
if
(
+
this
.
operationModel
===
Constants
.
CONTROLL_CONFUSION
)
{
this
.
batchSwitch
.
disabled
=
true
;
this
.
devices
.
forEach
((
device
)
=>
{
device
.
disabled
=
true
;
});
}
}
}
src/app/envCtrl/env-home/env-home.page.ts
View file @
072dfe3d
...
...
@@ -225,7 +225,7 @@ export class EnvHomePage implements OnInit {
}
toControl
(
one
)
{
const
query
=
'/env-detail?fieldRegionNo='
+
one
.
fieldRegionNo
+
'&operationModel='
+
one
.
operationModel
;
const
query
=
'/env-detail?fieldRegionNo='
+
one
.
fieldRegionNo
+
'&operationModel='
+
one
.
operationModel
+
'&online='
+
one
.
online
;
this
.
tf
.
transfer
({
url
:
'/'
+
one
.
url
,
query
:
query
,
...
...
src/app/envCtrl/env-light/env-light.page.ts
View file @
072dfe3d
...
...
@@ -18,6 +18,7 @@ export class EnvLightPage implements OnInit {
// 牧场区域编号
fieldRegionNo
=
''
;
operationModel
=
0
;
online
=
1
;
// 牧场设备类型
fieldDeviceType
=
''
;
// 模式状态
...
...
@@ -97,7 +98,8 @@ export class EnvLightPage implements OnInit {
init
()
{
this
.
route
.
paramMap
.
subscribe
(
params
=>
{
this
.
fieldRegionNo
=
params
.
get
(
'fieldRegionNo'
);
this
.
operationModel
=
+
params
.
get
(
'operationModel'
);
this
.
operationModel
=
+
params
.
get
(
'operationModel'
);
this
.
online
=
+
params
.
get
(
'online'
);
this
.
getData
(
0
);
});
...
...
@@ -125,43 +127,14 @@ export class EnvLightPage implements OnInit {
});
this
.
enabled
=
data
.
enabled
;
this
.
initButtons
();
this
.
setConfusionModelControll
();
this
.
resetButtons
();
this
.
initButtonOpen
();
this
.
initButtonDisable
();
}
this
.
load
.
offLoad
();
}]);
}
initButtons
()
{
if
(
this
.
controlModel
===
Constants
.
CONTROLL_REMOTR
)
{
// 远控(手控) 的场合
// 一键控制: 活性
this
.
batchSwitch
.
disabled
=
false
;
this
.
devices
.
forEach
((
device
)
=>
{
device
.
disabled
=
false
;
});
}
else
{
// 其他
// 一键控制: 非活性
this
.
batchSwitch
.
disabled
=
true
;
}
if
(
this
.
controlModel
===
Constants
.
CONTROLL_REMOTR
)
{
// 远控 的场合
// 子按钮: 活性
this
.
devices
.
forEach
((
device
)
=>
{
device
.
disabled
=
false
;
});
}
else
{
// 其他
// 子按钮: 非活性
this
.
devices
.
forEach
((
device
)
=>
{
device
.
disabled
=
true
;
});
}
initButtonOpen
()
{
// 设置[一键控制]按钮(默认: 开启)
// 当任意子按钮[关闭]的状态下: 关闭 以外:开启
this
.
batchSwitch
.
op
=
true
;
...
...
@@ -172,19 +145,58 @@ export class EnvLightPage implements OnInit {
});
}
resetButtons
()
{
initButtonDisable
()
{
// 各个按钮表示状态
let
batchDisable
=
false
;
let
oneDisable
=
false
;
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
;
});
const
online
=
+
this
.
online
;
// 0-离线,1-在线
const
operationModel
=
+
this
.
operationModel
;
// 0-现控,1-远控,4-混乱
const
inHouse
=
data
.
inHouse
.
inHouse
?
+
data
.
inHouse
.
inHouse
:
0
;
// 0-离舍,1-在舍
const
enable
=
+
this
.
enabled
;
// 配置页打钩
const
controlModel
=
this
.
controlModel
;
// 1.离线 2.在线&现控 3.在线&混乱
if
(
online
===
0
||
(
online
===
1
&&
operationModel
===
0
)
||
(
online
===
1
&&
operationModel
===
4
))
{
batchDisable
=
true
;
oneDisable
=
true
;
// 在线+远控
}
else
if
(
online
===
1
&&
operationModel
===
1
)
{
// 4.在线+远控+离舍+配置页勾选
if
(
inHouse
===
0
&&
enable
===
1
)
{
batchDisable
=
true
;
oneDisable
=
true
;
}
else
if
(
inHouse
===
0
&&
enable
===
0
)
{
// 5.在线+远控+离舍+配置页未勾选+手控
if
(
controlModel
===
1
)
{
batchDisable
=
false
;
oneDisable
=
false
;
// 6.在线+远控+离舍+配置页未勾选+自控
}
else
if
(
controlModel
===
2
)
{
batchDisable
=
true
;
oneDisable
=
true
;
}
}
else
if
(
inHouse
===
1
)
{
// 7.在线+远控+在舍+手控
if
(
controlModel
===
1
)
{
batchDisable
=
false
;
oneDisable
=
false
;
// 8.在线+远控+在舍+自控
}
else
if
(
controlModel
===
2
)
{
batchDisable
=
true
;
oneDisable
=
true
;
}
}
}
this
.
batchSwitch
.
disabled
=
batchDisable
;
this
.
devices
.
forEach
((
device
)
=>
{
device
.
disabled
=
oneDisable
;
});
}
this
.
loading
.
closeLoading
();
}]);
...
...
@@ -292,14 +304,4 @@ export class EnvLightPage implements OnInit {
btn
.
loading
=
false
;
}]);
}
setConfusionModelControll
()
{
// 混乱模式
if
(
+
this
.
operationModel
===
Constants
.
CONTROLL_CONFUSION
)
{
this
.
batchSwitch
.
disabled
=
true
;
this
.
devices
.
forEach
((
device
)
=>
{
device
.
disabled
=
true
;
});
}
}
}
src/app/envCtrl/env-shower/env-shower.page.ts
View file @
072dfe3d
...
...
@@ -28,6 +28,7 @@ export class EnvShowerPage implements OnInit {
// 牧场区域编号
fieldRegionNo
=
''
;
operationModel
=
0
;
online
=
1
;
// 牧场设备类型
fieldDeviceType
=
''
;
// 模式状态
...
...
@@ -119,7 +120,8 @@ export class EnvShowerPage implements OnInit {
init
()
{
this
.
route
.
paramMap
.
subscribe
(
params
=>
{
this
.
fieldRegionNo
=
params
.
get
(
'fieldRegionNo'
);
this
.
operationModel
=
+
params
.
get
(
'operationModel'
);
this
.
operationModel
=
+
params
.
get
(
'operationModel'
);
this
.
online
=
+
params
.
get
(
'online'
);
this
.
getData
(
0
);
});
}
...
...
@@ -152,9 +154,7 @@ export class EnvShowerPage implements OnInit {
this
.
enabled
=
data
.
enabled
;
this
.
initButtons
();
this
.
setConfusionModelControll
();
this
.
resetButtons
();
this
.
initButtonDisable
();
}
this
.
load
.
offLoad
();
}]);
...
...
@@ -167,7 +167,7 @@ export class EnvShowerPage implements OnInit {
return
param
;
}
initButton
s
()
{
initButton
Disable
()
{
// 自控状态下 设备全部为打开状态
// if (this.controlModel === Constants.CONTROLL_SELF || this.controlModel === Constants.CONTROLL_WISDOM) {
// this.param.forEach((device) => {
...
...
@@ -175,11 +175,34 @@ export class EnvShowerPage implements OnInit {
// device.op = true;
// });
// }
// 各个按钮表示状态
let
oneDisable
=
false
;
this
.
api
.
cowshedApp
.
getRealDataByFieldRegionNo
([{
fieldRegionNo
:
this
.
fieldRegionNo
},
(
data
)
=>
{
if
(
data
&&
data
.
inHouse
)
{
this
.
param
.
forEach
((
device
)
=>
{
// 远控的场合 小按钮活性(disabled = false)
device
.
disabled
=
!
(
this
.
controlModel
===
Constants
.
CONTROLL_REMOTR
);
});
const
online
=
+
this
.
online
;
// 0-离线,1-在线
const
operationModel
=
+
this
.
operationModel
;
// 0-现控,1-远控,4-混乱
const
inHouse
=
data
.
inHouse
.
inHouse
?
+
data
.
inHouse
.
inHouse
:
0
;
// 0-离舍,1-在舍
const
enable
=
+
this
.
enabled
;
// 配置页打钩
const
controlModel
=
this
.
controlModel
;
// 5.在线+远控+离舍+配置页未勾选+手控 或者
// 7.在线+远控+在舍+手控 的场合 活性
// 以外 非活性
// 1.离线 2.在线&现控 3.在线&混乱
if
((
online
===
1
&&
operationModel
===
1
&&
inHouse
===
0
&&
enable
===
0
&&
controlModel
===
1
)
||
(
online
===
1
&&
operationModel
===
1
&&
inHouse
===
1
&&
controlModel
===
1
))
{
oneDisable
=
false
;
}
else
{
oneDisable
=
true
;
}
this
.
param
.
forEach
((
device
)
=>
{
// 远控的场合 小按钮活性(disabled = false)
device
.
disabled
=
oneDisable
;
});
}
this
.
loading
.
closeLoading
();
}]);
}
resetButtons
()
{
...
...
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