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
9589d331
Commit
9589d331
authored
May 30, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
地图模式
parent
b77aceea
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
27 deletions
+68
-27
map.js
resources/js/api/map.js
+7
-0
index.vue
resources/js/views/map/index.vue
+61
-27
No files found.
resources/js/api/map.js
View file @
9589d331
...
@@ -14,3 +14,10 @@ export function users() {
...
@@ -14,3 +14,10 @@ export function users() {
method
:
'get'
,
method
:
'get'
,
});
});
}
}
export
function
deviceinfo
(
id
)
{
return
request
({
url
:
'/devices/device_info/'
+
id
,
method
:
'get'
,
});
}
resources/js/views/map/index.vue
View file @
9589d331
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
></el-amap-circle-marker>
></el-amap-circle-marker>
<!-- 右上角设备和用户切换按钮 -->
<!-- 右上角设备和用户切换按钮 -->
<div
class=
"toolbar"
>
<div
class=
"toolbar"
>
<el-button
type=
"primary"
size=
"mini"
round
@
click=
"allDevices"
>
全部设备
</el-button>
<el-switch
<el-switch
v-model=
"markersDeviceVisible"
v-model=
"markersDeviceVisible"
active-text=
"设备"
active-text=
"设备"
...
@@ -65,7 +66,7 @@
...
@@ -65,7 +66,7 @@
<el-collapse
v-model=
"activeNames"
>
<el-collapse
v-model=
"activeNames"
>
<el-collapse-item
name=
"1"
>
<el-collapse-item
name=
"1"
>
<template
slot=
"title"
>
<template
slot=
"title"
>
设备列表
<i
class=
"header-icon el-icon-info"
></i>
设备列表
-
{{
leftDeviceName
}}
</
template
>
</
template
>
<el-table
:data=
"markersDevice"
style=
"100%"
max-height=
"700"
>
<el-table
:data=
"markersDevice"
style=
"100%"
max-height=
"700"
>
<el-table-column
property=
"devicenum"
label=
"设备编号"
width=
"200px"
></el-table-column>
<el-table-column
property=
"devicenum"
label=
"设备编号"
width=
"200px"
></el-table-column>
...
@@ -89,7 +90,7 @@
...
@@ -89,7 +90,7 @@
import
Vue
from
'vue'
;
import
Vue
from
'vue'
;
import
VueAMap
from
'vue-amap'
;
import
VueAMap
from
'vue-amap'
;
import
{
AMapManager
}
from
'vue-amap'
;
import
{
AMapManager
}
from
'vue-amap'
;
import
{
devices
,
users
}
from
'@/api/map'
;
import
{
devices
,
users
,
deviceinfo
}
from
'@/api/map'
;
Vue
.
use
(
VueAMap
);
Vue
.
use
(
VueAMap
);
...
@@ -125,7 +126,6 @@ export default {
...
@@ -125,7 +126,6 @@ export default {
return
''
;
return
''
;
}
}
mapcenter
=
mapcenter
.
replace
(
/
\s
*/g
,
''
);
mapcenter
=
mapcenter
.
replace
(
/
\s
*/g
,
''
);
// console.log(mapcenter.split(','));
return
mapcenter
.
split
(
','
);
return
mapcenter
.
split
(
','
);
},
},
deviceLocationFilter
(
center
)
{
deviceLocationFilter
(
center
)
{
...
@@ -179,9 +179,7 @@ export default {
...
@@ -179,9 +179,7 @@ export default {
'moveend'
:
()
=>
{
'moveend'
:
()
=>
{
},
},
'zoomchange'
:
()
=>
{
'zoomchange'
:
()
=>
{
// console.log('zoom:', _this.$refs.map);
_this
.
zoom
=
this
.
$refs
.
map
.
$$getInstance
().
getZoom
();
_this
.
zoom
=
this
.
$refs
.
map
.
$$getInstance
().
getZoom
();
console
.
log
(
_this
.
zoom
);
},
},
'click'
:
(
e
)
=>
{
'click'
:
(
e
)
=>
{
// alert('map clicked');
// alert('map clicked');
...
@@ -206,6 +204,8 @@ export default {
...
@@ -206,6 +204,8 @@ export default {
deviceListVisible
:
true
,
// 用户设备列表是否显示
deviceListVisible
:
true
,
// 用户设备列表是否显示
activeNames
:
[
'1'
],
// 左侧设备列表默认打开
activeNames
:
[
'1'
],
// 左侧设备列表默认打开
markerUserZIndex
:
100
,
markerUserZIndex
:
100
,
deviceAll
:
undefined
,
leftDeviceName
:
'全部设备'
,
};
};
},
},
watch
:
{
watch
:
{
...
@@ -217,16 +217,22 @@ export default {
...
@@ -217,16 +217,22 @@ export default {
// const users = devices.users();
// const users = devices.users();
users
()
users
()
.
then
(
res
=>
{
.
then
(
res
=>
{
console
.
log
(
res
.
data
);
this
.
markers
=
res
.
data
;
this
.
markers
=
res
.
data
;
});
});
devices
({})
devices
({})
.
then
(
res
=>
{
.
then
(
res
=>
{
console
.
log
(
res
.
data
);
this
.
markersDevice
=
res
.
data
;
this
.
markersDevice
=
res
.
data
;
});
});
},
},
methods
:
{
methods
:
{
allDevices
()
{
devices
()
.
then
(
res
=>
{
this
.
leftDeviceName
=
'全部设备'
;
this
.
markersDevice
=
res
.
data
;
this
.
zoom
=
6
;
});
},
getUserDevices
(
center
)
{
getUserDevices
(
center
)
{
// alert(userid);
// alert(userid);
this
.
zoom
=
12
;
this
.
zoom
=
12
;
...
@@ -234,18 +240,14 @@ export default {
...
@@ -234,18 +240,14 @@ export default {
this
.
markerVisible
=
true
;
this
.
markerVisible
=
true
;
this
.
markersDeviceVisible
=
true
;
this
.
markersDeviceVisible
=
true
;
},
},
getDeviceInfo
(
device
)
{
console
.
log
(
device
);
alert
(
'deviceInfo'
);
},
rebuildEvent
(
marker
)
{
rebuildEvent
(
marker
)
{
var
mapcenter
=
marker
.
mapcenter
.
replace
(
/
\s
*/g
,
''
);
var
mapcenter
=
marker
.
mapcenter
.
replace
(
/
\s
*/g
,
''
);
// console.log(mapcenter);
const
that
=
this
;
const
that
=
this
;
const
position
=
mapcenter
.
split
(
','
);
const
position
=
mapcenter
.
split
(
','
);
return
{
return
{
click
(
e
)
{
click
(
e
)
{
// alert(that.zoom);
// alert(that.zoom);
that
.
leftDeviceName
=
marker
.
nickname
;
that
.
getUserDevices
(
position
);
that
.
getUserDevices
(
position
);
that
.
deviceListVisible
=
true
;
that
.
deviceListVisible
=
true
;
that
.
markerUserZIndex
=
1000
;
that
.
markerUserZIndex
=
1000
;
...
@@ -257,20 +259,7 @@ export default {
...
@@ -257,20 +259,7 @@ export default {
const
that
=
this
;
const
that
=
this
;
return
{
return
{
click
(
e
)
{
click
(
e
)
{
console
.
log
(
marker
);
that
.
getUserDeviceInfo
(
marker
.
id
);
// const position = marker.devicecoord.replace(/\s*/g, '');
// console.log(position.split(','));
that
.
gridData
=
[
{
title
:
'设备编号'
,
content
:
marker
.
devicenum
,
},
{
title
:
'坐标'
,
content
:
marker
.
devicecoord
,
},
];
that
.
dialogTableVisible
=
true
;
},
},
};
};
},
},
...
@@ -278,10 +267,55 @@ export default {
...
@@ -278,10 +267,55 @@ export default {
getUserDeviceList
(
uid
)
{
getUserDeviceList
(
uid
)
{
devices
({
uid
:
uid
})
devices
({
uid
:
uid
})
.
then
(
res
=>
{
.
then
(
res
=>
{
console
.
log
(
res
.
data
);
this
.
markersDevice
=
res
.
data
;
this
.
markersDevice
=
res
.
data
;
});
});
},
},
// 获取设备详细信息
getUserDeviceInfo
(
id
)
{
deviceinfo
(
id
)
.
then
(
res
=>
{
this
.
dialogTableVisible
=
true
;
const
deviceInfo
=
res
.
data
;
this
.
gridData
=
[
{
title
:
'设备编号'
,
content
:
deviceInfo
.
devicenum
,
},
{
title
:
'坐标'
,
content
:
deviceInfo
.
devicecoord
,
},
{
title
:
'设备类型'
,
content
:
deviceInfo
.
tname
,
},
{
title
:
'用户'
,
content
:
deviceInfo
.
usernickname
,
},
{
title
:
'检测介质'
,
content
:
deviceInfo
.
gas
,
},
{
title
:
'状态'
,
content
:
deviceInfo
.
status_name
,
},
{
title
:
'安装位置'
,
content
:
deviceInfo
.
deviceinfo
,
},
{
title
:
'联系人'
,
content
:
deviceInfo
.
devicelinkman
,
},
{
title
:
'电话'
,
content
:
deviceInfo
.
devicephone
,
},
];
});
},
},
},
};
};
</
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