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
b77aceea
Commit
b77aceea
authored
May 28, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
地图模式-003
parent
0ff24cac
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
8 deletions
+33
-8
DevicesController.php
app/Http/Controllers/DevicesController.php
+12
-3
map.js
resources/js/api/map.js
+2
-1
index.vue
resources/js/views/map/index.vue
+19
-4
No files found.
app/Http/Controllers/DevicesController.php
View file @
b77aceea
...
...
@@ -370,10 +370,19 @@ class DevicesController extends Controller
return
$this
->
jsonSuccessData
(
DB
::
table
(
'device_type'
)
->
where
(
'tid'
,
'='
,
$id
)
->
delete
());
}
public
function
deviceLocation
()
public
function
deviceLocation
(
Request
$request
)
{
$where
=
[];
if
(
$request
->
has
(
'uid'
))
{
$user_id
=
$request
->
get
(
'uid'
);
$where
[
'uid'
]
=
$user_id
;
}
$data
=
DB
::
table
(
'device'
)
->
select
(
'id'
,
'uid'
,
'nd'
,
'deviceinfo'
,
'devicenum'
,
'devicecoord'
,
'devicepolice'
,
'deviceremark'
,
'devicelinkman'
)
->
where
(
$where
)
->
get
();
//返回用户安装位置
return
$this
->
jsonSuccessData
(
DB
::
table
(
'device'
)
->
select
(
'id'
,
'uid'
,
'nd'
,
'deviceinfo'
,
'devicenum'
,
'devicecoord'
,
'devicepolice'
,
'deviceremark'
,
'devicelinkman'
)
->
get
()
);
return
$this
->
jsonSuccessData
(
$data
);
}
//返回消防监测
public
function
control
(
Request
$request
)
...
...
@@ -493,4 +502,4 @@ class DevicesController extends Controller
return
105
;
}
}
}
\ No newline at end of file
}
resources/js/api/map.js
View file @
b77aceea
import
request
from
'@/utils/request'
;
export
function
devices
()
{
export
function
devices
(
query
)
{
return
request
({
url
:
'/devices/deviceLocation'
,
method
:
'get'
,
params
:
query
,
});
}
...
...
resources/js/views/map/index.vue
View file @
b77aceea
...
...
@@ -18,7 +18,7 @@
:content=
"marker.nickname | rebuildContent(marker.UserDaviceNum, marker.police)"
:vid=
"index"
:clickable=
"true"
:events=
"rebuildEvent(marker
.mapcenter
)"
:events=
"rebuildEvent(marker)"
:z-index=
"markerUserZIndex"
></el-amap-marker>
<el-amap-circle-marker
...
...
@@ -121,11 +121,17 @@ export default {
return
mcontent
;
},
rebuildUserCenter
(
mapcenter
)
{
if
(
mapcenter
===
null
)
{
return
''
;
}
mapcenter
=
mapcenter
.
replace
(
/
\s
*/g
,
''
);
// console.log(mapcenter.split(','));
return
mapcenter
.
split
(
','
);
},
deviceLocationFilter
(
center
)
{
if
(
center
===
null
)
{
return
''
;
}
center
=
center
.
replace
(
/
\s
*/g
,
''
);
return
center
.
split
(
','
);
},
...
...
@@ -214,7 +220,7 @@ export default {
console
.
log
(
res
.
data
);
this
.
markers
=
res
.
data
;
});
devices
()
devices
(
{}
)
.
then
(
res
=>
{
console
.
log
(
res
.
data
);
this
.
markersDevice
=
res
.
data
;
...
...
@@ -232,8 +238,8 @@ export default {
console
.
log
(
device
);
alert
(
'deviceInfo'
);
},
rebuildEvent
(
ma
pcent
er
)
{
mapcenter
=
mapcenter
.
replace
(
/
\s
*/g
,
''
);
rebuildEvent
(
ma
rk
er
)
{
var
mapcenter
=
marker
.
mapcenter
.
replace
(
/
\s
*/g
,
''
);
// console.log(mapcenter);
const
that
=
this
;
const
position
=
mapcenter
.
split
(
','
);
...
...
@@ -243,6 +249,7 @@ export default {
that
.
getUserDevices
(
position
);
that
.
deviceListVisible
=
true
;
that
.
markerUserZIndex
=
1000
;
that
.
getUserDeviceList
(
marker
.
id
);
},
};
},
...
...
@@ -267,6 +274,14 @@ export default {
},
};
},
// 获取单个用户下的设备
getUserDeviceList
(
uid
)
{
devices
({
uid
:
uid
})
.
then
(
res
=>
{
console
.
log
(
res
.
data
);
this
.
markersDevice
=
res
.
data
;
});
},
},
};
</
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