Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gassafety
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
耿迪迪
gassafety
Commits
60e602e6
Commit
60e602e6
authored
3 years ago
by
yaqizhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
6666666
parent
8243d948
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
28 deletions
+37
-28
gaodeMap.js
gassafety-web/src/utils/gaodeMap.js
+31
-22
index.vue
...ety-web/src/views/dataMonitoring/realtimedetail/index.vue
+6
-6
No files found.
gassafety-web/src/utils/gaodeMap.js
View file @
60e602e6
...
@@ -41,7 +41,7 @@ class gaodeMap {
...
@@ -41,7 +41,7 @@ class gaodeMap {
leftListClick
=
false
;
leftListClick
=
false
;
//构造函数中设置中央点默认值
//构造函数中设置中央点默认值
constructor
(
center
)
{
constructor
(
center
,
latlng
)
{
this
.
markers
=
[];
this
.
markers
=
[];
this
.
center
=
center
?
center
:
defaultCenter
;
this
.
center
=
center
?
center
:
defaultCenter
;
map
=
new
AMap
.
Map
(
"container"
,
{
map
=
new
AMap
.
Map
(
"container"
,
{
...
@@ -77,7 +77,7 @@ class gaodeMap {
...
@@ -77,7 +77,7 @@ class gaodeMap {
this
.
createNewLine
();
this
.
createNewLine
();
console
.
log
(
"map点击事件新建"
);
console
.
log
(
"map点击事件新建"
);
})
})
.
catch
(()
=>
{});
.
catch
(()
=>
{
});
}
}
// console.log("抬起来了");
// console.log("抬起来了");
});
});
...
@@ -116,9 +116,10 @@ class gaodeMap {
...
@@ -116,9 +116,10 @@ class gaodeMap {
let
options
=
this
.
myMap
.
getStatus
();
let
options
=
this
.
myMap
.
getStatus
();
options
.
scrollWheel
=
true
;
options
.
scrollWheel
=
true
;
this
.
myMap
.
setStatus
(
options
);
this
.
myMap
.
setStatus
(
options
);
console
.
log
(
"飞行结束"
)
});
});
this
.
districtBoundaries
();
this
.
districtBoundaries
(
latlng
);
}
}
panTo
(
lnglat
)
{
panTo
(
lnglat
)
{
this
.
myMap
.
panTo
(
lnglat
);
this
.
myMap
.
panTo
(
lnglat
);
...
@@ -148,7 +149,7 @@ class gaodeMap {
...
@@ -148,7 +149,7 @@ class gaodeMap {
* 设置城市边界
* 设置城市边界
*/
*/
districtBoundaries
()
{
districtBoundaries
(
latlng
)
{
let
that
=
this
;
let
that
=
this
;
let
opts
=
{
let
opts
=
{
subdistrict
:
0
,
subdistrict
:
0
,
...
@@ -156,12 +157,20 @@ class gaodeMap {
...
@@ -156,12 +157,20 @@ class gaodeMap {
level
:
"city"
level
:
"city"
};
};
let
district
=
new
AMap
.
DistrictSearch
(
opts
);
let
district
=
new
AMap
.
DistrictSearch
(
opts
);
district
.
search
(
that
.
center
,
function
(
status
,
result
)
{
district
.
search
(
that
.
center
,
function
(
status
,
result
)
{
if
(
status
==
"complete"
)
{
if
(
status
==
"complete"
)
{
let
defaultCenter
=
[];
let
defaultCenter
=
[];
defaultCenter
.
push
(
result
.
districtList
[
0
].
center
.
lng
);
defaultCenter
.
push
(
result
.
districtList
[
0
].
center
.
lng
);
defaultCenter
.
push
(
result
.
districtList
[
0
].
center
.
lat
);
defaultCenter
.
push
(
result
.
districtList
[
0
].
center
.
lat
);
if
(
latlng
)
{
map
.
setCenter
(
latlng
);
}
else
{
map
.
setCenter
(
defaultCenter
);
map
.
setCenter
(
defaultCenter
);
}
console
.
log
(
"defaultCenter"
,
defaultCenter
)
let
bounds
=
result
.
districtList
[
0
].
boundaries
;
let
bounds
=
result
.
districtList
[
0
].
boundaries
;
for
(
let
i
=
0
;
i
<
bounds
.
length
;
i
+=
1
)
{
for
(
let
i
=
0
;
i
<
bounds
.
length
;
i
+=
1
)
{
new
AMap
.
Polyline
({
new
AMap
.
Polyline
({
...
@@ -190,12 +199,12 @@ class gaodeMap {
...
@@ -190,12 +199,12 @@ class gaodeMap {
offset
:
new
AMap
.
Pixel
(
24
,
-
38
),
offset
:
new
AMap
.
Pixel
(
24
,
-
38
),
anchor
:
"left-top"
anchor
:
"left-top"
});
});
infoWindow
.
on
(
"mouseover"
,
function
()
{
infoWindow
.
on
(
"mouseover"
,
function
()
{
let
options
=
map
.
getStatus
();
let
options
=
map
.
getStatus
();
options
.
scrollWheel
=
false
;
options
.
scrollWheel
=
false
;
map
.
setStatus
(
options
);
map
.
setStatus
(
options
);
});
});
infoWindow
.
on
(
"mouseout"
,
function
()
{
infoWindow
.
on
(
"mouseout"
,
function
()
{
let
options
=
map
.
getStatus
();
let
options
=
map
.
getStatus
();
options
.
scrollWheel
=
true
;
options
.
scrollWheel
=
true
;
map
.
setStatus
(
options
);
map
.
setStatus
(
options
);
...
@@ -225,7 +234,7 @@ class gaodeMap {
...
@@ -225,7 +234,7 @@ class gaodeMap {
editWindow
.
obj
=
marker
;
editWindow
.
obj
=
marker
;
editWindow
.
gaoMap
=
that
;
editWindow
.
gaoMap
=
that
;
editWindow
.
map
=
map
;
editWindow
.
map
=
map
;
marker
.
on
(
"click"
,
function
(
e
)
{
marker
.
on
(
"click"
,
function
(
e
)
{
if
(
"edit"
==
that
.
mapOperateType
)
{
if
(
"edit"
==
that
.
mapOperateType
)
{
editWindow
.
form
=
e
.
target
.
getExtData
();
editWindow
.
form
=
e
.
target
.
getExtData
();
editWindow
.
show
();
editWindow
.
show
();
...
@@ -287,19 +296,19 @@ class gaodeMap {
...
@@ -287,19 +296,19 @@ class gaodeMap {
infoWindow.open(map, e.target.getPosition());
infoWindow.open(map, e.target.getPosition());
}*/
}*/
});
});
marker
.
on
(
"dragend"
,
function
(
e
)
{
marker
.
on
(
"dragend"
,
function
(
e
)
{
editWindow
.
form
.
longitude
=
e
.
lnglat
.
lng
;
editWindow
.
form
.
longitude
=
e
.
lnglat
.
lng
;
editWindow
.
form
.
latitude
=
e
.
lnglat
.
lat
;
editWindow
.
form
.
latitude
=
e
.
lnglat
.
lat
;
});
});
}
else
{
}
else
{
marker
.
on
(
"mouseover"
,
function
()
{
marker
.
on
(
"mouseover"
,
function
()
{
marker
.
setLabel
({
marker
.
setLabel
({
offset
:
new
AMap
.
Pixel
(
0
,
-
10
),
//设置文本标注偏移量
offset
:
new
AMap
.
Pixel
(
0
,
-
10
),
//设置文本标注偏移量
content
:
"<div class='info'>"
+
data
.
deviceName
+
"</div>"
,
//设置文本标注内容
content
:
"<div class='info'>"
+
data
.
deviceName
+
"</div>"
,
//设置文本标注内容
direction
:
"top"
//设置文本标注方位
direction
:
"top"
//设置文本标注方位
});
});
});
});
marker
.
on
(
"mouseout"
,
function
()
{
marker
.
on
(
"mouseout"
,
function
()
{
marker
.
setLabel
({
marker
.
setLabel
({
content
:
null
content
:
null
});
});
...
@@ -943,14 +952,14 @@ class gaodeMap {
...
@@ -943,14 +952,14 @@ class gaodeMap {
this
.
overlays
=
[];
this
.
overlays
=
[];
let
that
=
this
;
let
that
=
this
;
this
.
markerOverlays
=
[];
this
.
markerOverlays
=
[];
this
.
mouseTool
.
on
(
"draw"
,
function
(
e
)
{
this
.
mouseTool
.
on
(
"draw"
,
function
(
e
)
{
if
(
e
.
obj
.
getExtData
().
type
!=
"newLine"
)
{
if
(
e
.
obj
.
getExtData
().
type
!=
"newLine"
)
{
map
.
remove
(
that
.
markerOverlays
);
map
.
remove
(
that
.
markerOverlays
);
const
device
=
that
.
createInfowindow
(
"新增"
);
const
device
=
that
.
createInfowindow
(
"新增"
);
device
.
map
=
map
;
device
.
map
=
map
;
device
.
obj
=
e
.
obj
;
device
.
obj
=
e
.
obj
;
device
.
gaoMap
=
that
;
device
.
gaoMap
=
that
;
e
.
obj
.
on
(
"click"
,
function
(
aa
)
{
e
.
obj
.
on
(
"click"
,
function
(
aa
)
{
let
postion
=
aa
.
target
.
_position
;
let
postion
=
aa
.
target
.
_position
;
//兼容拖拽后单击事件,拖拽后点击事件返回位置为数组
//兼容拖拽后单击事件,拖拽后点击事件返回位置为数组
if
(
postion
instanceof
Array
)
{
if
(
postion
instanceof
Array
)
{
...
@@ -962,11 +971,11 @@ class gaodeMap {
...
@@ -962,11 +971,11 @@ class gaodeMap {
}
}
device
.
show
();
device
.
show
();
});
});
e
.
obj
.
on
(
"mouseover"
,
function
()
{
e
.
obj
.
on
(
"mouseover"
,
function
()
{
that
.
mouseTool
.
close
();
that
.
mouseTool
.
close
();
});
});
e
.
obj
.
on
(
"mouseout"
,
function
()
{
e
.
obj
.
on
(
"mouseout"
,
function
()
{
that
.
draw
(
that
.
deviceType
);
that
.
draw
(
that
.
deviceType
);
});
});
...
@@ -1077,7 +1086,7 @@ class gaodeMap {
...
@@ -1077,7 +1086,7 @@ class gaodeMap {
"AMap.MapType"
,
"AMap.MapType"
,
"AMap.Geolocation"
"AMap.Geolocation"
],
],
function
()
{
function
()
{
// 在图面添加工具条控件,工具条控件集成了缩放、平移、定位等功能按钮在内的组合控件
// 在图面添加工具条控件,工具条控件集成了缩放、平移、定位等功能按钮在内的组合控件
//map.addControl(new AMap.ToolBar());
//map.addControl(new AMap.ToolBar());
...
@@ -1100,7 +1109,7 @@ class gaodeMap {
...
@@ -1100,7 +1109,7 @@ class gaodeMap {
searchTips
(
inputId
)
{
searchTips
(
inputId
)
{
let
that
=
this
;
let
that
=
this
;
AMap
.
plugin
([
"AMap.AutoComplete"
,
"AMap.PlaceSearch"
],
function
()
{
AMap
.
plugin
([
"AMap.AutoComplete"
,
"AMap.PlaceSearch"
],
function
()
{
//输入提示
//输入提示
// var autoOptions = {
// var autoOptions = {
// input: inputId
// input: inputId
...
...
This diff is collapsed.
Click to expand it.
gassafety-web/src/views/dataMonitoring/realtimedetail/index.vue
View file @
60e602e6
...
@@ -215,8 +215,8 @@
...
@@ -215,8 +215,8 @@
// this.getData();
// this.getData();
},
},
mounted
()
{
mounted
()
{
let
gaoMap
=
new
gaodeMap
(
"石家庄"
);
//
let gaoMap = new gaodeMap("石家庄");
this
.
gaoMap
=
gaoMap
;
//
this.gaoMap = gaoMap;
this
.
getData
();
this
.
getData
();
},
},
methods
:
{
methods
:
{
...
@@ -585,10 +585,10 @@
...
@@ -585,10 +585,10 @@
this
.
dataListdetail3
.
push
(
obj3
);
this
.
dataListdetail3
.
push
(
obj3
);
this
.
form
=
response
.
data
;
this
.
form
=
response
.
data
;
this
.
active
=
parseInt
(
response
.
data
.
orderStatus
)
+
1
;
this
.
active
=
parseInt
(
response
.
data
.
orderStatus
)
+
1
;
this
.
gaoMap
.
addMarker
(
DEVICE_TYPE
.
WORKORDER
,
this
.
form
,()
=>
{
let
gaoMap
=
new
gaodeMap
(
"石家庄"
,[
this
.
form
.
longitude
,
this
.
form
.
latitude
]);
this
.
gaoMap
.
panTo
([
this
.
form
.
longitude
,
this
.
form
.
latitude
])
;
this
.
gaoMap
=
gaoMap
;
this
.
gaoMap
.
addMarker
(
DEVICE_TYPE
.
WORKORDER
,
this
.
form
)
})
// this.gaoMap.resetMapCenter([this.form.longitude, this.form.latitude]);
console
.
log
(
"this.form.longitude"
,
this
.
form
.
longitude
)
console
.
log
(
"this.form.longitude"
,
this
.
form
.
longitude
)
console
.
log
(
"this.form"
,
this
.
form
)
console
.
log
(
"this.form"
,
this
.
form
)
...
...
This diff is collapsed.
Click to expand it.
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