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 {
...
@@ -184,6 +184,7 @@ export default {
data
(){
data
(){
const
_this
=
this
;
const
_this
=
this
;
return
{
return
{
intervalId
:
null
,
map
:
{},
map
:
{},
amapManager
:
new
AMapManager
(),
amapManager
:
new
AMapManager
(),
zoom
:
6
,
zoom
:
6
,
...
@@ -247,10 +248,17 @@ export default {
...
@@ -247,10 +248,17 @@ export default {
.
then
(
res
=>
{
.
then
(
res
=>
{
this
.
markersDevice
=
res
.
data
;
this
.
markersDevice
=
res
.
data
;
});
});
this
.
dataRefresh
();
},
destroyed
(){
// 在页面销毁后,清除计时器
this
.
clearIntv
();
},
},
methods
:
{
methods
:
{
checkPermission
,
checkPermission
,
allDevices
()
{
allDevices
()
{
this
.
clearIntv
();
this
.
dataRefresh
();
devices
()
devices
()
.
then
(
res
=>
{
.
then
(
res
=>
{
this
.
leftDeviceName
=
'全部设备'
;
this
.
leftDeviceName
=
'全部设备'
;
...
@@ -290,10 +298,13 @@ export default {
...
@@ -290,10 +298,13 @@ export default {
},
},
// 获取单个用户下的设备
// 获取单个用户下的设备
getUserDeviceList
(
uid
)
{
getUserDeviceList
(
uid
)
{
// 停止定时器
this
.
clearIntv
();
devices
({
uid
:
uid
})
devices
({
uid
:
uid
})
.
then
(
res
=>
{
.
then
(
res
=>
{
this
.
markersDevice
=
res
.
data
;
this
.
markersDevice
=
res
.
data
;
});
});
this
.
dataRefresh
(
uid
);
},
},
// 获取设备详细信息
// 获取设备详细信息
getUserDeviceInfo
(
id
)
{
getUserDeviceInfo
(
id
)
{
...
@@ -367,6 +378,41 @@ export default {
...
@@ -367,6 +378,41 @@ export default {
openDeviceBox
(
row
,
column
,
event
)
{
openDeviceBox
(
row
,
column
,
event
)
{
this
.
getUserDeviceInfo
(
row
.
id
);
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
>
</
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