Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_wechat
Overview
Overview
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
pseer
gxpt_wechat
Commits
b97a02d4
Commit
b97a02d4
authored
Mar 13, 2024
by
zhangzhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
硬件操作优化
parent
ead25fbb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
9 deletions
+31
-9
index.vue
pages/deviceManage/index.vue
+31
-9
No files found.
pages/deviceManage/index.vue
View file @
b97a02d4
...
@@ -51,7 +51,7 @@
...
@@ -51,7 +51,7 @@
<text
class=
"text-title"
>
门禁控制
</text>
<text
class=
"text-title"
>
门禁控制
</text>
<view
v-if=
"val.deviceList.door.status ==1"
class=
""
>
<view
v-if=
"val.deviceList.door.status ==1"
class=
""
>
<text>
电量:
{{
val
.
deviceList
.
door
.
voltage
}}
</text>
<text>
电量:
{{
val
.
deviceList
.
door
.
voltage
}}
</text>
<button
@
tap=
"onDeviceRun(10,val.deviceList.door
.roomId
)"
class=
"cu-btn bg-blue margin-left-sm"
>
开启
</button>
<button
@
tap=
"onDeviceRun(10,val.deviceList.door)"
class=
"cu-btn bg-blue margin-left-sm"
>
开启
</button>
</view>
</view>
<view
v-else-if=
"val.deviceList.door.status =='0'"
class=
""
>
<view
v-else-if=
"val.deviceList.door.status =='0'"
class=
""
>
<text>
离线
</text>
<text>
离线
</text>
...
@@ -60,8 +60,11 @@
...
@@ -60,8 +60,11 @@
<view
class=
"part"
v-if=
"val.deviceList.el"
>
<view
class=
"part"
v-if=
"val.deviceList.el"
>
<text
class=
"text-title"
>
取电开关
</text>
<text
class=
"text-title"
>
取电开关
</text>
<view
class=
""
>
<view
class=
""
>
<button
@
tap=
"onDeviceRun(20,val.deviceList.el.roomId)"
class=
"cu-btn bg-blue margin-right-sm"
>
开启
</button>
<button
@
tap=
"onDeviceRun(40,val.deviceList.el.roomId)"
class=
"cu-btn bg-blue"
>
关闭
</button>
<text
class=
"margin-right-sm"
:class=
"val.deviceList.el.status==3?'text-red':'text-green'"
>
{{
deviceStatusEnum
[
val
.
deviceList
.
el
.
status
]
}}
</text>
<button
@
tap=
"onDeviceRun(20,val.deviceList.el)"
class=
"cu-btn margin-right-sm"
:class=
"val.deviceList.el.status==2?'bg-blue':'bg-gray'"
>
开启
</button>
<button
@
tap=
"onDeviceRun(40,val.deviceList.el)"
class=
"cu-btn"
:class=
"val.deviceList.el.status==3?'bg-blue':'bg-gray'"
>
关闭
</button>
<!--
<switch
data-type=
"door"
:data-index=
"index"
:data-k=
"k"
:data-id=
"val.deviceList.el.roomId"
@
change=
"onSwitchDoor"
:class=
"val.deviceList.el.status==3?'checked':''"
:checked=
"val.deviceList.el.status==3?true:false"
color=
"#e54d42"
></switch>
-->
<!--
<switch
data-type=
"door"
:data-index=
"index"
:data-k=
"k"
:data-id=
"val.deviceList.el.roomId"
@
change=
"onSwitchDoor"
:class=
"val.deviceList.el.status==3?'checked':''"
:checked=
"val.deviceList.el.status==3?true:false"
color=
"#e54d42"
></switch>
-->
</view>
</view>
</view>
</view>
...
@@ -101,6 +104,7 @@ import moment from "@/common/moment";
...
@@ -101,6 +104,7 @@ import moment from "@/common/moment";
3
:
"#ff494e"
,
3
:
"#ff494e"
,
4
:
"#ff49ef"
4
:
"#ff49ef"
},
},
deviceStatusEnum
:{},
colorList
:[
colorList
:[
{
{
label
:
"空闲中"
,
label
:
"空闲中"
,
...
@@ -137,7 +141,8 @@ import moment from "@/common/moment";
...
@@ -137,7 +141,8 @@ import moment from "@/common/moment";
20
:
'取电'
,
20
:
'取电'
,
30
:
'锁门'
,
30
:
'锁门'
,
40
:
'断电'
40
:
'断电'
}
},
timer
:
null
};
};
},
},
filters
:{
filters
:{
...
@@ -154,12 +159,14 @@ import moment from "@/common/moment";
...
@@ -154,12 +159,14 @@ import moment from "@/common/moment";
if
(
uni
.
getStorageSync
(
'dicts'
))
{
if
(
uni
.
getStorageSync
(
'dicts'
))
{
dicts
=
JSON
.
parse
(
uni
.
getStorageSync
(
'dicts'
))
dicts
=
JSON
.
parse
(
uni
.
getStorageSync
(
'dicts'
))
this
.
cleanStatusEnum
=
getDictItem
(
dicts
,
"clean_records_status"
);
this
.
cleanStatusEnum
=
getDictItem
(
dicts
,
"clean_records_status"
);
this
.
deviceStatusEnum
=
getDictItem
(
dicts
,
"device_status"
);
this
.
onLoading
()
this
.
onLoading
()
}
else
{
}
else
{
dictList
().
then
(
res
=>
{
dictList
().
then
(
res
=>
{
dicts
=
res
.
data
.
data
;
dicts
=
res
.
data
.
data
;
uni
.
setStorageSync
(
'dicts'
,
JSON
.
stringify
(
res
.
data
.
data
))
uni
.
setStorageSync
(
'dicts'
,
JSON
.
stringify
(
res
.
data
.
data
))
this
.
cleanStatusEnum
=
getDictItem
(
dicts
,
"clean_records_status"
);
this
.
cleanStatusEnum
=
getDictItem
(
dicts
,
"clean_records_status"
);
this
.
deviceStatusEnum
=
getDictItem
(
dicts
,
"device_status"
);
this
.
onLoading
()
this
.
onLoading
()
})
})
}
}
...
@@ -168,10 +175,10 @@ import moment from "@/common/moment";
...
@@ -168,10 +175,10 @@ import moment from "@/common/moment";
getList
().
then
(
res
=>
{
getList
().
then
(
res
=>
{
if
(
res
.
data
.
code
===
200
){
if
(
res
.
data
.
code
===
200
){
let
list
=
res
.
data
.
data
&&
res
.
data
.
data
.
length
?
res
.
data
.
data
:[];
let
list
=
res
.
data
.
data
&&
res
.
data
.
data
.
length
?
res
.
data
.
data
:[];
this
.
list
=
list
.
map
(
item
=>
{
this
.
list
=
list
.
map
(
(
item
,
index
)
=>
{
return
{
return
{
...
item
,
...
item
,
show
:
false
,
show
:
this
.
list
.
length
?
this
.
list
[
index
].
show
:
false
,
roomVoList
:
item
.
roomVoList
&&
item
.
roomVoList
.
length
?
item
.
roomVoList
.
map
(
val
=>
{
roomVoList
:
item
.
roomVoList
&&
item
.
roomVoList
.
length
?
item
.
roomVoList
.
map
(
val
=>
{
let
deviceList
=
{}
let
deviceList
=
{}
if
(
val
.
deviceList
&&
val
.
deviceList
.
length
){
if
(
val
.
deviceList
&&
val
.
deviceList
.
length
){
...
@@ -199,7 +206,7 @@ import moment from "@/common/moment";
...
@@ -199,7 +206,7 @@ import moment from "@/common/moment";
}
}
return
{
return
{
...
val
,
...
val
,
colorStatus
:
val
.
recordsStatus
>=
0
&&
val
.
recordsStatus
===
0
?
3
:
val
.
recordsStatus
>=
0
&&
val
.
recordsStatus
===
1
?
4
:
val
.
status
,
colorStatus
:
val
.
recordsStatus
>=
0
&&
val
.
recordsStatus
===
0
?
3
:
val
.
recordsStatus
>=
0
&&
val
.
recordsStatus
===
1
?
4
:
val
.
status
,
images
:
val
.
images
?
val
.
images
.
split
(
","
):[],
images
:
val
.
images
?
val
.
images
.
split
(
","
):[],
deviceList
deviceList
}
}
...
@@ -236,7 +243,9 @@ import moment from "@/common/moment";
...
@@ -236,7 +243,9 @@ import moment from "@/common/moment";
// let t = e.target.value? 20: 40
// let t = e.target.value? 20: 40
// this.onDeviceRun(t,e.target.dataset.id)
// this.onDeviceRun(t,e.target.dataset.id)
// },
// },
onDeviceRun
(
opType
,
roomId
){
onDeviceRun
(
opType
,
device
){
if
(
opType
==
20
&&
device
.
status
!=
2
)
return
;
if
(
opType
==
40
&&
device
.
status
!=
3
)
return
;
let
that
=
this
;
let
that
=
this
;
if
(
this
.
deviceTime
){
if
(
this
.
deviceTime
){
uni
.
showToast
({
uni
.
showToast
({
...
@@ -251,7 +260,7 @@ import moment from "@/common/moment";
...
@@ -251,7 +260,7 @@ import moment from "@/common/moment";
})
})
deviceRun
({
deviceRun
({
opType
,
opType
,
roomId
roomId
:
device
.
roomId
}).
then
(
res
=>
{
}).
then
(
res
=>
{
uni
.
hideLoading
()
uni
.
hideLoading
()
if
(
res
.
data
.
code
===
200
){
if
(
res
.
data
.
code
===
200
){
...
@@ -259,6 +268,19 @@ import moment from "@/common/moment";
...
@@ -259,6 +268,19 @@ import moment from "@/common/moment";
icon
:
"success"
,
icon
:
"success"
,
title
:
this
.
optionStatus
[
opType
]
+
"成功"
title
:
this
.
optionStatus
[
opType
]
+
"成功"
})
})
let
i
=
5
;
if
(
that
.
timer
){
clearInterval
(
that
.
timer
)
}
that
.
timer
=
setInterval
(()
=>
{
if
(
i
<=
0
){
clearInterval
(
that
.
timer
)
return
}
i
-=
1
;
that
.
onLoading
();
},
7000
)
}
else
{
}
else
{
uni
.
showToast
({
uni
.
showToast
({
icon
:
"none"
,
icon
:
"none"
,
...
...
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