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
e78898a0
Commit
e78898a0
authored
Aug 31, 2021
by
纪泽龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gis地图优化,地图模式优化以及解决一个编辑过程中的bug
parent
304d92e7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
9 deletions
+25
-9
gaodeMap.js
gassafety-web/src/utils/gaodeMap.js
+7
-4
gaodeMapView.js
gassafety-web/src/utils/gaodeMapView.js
+6
-0
index.vue
gassafety-web/src/views/enterprise/mapView/index.vue
+12
-5
No files found.
gassafety-web/src/utils/gaodeMap.js
View file @
e78898a0
...
@@ -330,7 +330,7 @@ class gaodeMap {
...
@@ -330,7 +330,7 @@ class gaodeMap {
}
}
// 如果是新建状态 不出弹框
// 如果是新建状态 不出弹框
if
(
this
.
view
.
targetNum
==
1
)
return
;
if
(
this
.
view
.
targetNum
==
1
)
return
;
console
.
log
(
e
.
target
)
let
options
=
map
.
getStatus
();
let
options
=
map
.
getStatus
();
options
.
scrollWheel
=
false
;
options
.
scrollWheel
=
false
;
map
.
setStatus
(
options
);
map
.
setStatus
(
options
);
...
@@ -640,10 +640,13 @@ class gaodeMap {
...
@@ -640,10 +640,13 @@ class gaodeMap {
// 如果是戍边浮动出现infowindow 就让窗口在固定的位置出现,这样就不显得乱了
// 如果是戍边浮动出现infowindow 就让窗口在固定的位置出现,这样就不显得乱了
if
(
e
.
type
==
"mouseover"
)
{
if
(
e
.
type
==
"mouseover"
)
{
const
{
coordinates
}
=
polyline
.
getExtData
().
lineData
;
const
coordinates
=
polyline
.
getPath
().
map
(
item
=>
{
return
[
item
.
lng
,
item
.
lat
]
})
// const { coordinates } = polyline.getExtData().lineData;
// 计算出前两个点的中点
// 计算出前两个点的中点
const
arr1
=
eval
(
coordinates
)
[
0
];
const
arr1
=
coordinates
[
0
];
const
arr2
=
eval
(
coordinates
)
[
1
];
const
arr2
=
coordinates
[
1
];
const
a
=
this
.
centerNum
(
arr1
[
0
],
arr2
[
0
]);
const
a
=
this
.
centerNum
(
arr1
[
0
],
arr2
[
0
]);
const
b
=
this
.
centerNum
(
arr1
[
1
],
arr2
[
1
]);
const
b
=
this
.
centerNum
(
arr1
[
1
],
arr2
[
1
]);
const
a2
=
this
.
centerNum
(
a
,
arr1
[
0
]);
const
a2
=
this
.
centerNum
(
a
,
arr1
[
0
]);
...
...
gassafety-web/src/utils/gaodeMapView.js
View file @
e78898a0
...
@@ -54,6 +54,8 @@ class gaodeMap {
...
@@ -54,6 +54,8 @@ class gaodeMap {
view
=
null
;
view
=
null
;
handleInfoWindowOpenFunc
=
null
;
handleInfoWindowOpenFunc
=
null
;
onceFlag
=
false
;
onceFlag
=
false
;
用来判断点击左边抽屉列表的时候移动才消失
leftListClick
=
false
;
//构造函数中设置中央点默认值
//构造函数中设置中央点默认值
constructor
(
center
)
{
constructor
(
center
)
{
this
.
markers
=
[];
this
.
markers
=
[];
...
@@ -99,6 +101,10 @@ class gaodeMap {
...
@@ -99,6 +101,10 @@ class gaodeMap {
// 地图开始平移删除infowindow
// 地图开始平移删除infowindow
this
.
myMap
.
on
(
"movestart"
,
()
=>
{
this
.
myMap
.
on
(
"movestart"
,
()
=>
{
// console.log("地图平移");
// console.log("地图平移");
if
(
this
.
leftListClick
)
{
console
.
log
(
"moveStart"
);
this
.
closeInfoWindow
();
}
// this.closeInfoWindow();
// this.closeInfoWindow();
});
});
...
...
gassafety-web/src/views/enterprise/mapView/index.vue
View file @
e78898a0
...
@@ -89,7 +89,7 @@
...
@@ -89,7 +89,7 @@
ref=
"drawer"
ref=
"drawer"
class=
"drawer"
class=
"drawer"
:class=
"{ back: backFlag, opacity: drawerOpacity }"
:class=
"{ back: backFlag, opacity: drawerOpacity }"
@
mousedown
=
"drawerClick"
@
click
.
stop
=
"drawerClick"
>
>
<div
class=
"switch"
@
click=
"backFlag = !backFlag"
>
<div
class=
"switch"
@
click=
"backFlag = !backFlag"
>
<img
v-if=
"!backFlag"
src=
"@/assets/images/l.png"
alt=
""
/>
<img
v-if=
"!backFlag"
src=
"@/assets/images/l.png"
alt=
""
/>
...
@@ -165,7 +165,7 @@
...
@@ -165,7 +165,7 @@
:class=
"
{ topActive: index == 0 }"
:class=
"
{ topActive: index == 0 }"
v-for="(iten, index) in item.list"
v-for="(iten, index) in item.list"
:key="iten.deviceId + `` + index"
:key="iten.deviceId + `` + index"
@click="panToo(iten, item)"
@click
.stop
="panToo(iten, item)"
>
>
<div
class=
"no"
>
{{
iten
.
no
+
1
}}
</div>
<div
class=
"no"
>
{{
iten
.
no
+
1
}}
</div>
<div
:title=
"iten.code"
class=
"code"
>
<div
:title=
"iten.code"
class=
"code"
>
...
@@ -190,7 +190,7 @@
...
@@ -190,7 +190,7 @@
:class=
"
{ topActive: index == 0 }"
:class=
"
{ topActive: index == 0 }"
v-for="(iten, index) in item.list"
v-for="(iten, index) in item.list"
:key="iten.deviceId + `` + index"
:key="iten.deviceId + `` + index"
@click="panToo(iten, item)"
@click
.stop
="panToo(iten, item)"
>
>
<div
class=
"no"
>
{{
iten
.
no
+
1
}}
</div>
<div
class=
"no"
>
{{
iten
.
no
+
1
}}
</div>
<div
:title=
"iten.troubleLevel"
class=
"code"
>
<div
:title=
"iten.troubleLevel"
class=
"code"
>
...
@@ -215,7 +215,7 @@
...
@@ -215,7 +215,7 @@
:class=
"
{ topActive: index == 0 }"
:class=
"
{ topActive: index == 0 }"
v-for="(iten, index) in item.list"
v-for="(iten, index) in item.list"
:key="iten.deviceId + `` + index"
:key="iten.deviceId + `` + index"
@click="panToo(iten, item)"
@click
.stop
="panToo(iten, item)"
>
>
<div
class=
"no"
>
{{
iten
.
no
+
1
}}
</div>
<div
class=
"no"
>
{{
iten
.
no
+
1
}}
</div>
<div
:title=
"iten.userName"
class=
"code"
>
<div
:title=
"iten.userName"
class=
"code"
>
...
@@ -820,6 +820,8 @@ export default {
...
@@ -820,6 +820,8 @@ export default {
panToo
(
iten
,
item
)
{
panToo
(
iten
,
item
)
{
// 如果没打对勾,就啥也不干
// 如果没打对勾,就啥也不干
if
(
!
this
.
leftBarNum
.
includes
(
item
.
value
))
return
;
if
(
!
this
.
leftBarNum
.
includes
(
item
.
value
))
return
;
// 点击的时候允许infowindow消失
this
.
gaoMap
.
leftListClick
=
true
;
// 如果地图太大了就吸纳是不出来infowindow了,所以要固定缩放比例
// 如果地图太大了就吸纳是不出来infowindow了,所以要固定缩放比例
// 所有线条颜色还原
// 所有线条颜色还原
this
.
gaoMap
.
polyLinesColorClear
();
this
.
gaoMap
.
polyLinesColorClear
();
...
@@ -882,6 +884,7 @@ export default {
...
@@ -882,6 +884,7 @@ export default {
iten
.
infoPath
[
1
]
-
(
lat
+
0.1
)
>=
0
&&
iten
.
infoPath
[
1
]
-
(
lat
+
0.1
)
>=
0
&&
iten
.
infoPath
[
1
]
-
(
lat
+
0.1
)
<=
0.00001
iten
.
infoPath
[
1
]
-
(
lat
+
0.1
)
<=
0.00001
)
{
)
{
this
.
gaoMap
.
leftListClick
=
false
;
this
.
gaoMap
.
polylineMouseOver
(
e
);
this
.
gaoMap
.
polylineMouseOver
(
e
);
target
.
setOptions
({
strokeColor
:
"#F7FE38"
});
target
.
setOptions
({
strokeColor
:
"#F7FE38"
});
return
;
return
;
...
@@ -905,6 +908,7 @@ export default {
...
@@ -905,6 +908,7 @@ export default {
};
};
// 如果是原地不动,就直接执行
// 如果是原地不动,就直接执行
if
(
iten
.
path
[
0
]
==
lng
&&
iten
.
path
[
1
]
==
lat
+
0.1
)
{
if
(
iten
.
path
[
0
]
==
lng
&&
iten
.
path
[
1
]
==
lat
+
0.1
)
{
this
.
gaoMap
.
leftListClick
=
false
;
this
.
gaoMap
.
infoOpen
(
e
);
this
.
gaoMap
.
infoOpen
(
e
);
return
;
return
;
}
}
...
@@ -925,7 +929,7 @@ export default {
...
@@ -925,7 +929,7 @@ export default {
};
};
// 如果是原地不动,就直接执行
// 如果是原地不动,就直接执行
if
(
iten
.
path
[
0
]
==
lng
&&
iten
.
path
[
1
]
==
lat
+
0.1
)
{
if
(
iten
.
path
[
0
]
==
lng
&&
iten
.
path
[
1
]
==
lat
+
0.1
)
{
console
.
log
(
"??????"
)
;
this
.
gaoMap
.
leftListClick
=
false
;
this
.
gaoMap
.
troubleOpen
(
e
);
this
.
gaoMap
.
troubleOpen
(
e
);
return
;
return
;
}
}
...
@@ -947,6 +951,7 @@ export default {
...
@@ -947,6 +951,7 @@ export default {
};
};
// 如果是原地不动,就直接执行
// 如果是原地不动,就直接执行
if
(
iten
.
path
[
0
]
==
lng
&&
iten
.
path
[
1
]
==
lat
+
0.1
)
{
if
(
iten
.
path
[
0
]
==
lng
&&
iten
.
path
[
1
]
==
lat
+
0.1
)
{
this
.
gaoMap
.
leftListClick
=
false
;
this
.
gaoMap
.
wokerManOpen
(
e
);
this
.
gaoMap
.
wokerManOpen
(
e
);
return
;
return
;
}
}
...
@@ -1373,7 +1378,9 @@ export default {
...
@@ -1373,7 +1378,9 @@ export default {
this
.
troubleObj
=
obj
;
this
.
troubleObj
=
obj
;
},
},
drawerClick
()
{
drawerClick
()
{
console
.
log
(
"drawerClick"
);
this
.
gaoMap
.
polyLinesColorClear
();
this
.
gaoMap
.
polyLinesColorClear
();
this
.
gaoMap
.
closeInfoWindow
();
this
.
gaoMap
.
closeInfoWindow
();
},
},
},
},
...
...
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