|
@@ -1,5 +1,10 @@
|
|
|
<template>
|
|
|
- <div id="map2DViewer">
|
|
|
+ <div
|
|
|
+ id="map2DViewer"
|
|
|
+ :class="
|
|
|
+ $ifMenu('1', '') || $ifMenu('2', '') ? 'scaleClass' : 'unScaleClass'
|
|
|
+ "
|
|
|
+ >
|
|
|
<!-- 特殊地图属性弹窗 -- 有审计功能 -->
|
|
|
<CaseAuditPopup
|
|
|
v-show="auditPopupShow"
|
|
@@ -743,62 +748,67 @@ export default {
|
|
|
getJSonData() {
|
|
|
if (!map2DViewer.map) {
|
|
|
this.mapInit();
|
|
|
- } else if (
|
|
|
- // 切换到首页和疑点筛查页且图层不存在时重新渲染区域图
|
|
|
- this.$ifMenu("1", "") &&
|
|
|
- !map2DViewer.map.hasLayer(map2DViewer.groups["浦东新区_polygon"])
|
|
|
- ) {
|
|
|
- this.getJSonDataToStreet("", "");
|
|
|
- // 切换到首页时需定位到当前图层
|
|
|
- if (this.$store.state.homeSpecialTown === "全部") {
|
|
|
- this.setView(
|
|
|
- townLocationMap.get(this.$store.state.homeSpecialTown),
|
|
|
- 1
|
|
|
- );
|
|
|
- } else {
|
|
|
- let polygon = townPolygonMap.get(this.$store.state.homeSpecialTown);
|
|
|
- map2DViewer.map.fitBounds(polygon.getBounds());
|
|
|
- }
|
|
|
- } else if (this.$ifMenu("2", "5")) {
|
|
|
- this.getJSonDataToStreet("", "");
|
|
|
- // 切换到镇域专题是时均往左偏移一些
|
|
|
- if (this.$store.state.homeSpecialTown === "全部") {
|
|
|
- let locationArr = townLocationMap.get(
|
|
|
- this.$store.state.homeSpecialTown
|
|
|
- );
|
|
|
- this.setView([locationArr[0], locationArr[1] + 0.15], 1);
|
|
|
- } else {
|
|
|
- let locationArr = townLocationMap.get(
|
|
|
- this.$store.state.homeSpecialTown
|
|
|
- );
|
|
|
- this.setView([locationArr[0], locationArr[1]], 5);
|
|
|
- // let polygon = townPolygonMap.get(this.$store.state.homeSpecialTown);
|
|
|
- // map2DViewer.map.fitBounds(polygon.getBounds());
|
|
|
- }
|
|
|
- } else if (
|
|
|
- this.$ifMenu("2", "1") ||
|
|
|
- this.$ifMenu("2", "2") ||
|
|
|
- this.$ifMenu("2", "3") ||
|
|
|
- this.$ifMenu("2", "4")
|
|
|
- ) {
|
|
|
- this.getJSonDataToStreet("", "");
|
|
|
- // 切换到疑点筛查时均往右偏移一些
|
|
|
- if (this.$store.state.homeSpecialTown === "全部") {
|
|
|
- this.setView(
|
|
|
- townLocationMap.get(this.$store.state.homeSpecialTown),
|
|
|
- 1
|
|
|
- );
|
|
|
- } else {
|
|
|
- let polygon = townPolygonMap.get(this.$store.state.homeSpecialTown);
|
|
|
- map2DViewer.map.fitBounds(polygon.getBounds());
|
|
|
+ } else {
|
|
|
+ if (
|
|
|
+ // 切换到首页和疑点筛查页且图层不存在时重新渲染区域图
|
|
|
+ this.$ifMenu("1", "") &&
|
|
|
+ !map2DViewer.map.hasLayer(map2DViewer.groups["浦东新区_polygon"])
|
|
|
+ ) {
|
|
|
+ this.getJSonDataToStreet("", "");
|
|
|
+ // 切换到首页时需定位到当前图层
|
|
|
+ if (this.$store.state.homeSpecialTown === "全部") {
|
|
|
+ this.setView(
|
|
|
+ townLocationMap.get(this.$store.state.homeSpecialTown),
|
|
|
+ 1
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ let polygon = townPolygonMap.get(this.$store.state.homeSpecialTown);
|
|
|
+ map2DViewer.map.fitBounds(polygon.getBounds());
|
|
|
+ }
|
|
|
+ } else if (this.$ifMenu("2", "5")) {
|
|
|
+ this.getJSonDataToStreet("", "");
|
|
|
+ // 切换到镇域专题是时均往左偏移一些
|
|
|
+ if (this.$store.state.homeSpecialTown === "全部") {
|
|
|
+ let locationArr = townLocationMap.get(
|
|
|
+ this.$store.state.homeSpecialTown
|
|
|
+ );
|
|
|
+ this.setView([locationArr[0], locationArr[1] + 0.15], 1);
|
|
|
+ } else {
|
|
|
+ let locationArr = townLocationMap.get(
|
|
|
+ this.$store.state.homeSpecialTown
|
|
|
+ );
|
|
|
+ this.setView([locationArr[0], locationArr[1]], 5);
|
|
|
+ // let polygon = townPolygonMap.get(this.$store.state.homeSpecialTown);
|
|
|
+ // map2DViewer.map.fitBounds(polygon.getBounds());
|
|
|
+ }
|
|
|
+ } else if (
|
|
|
+ this.$ifMenu("2", "1") ||
|
|
|
+ this.$ifMenu("2", "2") ||
|
|
|
+ this.$ifMenu("2", "3") ||
|
|
|
+ this.$ifMenu("2", "4")
|
|
|
+ ) {
|
|
|
+ this.getJSonDataToStreet("", "");
|
|
|
+ // 切换到疑点筛查时均往右偏移一些
|
|
|
+ if (this.$store.state.homeSpecialTown === "全部") {
|
|
|
+ this.setView(
|
|
|
+ townLocationMap.get(this.$store.state.homeSpecialTown),
|
|
|
+ 1
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ let polygon = townPolygonMap.get(this.$store.state.homeSpecialTown);
|
|
|
+ map2DViewer.map.fitBounds(polygon.getBounds());
|
|
|
+ }
|
|
|
+ } else if (
|
|
|
+ !(this.$ifMenu("1", "") || this.$ifMenu("2", "")) &&
|
|
|
+ map2DViewer.map.hasLayer(map2DViewer.groups["浦东新区_polygon"])
|
|
|
+ ) {
|
|
|
+ // 当前页不是首页和疑点筛查页时移除区域图且图层存在时
|
|
|
+ map2DViewer.groups["浦东新区_label"].remove();
|
|
|
+ map2DViewer.groups["浦东新区_polygon"].remove();
|
|
|
}
|
|
|
- } else if (
|
|
|
- !(this.$ifMenu("1", "") || this.$ifMenu("2", "")) &&
|
|
|
- map2DViewer.map.hasLayer(map2DViewer.groups["浦东新区_polygon"])
|
|
|
- ) {
|
|
|
- // 当前页不是首页和疑点筛查页时移除区域图且图层存在时
|
|
|
- map2DViewer.groups["浦东新区_label"].remove();
|
|
|
- map2DViewer.groups["浦东新区_polygon"].remove();
|
|
|
+ setTimeout(() => {
|
|
|
+ map2DViewer.map.invalidateSize(true);
|
|
|
+ }, 500);
|
|
|
}
|
|
|
},
|
|
|
setView: function (coord, zoom) {
|
|
@@ -1132,12 +1142,21 @@ export default {
|
|
|
<style lang="less" scoped>
|
|
|
#map2DViewer {
|
|
|
position: absolute;
|
|
|
- width: 200vw;
|
|
|
- height: 200vh;
|
|
|
background-color: rgb(0, 47, 71);
|
|
|
z-index: 1;
|
|
|
+}
|
|
|
+.scaleClass {
|
|
|
+ width: 200vw;
|
|
|
+ height: 200vh;
|
|
|
top: -50vh;
|
|
|
left: -50vw;
|
|
|
- transform:scale(0.62);
|
|
|
+ transform: scale(0.62);
|
|
|
+}
|
|
|
+.unScaleClass {
|
|
|
+ width: 100vw;
|
|
|
+ height: calc(100vh - 60px);
|
|
|
+ top: 60px;
|
|
|
+ left: 0px;
|
|
|
+ transform: scale(1);
|
|
|
}
|
|
|
</style>
|