This commit is contained in:
姚宇浩 2024-07-15 10:07:55 +08:00
parent 5ddba8e3d9
commit 0e800821a3
4 changed files with 16800 additions and 246 deletions

16762
src/assets/json/ly.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,225 +0,0 @@
<template>
<div class="dialogPage">
<el-dialog
v-model="dialogShowMap"
width="80vw"
:show-close="false"
center
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<template #header="{ close, titleId, titleClass }">
<div class="my-header">
<el-icon
size="26"
color="#fff"
@click="closeDialog"
>
<CircleCloseFilled />
</el-icon>
</div>
</template>
<div class="tabelPart">
<div class="bo">
<div class="title">
<div class="title_top">
<img
src="@/assets/images/table_l.png"
alt=""
style="margin-right: 10px"
/>
<div class="name">{{ title }}详情</div>
<img
src="@/assets/images/table_r.png"
alt=""
style="margin-left: 10px"
/>
</div>
<img
class="title_botton"
src="@/assets/images/table_c.png"
alt=""
/>
</div>
</div>
<div style="width: 100%; height: 600px">
<Map2 style="width:100%;height:100%;" ></Map2>
</div>
</div>
</el-dialog>
</div>
</template>
<script setup>
import {
onMounted,
reactive,
ref,
onBeforeMount,
defineProps,
watch,
nextTick,
} from "vue";
import { CircleCloseFilled } from "@element-plus/icons-vue";
import Map from "../echart_analyze/map.vue";
import Map2 from "./echarts/map.vue";
const props = defineProps({
dialogShowMap: {
type: Boolean,
default: () => {
return false;
},
},
title: {
type: String,
default: () => {
return "";
},
},
});
const emit = defineEmits(["close"]);
//
const dialogShowMap = ref();
const data = reactive({
title: "",
list1: [],
list2: [],
year: [],
option: {},
bg: [],
});
//
watch(
() => props.dialogShowMap,
(newVal, oldVal) => {
dialogShowMap.value = newVal;
}
);
watch(
() => props.title,
(newVal, oldVal) => {
data.title = newVal;
}
);
// 使
onMounted(() => {
data.title = props.title;
});
const closeDialog = () => {
dialogShowMap.value = false;
emit("close");
};
</script>
<style lang="scss" scoped>
:deep(.el-dialog) {
--el-dialog-bg-color: none;
--el-dialog-width: 70% !important;
}
.my-header {
display: flex;
flex-direction: row-reverse;
}
.tabelPart {
padding: 16px;
background: linear-gradient(
270deg,
rgba(0, 77, 131, 0.69) 0%,
rgba(0, 51, 83, 0.77) 50%,
rgba(0, 77, 131, 0.74) 100%
),
radial-gradient(
66% 40% at 50% 0%,
rgba(1, 150, 243, 0.55) 0%,
rgba(0, 116, 255, 0) 100%
);
box-shadow: inset 0px 0px 56px 0px rgba(100, 191, 255, 0.5);
border: 2px solid;
border-image: linear-gradient(
180deg,
rgba(21, 150, 255, 1),
rgba(0, 157, 227, 0)
)
2 2;
:deep(.el-table) {
--el-table-bg-color: none;
--el-table-tr-bg-color: none;
--el-table-header-bg-color: none;
background: none;
border: none;
--el-table-text-color: #fff;
--el-table-header-text-color: #fff;
}
}
.pagePart {
height: 40px;
display: flex;
align-items: center;
justify-content: center;
:deep(.el-pagination) {
--el-pagination-button-disabled-bg-color: none;
--el-pagination-bg-color: none;
--el-pagination-button-bg-color: none;
--el-pagination-button-color: #fff;
color: #fff;
}
:deep(.el-pagination button:disabled) {
background-color: rgba(0, 116, 255, 0) !important;
}
:deep(.el-pagination > .is-last) {
color: #ffffff;
}
}
.bo {
width: 100%;
display: flex;
}
.title {
margin: 10px auto;
display: flex;
flex-direction: column;
&_top {
display: flex;
align-items: end;
img {
height: 33px;
width: 33px;
}
.name {
font-family: PangMenZhengDao, PangMenZhengDao;
font-weight: 600;
font-size: 33px;
color: #ffffff;
line-height: 38px;
text-align: center;
font-style: normal;
letter-spacing: 2px;
background: linear-gradient(180deg, #ffffff 0%, #51ffef 100%);
-webkit-background-clip: text;
/*将设置的背景颜色限制在文字中*/
-webkit-text-fill-color: transparent;
/*给文字设置成透明*/
}
}
&_botton {
margin-top: 5px;
height: 19px;
}
}
</style>

View File

@ -7,7 +7,7 @@ import { onMounted, reactive, nextTick, ref, defineProps, watch } from "vue";
// import mapTown from '@/assets/json/330225.json' // import mapTown from '@/assets/json/330225.json'
import m1 from "@/assets/images/map/m1.png"; import m1 from "@/assets/images/map/m1.png";
import m2 from "@/assets/images/map/m2.png"; import m2 from "@/assets/images/map/m2.png";
import mapTown from '@/assets/json/ly.json'
let map = null; let map = null;
// //
const mapTownCount = reactive([ const mapTownCount = reactive([
@ -89,6 +89,7 @@ const mapTownCount = reactive([
]); ]);
// //
const mapTownData = reactive([]); const mapTownData = reactive([]);
const mapTownDataDK = reactive([]);
const initMap = () => { const initMap = () => {
map = new BMapGL.Map("map", { minZoom: 11, maxZoom: 16 }); map = new BMapGL.Map("map", { minZoom: 11, maxZoom: 16 });
map.enableScrollWheelZoom(true); map.enableScrollWheelZoom(true);
@ -106,6 +107,22 @@ const goMapCenter = (point, zoom) => {
map.centerAndZoom(new BMapGL.Point(point[0], point[1]), zoom); map.centerAndZoom(new BMapGL.Point(point[0], point[1]), zoom);
}; };
const loadTown = () => { const loadTown = () => {
for (let v of mapTown.features) {
if (v.geometry.coordinates.length > 1) {
for (let w in v.geometry.coordinates) {
if (v.geometry.coordinates[w][0].length < 60) continue;
mapTownDataDK.push({
name: v.properties.name,
point: v.geometry.coordinates[w][0],
});
}
} else {
mapTownDataDK.push({
name: v.properties.name,
point: v.geometry.coordinates[0],
});
}
}
for (let u of mapTownCount) { for (let u of mapTownCount) {
mapTownData.push({ mapTownData.push({
name: u.name, name: u.name,
@ -121,31 +138,28 @@ const addPolygonCounty = () => {
let fillColor = "#fff"; let fillColor = "#fff";
let arr = []; let arr = [];
mapTownData.map((item) => { mapTownData.map((item) => {
//
// let points = []
//iconlabel
// let iconX = 0,
// iconY = 0,
// labelX = -16,
// labelY = -40
// item.point.map((p) => points.push(new BMapGL.Point(...p)))
// if (points.length) {
//
// let polygon = new BMapGL.Polygon(points, {
// strokeColor: '#395548',
// strokeWeight: 2,
// strokeOpacity: 0.8,
// fillColor: fillColor,
// fillOpacity: 0.5,
// name: item.name
// })
//1 //1
if (!arr.find((v) => v == item.name)) { if (!arr.find((v) => v == item.name)) {
arr.push(item.name); arr.push(item.name);
createCustomOverlay(item); createCustomOverlay(item);
} }
// map.addOverlay(polygon) });
// } mapTownDataDK.map((item) => {
//
let points = [];
item.point.map((p) => points.push(new BMapGL.Point(...p)));
if (points.length) {
//
let polygon = new BMapGL.Polygon(points, {
strokeColor: "#395548",
strokeWeight: 2,
strokeOpacity: 0.8,
fillColor: fillColor,
fillOpacity: 0.5,
name: item.name,
});
map.addOverlay(polygon);
}
}); });
}; };

View File

@ -20,6 +20,9 @@ const initMap = () => {
styleId: "d0acde891abd157741b71e12670ee2e6", styleId: "d0acde891abd157741b71e12670ee2e6",
}); });
goMapCenter([119.178783, 29.034583], 15); goMapCenter([119.178783, 29.034583], 15);
//
// map.addTileLayer(new BMapGL.TrafficLayer());
map.setTrafficOn(); //
}; };
// //