Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
laravelzh
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
冯超鹏
laravelzh
Commits
009f2adb
Commit
009f2adb
authored
Dec 07, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
地图定时刷新
parent
effb6f6f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
index.vue
resources/js/views/map/index.vue
+46
-0
No files found.
resources/js/views/map/index.vue
View file @
009f2adb
...
...
@@ -184,6 +184,7 @@ export default {
data
(){
const
_this
=
this
;
return
{
intervalId
:
null
,
map
:
{},
amapManager
:
new
AMapManager
(),
zoom
:
6
,
...
...
@@ -247,10 +248,17 @@ export default {
.
then
(
res
=>
{
this
.
markersDevice
=
res
.
data
;
});
this
.
dataRefresh
();
},
destroyed
(){
// 在页面销毁后,清除计时器
this
.
clearIntv
();
},
methods
:
{
checkPermission
,
allDevices
()
{
this
.
clearIntv
();
this
.
dataRefresh
();
devices
()
.
then
(
res
=>
{
this
.
leftDeviceName
=
'全部设备'
;
...
...
@@ -290,10 +298,13 @@ export default {
},
// 获取单个用户下的设备
getUserDeviceList
(
uid
)
{
// 停止定时器
this
.
clearIntv
();
devices
({
uid
:
uid
})
.
then
(
res
=>
{
this
.
markersDevice
=
res
.
data
;
});
this
.
dataRefresh
(
uid
);
},
// 获取设备详细信息
getUserDeviceInfo
(
id
)
{
...
...
@@ -367,6 +378,41 @@ export default {
openDeviceBox
(
row
,
column
,
event
)
{
this
.
getUserDeviceInfo
(
row
.
id
);
},
// 定时刷新数据
dataRefresh
(
uid
=
null
)
{
// 计时器正在进行中,退出函数
if
(
this
.
intervalId
!=
null
)
{
return
;
}
// 计时器为空,操作
this
.
intervalId
=
setInterval
(()
=>
{
console
.
log
(
'刷新'
+
uid
+
'--'
+
new
Date
());
if
(
uid
>
0
)
{
users
({
uid
:
uid
})
.
then
(
res
=>
{
this
.
markers
=
res
.
data
;
});
devices
({
uid
:
uid
})
.
then
(
res
=>
{
this
.
markersDevice
=
res
.
data
;
});
}
else
{
users
()
.
then
(
res
=>
{
this
.
markers
=
res
.
data
;
});
devices
({})
.
then
(
res
=>
{
this
.
markersDevice
=
res
.
data
;
});
}
},
3000
);
},
// 停止定时器
clearIntv
()
{
clearInterval
(
this
.
intervalId
);
// 清除计时器
this
.
intervalId
=
null
;
// 设置为null
},
},
};
</
script
>
...
...
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