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
Show 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
...
@@ -156,3 +156,8 @@ export const GET_DEVICE_LOCATION = params => {
...
@@ -156,3 +156,8 @@ export const GET_DEVICE_LOCATION = params => {
export
const
GET_MONITOR_ONLINELIST
=
params
=>
{
export
const
GET_MONITOR_ONLINELIST
=
params
=>
{
return
request
(
params
,
'/devicemonitor/monitor/onlinelist'
,
'get'
)
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
\ 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 @@
...
@@ -3,6 +3,9 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
cityJson
from
"@/assets/json/city.json"
;
import
cityJson
from
"@/assets/json/city.json"
;
import
{
CONSTANT
}
from
"@/constant"
;
// import axios from "axios";
// import store from "@/vuex/store";
export
default
{
export
default
{
name
:
"CitySelect"
,
name
:
"CitySelect"
,
props
:
{
props
:
{
...
@@ -41,6 +44,14 @@ export default {
...
@@ -41,6 +44,14 @@ export default {
// immediate: true,
// immediate: true,
// },
// },
},
},
created
()
{
// 查询
// console.log(store);
// let list = store.state.common.provinceList;
// if (!list || list.length <= 0) {
// this.getList();
// }
},
mounted
()
{
mounted
()
{
//this.city = this.value;
//this.city = this.value;
this
.
init
();
this
.
init
();
...
@@ -49,18 +60,18 @@ export default {
...
@@ -49,18 +60,18 @@ export default {
onChange
(
e
)
{
onChange
(
e
)
{
console
.
log
(
e
);
console
.
log
(
e
);
let
list
=
this
.
cityList
;
let
list
=
this
.
cityList
;
let
nameList
=
[]
let
nameList
=
[]
;
let
m
=
list
.
find
((
k
)
=>
k
.
code
==
e
[
0
]);
let
m
=
list
.
find
((
k
)
=>
k
.
code
==
e
[
0
]);
console
.
log
(
m
)
console
.
log
(
m
)
;
nameList
.
push
(
m
.
name
)
nameList
.
push
(
m
.
name
)
;
let
n
=
m
.
children
.
find
((
k
)
=>
k
.
code
==
e
[
1
]);
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
)
{
if
(
n
)
{
this
.
$emit
(
"input"
,
n
.
name
);
this
.
$emit
(
"input"
,
n
.
name
);
nameList
.
push
(
n
.
name
)
nameList
.
push
(
n
.
name
)
;
}
}
if
(
b
)
{
if
(
b
)
{
nameList
.
push
(
b
.
name
)
nameList
.
push
(
b
.
name
)
;
}
}
this
.
$emit
(
"change"
,
{
code
:
e
,
name
:
nameList
});
this
.
$emit
(
"change"
,
{
code
:
e
,
name
:
nameList
});
},
},
...
@@ -131,6 +142,26 @@ export default {
...
@@ -131,6 +142,26 @@ export default {
});
});
return
afterArray
;
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
>
</
script
>
...
...
src/constant.js
View file @
3aeddf2
export
const
MAP_KEY
=
'75116f653f3b2e4568116dad8cd9b899'
export
const
MAP_KEY
=
'75116f653f3b2e4568116dad8cd9b899'
export
const
MAP_SERVICE_KEY
=
'd22348363c34c266f772ae9b635eef2a'
// 地图插件
// 地图插件
export
const
MAP_PLUGINS
=
[
export
const
MAP_PLUGINS
=
[
...
@@ -19,6 +20,7 @@ export const CONSTANT = {
...
@@ -19,6 +20,7 @@ export const CONSTANT = {
//ROOT: process.env.NODE_ENV === 'development'?'ots/':'',
//ROOT: process.env.NODE_ENV === 'development'?'ots/':'',
API_URL
:
'/ots/'
,
API_URL
:
'/ots/'
,
MAP_KEY
,
MAP_KEY
,
MAP_SERVICE_KEY
,
MAP_PLUGINS
,
MAP_PLUGINS
,
AMAP_URL
:
`https://webapi.amap.com/maps?v=1.4.2&key=
${
MAP_KEY
}
&plugin=
${
MAP_PLUGINS
.
toString
()}
`
AMAP_URL
:
`https://webapi.amap.com/maps?v=1.4.2&key=
${
MAP_KEY
}
&plugin=
${
MAP_PLUGINS
.
toString
()}
`
}
}
\ No newline at end of file
\ No newline at end of file
src/pages/monitor/fenceMap.vue
View file @
3aeddf2
...
@@ -228,6 +228,11 @@ export default {
...
@@ -228,6 +228,11 @@ export default {
});
});
}
else
{
}
else
{
this
.
drawFenceCircle
(
mapService
.
getLngLat
(
this
.
lng
,
this
.
lat
));
this
.
drawFenceCircle
(
mapService
.
getLngLat
(
this
.
lng
,
this
.
lat
));
this
.
$emit
(
"onUpdateMapData"
,
{
lng
:
this
.
lng
,
lat
:
this
.
lat
,
radius
:
this
.
radius
,
});
}
}
},
},
drawFenceCircle
(
fenceCenter
)
{
drawFenceCircle
(
fenceCenter
)
{
...
...
src/vuex/modules/common.js
View file @
3aeddf2
...
@@ -21,6 +21,7 @@ const state = {
...
@@ -21,6 +21,7 @@ const state = {
zlAccount
:
false
,
zlAccount
:
false
,
permission
:
[],
permission
:
[],
vehicleGenerate
:
false
,
vehicleGenerate
:
false
,
provinceList
:[],
// 高德地图的省市区
}
}
const
mutations
=
{
const
mutations
=
{
...
@@ -85,6 +86,12 @@ const mutations = {
...
@@ -85,6 +86,12 @@ const mutations = {
state
.
vehicleGenerate
=
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