Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-customization-system
/
oEshield
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 3aeddf2c
authored
Apr 25, 2022
by
张杰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复围栏bug
1 parent
e5d57ecd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
57 additions
and
7 deletions
src/api/services/monitor.js
src/assets/json/city.json
src/components/area/index.vue
src/constant.js
src/pages/monitor/fenceMap.vue
src/vuex/modules/common.js
src/api/services/monitor.js
View file @
3aeddf2
...
...
@@ -155,4 +155,9 @@ export const GET_DEVICE_LOCATION = params => {
// 批量查询设备在线状态
export
const
GET_MONITOR_ONLINELIST
=
params
=>
{
return
request
(
params
,
'/devicemonitor/monitor/onlinelist'
,
'get'
)
}
// 获取高德地图的省市区
export
const
GET_AMAP_PROVINCE
=
params
=>
{
return
request
(
params
,
'https://restapi.amap.com/v3/config/district'
,
'get'
)
}
\ No newline at end of file
src/assets/json/city.json
View file @
3aeddf2
This diff is collapsed.
Click to expand it.
src/components/area/index.vue
View file @
3aeddf2
...
...
@@ -3,6 +3,9 @@
</
template
>
<
script
>
import
cityJson
from
"@/assets/json/city.json"
;
import
{
CONSTANT
}
from
"@/constant"
;
// import axios from "axios";
// import store from "@/vuex/store";
export
default
{
name
:
"CitySelect"
,
props
:
{
...
...
@@ -41,6 +44,14 @@ export default {
// immediate: true,
// },
},
created
()
{
// 查询
// console.log(store);
// let list = store.state.common.provinceList;
// if (!list || list.length <= 0) {
// this.getList();
// }
},
mounted
()
{
//this.city = this.value;
this
.
init
();
...
...
@@ -49,18 +60,18 @@ export default {
onChange
(
e
)
{
console
.
log
(
e
);
let
list
=
this
.
cityList
;
let
nameList
=
[]
let
nameList
=
[]
;
let
m
=
list
.
find
((
k
)
=>
k
.
code
==
e
[
0
]);
console
.
log
(
m
)
nameList
.
push
(
m
.
name
)
console
.
log
(
m
)
;
nameList
.
push
(
m
.
name
)
;
let
n
=
m
.
children
.
find
((
k
)
=>
k
.
code
==
e
[
1
]);
let
b
=
(
n
&&
n
.
children
||
[]).
find
((
k
)
=>
k
.
code
==
e
[
2
]);
let
b
=
(
(
n
&&
n
.
children
)
||
[]).
find
((
k
)
=>
k
.
code
==
e
[
2
]);
if
(
n
)
{
this
.
$emit
(
"input"
,
n
.
name
);
nameList
.
push
(
n
.
name
)
nameList
.
push
(
n
.
name
)
;
}
if
(
b
)
{
nameList
.
push
(
b
.
name
)
if
(
b
)
{
nameList
.
push
(
b
.
name
)
;
}
this
.
$emit
(
"change"
,
{
code
:
e
,
name
:
nameList
});
},
...
...
@@ -131,6 +142,26 @@ export default {
});
return
afterArray
;
},
// 查询高德地图的省市区
getList
()
{
let
oParams
=
{};
oParams
.
key
=
CONSTANT
.
MAP_SERVICE_KEY
;
oParams
.
subdistrict
=
3
;
oParams
.
keywords
=
"中国"
;
axios
({
url
:
"https://restapi.amap.com/v3/config/district"
,
params
:
oParams
,
}).
then
((
res
)
=>
{
console
.
log
(
res
);
let
obj
=
res
.
data
;
let
{
districts
}
=
obj
;
let
list
=
districts
[
0
]
?
districts
[
0
].
districts
:
[];
console
.
log
(
list
);
this
.
cityList
=
list
;
store
.
commit
(
'SET_AMAP_PROVINCE'
,
list
)
});
},
},
};
</
script
>
...
...
src/constant.js
View file @
3aeddf2
export
const
MAP_KEY
=
'75116f653f3b2e4568116dad8cd9b899'
export
const
MAP_SERVICE_KEY
=
'd22348363c34c266f772ae9b635eef2a'
// 地图插件
export
const
MAP_PLUGINS
=
[
...
...
@@ -19,6 +20,7 @@ export const CONSTANT = {
//ROOT: process.env.NODE_ENV === 'development'?'ots/':'',
API_URL
:
'/ots/'
,
MAP_KEY
,
MAP_SERVICE_KEY
,
MAP_PLUGINS
,
AMAP_URL
:
`https://webapi.amap.com/maps?v=1.4.2&key=
${
MAP_KEY
}
&plugin=
${
MAP_PLUGINS
.
toString
()}
`
}
\ No newline at end of file
src/pages/monitor/fenceMap.vue
View file @
3aeddf2
...
...
@@ -228,6 +228,11 @@ export default {
});
}
else
{
this
.
drawFenceCircle
(
mapService
.
getLngLat
(
this
.
lng
,
this
.
lat
));
this
.
$emit
(
"onUpdateMapData"
,
{
lng
:
this
.
lng
,
lat
:
this
.
lat
,
radius
:
this
.
radius
,
});
}
},
drawFenceCircle
(
fenceCenter
)
{
...
...
src/vuex/modules/common.js
View file @
3aeddf2
...
...
@@ -21,6 +21,7 @@ const state = {
zlAccount
:
false
,
permission
:
[],
vehicleGenerate
:
false
,
provinceList
:[],
// 高德地图的省市区
}
const
mutations
=
{
...
...
@@ -84,6 +85,12 @@ const mutations = {
[
types
.
vehicleGenerate
](
state
,
data
)
{
state
.
vehicleGenerate
=
data
},
// 高德地图的省市区
SET_AMAP_PROVINCE
(
state
,
data
){
state
.
provinceList
=
data
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment