2026-03-31 18:10:34 +08:00
|
|
|
|
<template>
|
2026-04-21 15:34:43 +08:00
|
|
|
|
<!-- 检查URL参数中是否有Map=dev,如果有,则使用本地地图数据,否则使用阿里云地图数据 -->
|
2026-03-31 18:10:34 +08:00
|
|
|
|
<div class="chongqing-map-container">
|
|
|
|
|
|
<div ref="mapContainer" class="map-container"></div>
|
|
|
|
|
|
<div v-if="loading" class="loading-overlay">
|
|
|
|
|
|
<div class="loading-spinner"></div>
|
|
|
|
|
|
<span class="loading-text">地图加载中...</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div v-if="error" class="error-overlay">
|
|
|
|
|
|
<span class="error-text">{{ error }}</span>
|
|
|
|
|
|
<button class="retry-btn" @click="loadMapData">重试</button>
|
|
|
|
|
|
</div>
|
2026-05-07 09:32:05 +08:00
|
|
|
|
<mapInfoDialog v-model:visible="mapInfoDialogVisible" :type="mapInfoDialogType" :data="mapInfoDialogData" />
|
2026-04-13 11:38:11 +08:00
|
|
|
|
<centerInfoCard
|
|
|
|
|
|
:visible="centerCardVisible"
|
|
|
|
|
|
:title="centerCardTitle"
|
|
|
|
|
|
:dataList="centerCardDataList"
|
|
|
|
|
|
@close="closeCenterCard"
|
|
|
|
|
|
@itemClick="handleCenterCardItemClick"
|
|
|
|
|
|
@click="handleCenterCardClick"
|
|
|
|
|
|
/>
|
2026-04-17 14:50:25 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
<hazardPointSituationDialog v-model:visible="hazardPointSituationDialogVisible" :data="{}" @close="closeHazardPointSituationDialog" />
|
2026-03-31 18:10:34 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2026-05-07 09:32:05 +08:00
|
|
|
|
import { ref, onMounted, onUnmounted, watch, defineExpose, h, render } from 'vue'
|
|
|
|
|
|
import axios from 'axios'
|
|
|
|
|
|
import { request } from '@/utils/request'
|
|
|
|
|
|
|
|
|
|
|
|
import projectIcon from '../../../assets/MaMap_img/项目@2x.png'
|
|
|
|
|
|
import bridgeIcon from '../../../assets/MaMap_img/桥梁icon@2x.png'
|
|
|
|
|
|
import tunnelIcon from '../../../assets/MaMap_img/蓝色@2x1.png'
|
|
|
|
|
|
import tunnelIcon2 from '../../../assets/MaMap_img/隧洞icon@2x.png'
|
|
|
|
|
|
import rescueTeamIcon from '../../../assets/MaMap_img/队伍icon@2x.png'
|
|
|
|
|
|
import engineeringIconIcon from '../../../assets/MaMap_img/危大工程icon@2x.png'
|
|
|
|
|
|
|
|
|
|
|
|
import hazardIconIcon1 from '../../../assets/MaMap_img/一般路内隐患点@2x.png'
|
|
|
|
|
|
import hazardIconIcon2 from '../../../assets/MaMap_img/一般路外隐患点@2x.png'
|
|
|
|
|
|
import hazardIconIcon3 from '../../../assets/MaMap_img/较大路内隐患点@2x.png'
|
|
|
|
|
|
import hazardIconIcon4 from '../../../assets/MaMap_img/较大路外隐患点@2x.png'
|
|
|
|
|
|
import hazardIconIcon5 from '../../../assets/MaMap_img/重大路内隐患点@2x.png'
|
|
|
|
|
|
import hazardIconIcon6 from '../../../assets/MaMap_img/重大路外隐患点@2x.png'
|
|
|
|
|
|
|
|
|
|
|
|
import tunnelLineIcon3 from '../../../assets/MaMap_img/高风险路段@2x.png'
|
|
|
|
|
|
import tunnelLineIcon2 from '../../../assets/MaMap_img/较高风险路段@2x.png'
|
|
|
|
|
|
import tunnelLineIcon1 from '../../../assets/MaMap_img/中风险路段@2x.png'
|
|
|
|
|
|
import tunnelLineIcon from '../../../assets/MaMap_img/线路icon定位@2x.png'
|
|
|
|
|
|
|
|
|
|
|
|
import mapInfoDialog from '../Dialog/mapInfoDialog.vue'
|
|
|
|
|
|
import centerInfoCard from '../Dialog/centerInfoCard.vue'
|
|
|
|
|
|
import hazardPointSituationDialog from '../Dialog/hazardPointSituationDialog.vue'
|
|
|
|
|
|
import I from '../../../../dist/cesium/Workers/upsampleVerticesFromCesium3DTilesTerrain'
|
|
|
|
|
|
|
|
|
|
|
|
const mapContainer = ref(null)
|
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
|
const error = ref(null)
|
|
|
|
|
|
let mapInstance = null
|
|
|
|
|
|
let geoJsonLayer = null
|
2026-03-31 18:10:34 +08:00
|
|
|
|
|
2026-04-08 18:47:57 +08:00
|
|
|
|
const props = defineProps({
|
2026-04-15 16:40:35 +08:00
|
|
|
|
activeitem: {
|
|
|
|
|
|
type: Object,
|
|
|
|
|
|
default: () => {},
|
2026-04-08 18:47:57 +08:00
|
|
|
|
},
|
2026-04-09 14:53:44 +08:00
|
|
|
|
dateRange: {
|
|
|
|
|
|
type: Array,
|
|
|
|
|
|
default: () => [],
|
|
|
|
|
|
},
|
2026-04-15 16:40:35 +08:00
|
|
|
|
roadItem: {
|
|
|
|
|
|
// 路段项 数据 主要是选中的路段等级
|
|
|
|
|
|
type: Object,
|
2026-04-17 14:50:25 +08:00
|
|
|
|
default: () => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
label: '高风险',
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-17 14:50:25 +08:00
|
|
|
|
},
|
2026-04-15 16:40:35 +08:00
|
|
|
|
},
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
2026-04-17 14:50:25 +08:00
|
|
|
|
watch(
|
|
|
|
|
|
() => props.roadItem,
|
|
|
|
|
|
async (newVal, oldVal) => {
|
2026-04-29 18:27:03 +08:00
|
|
|
|
console.log('newVal', newVal)
|
2026-05-07 09:32:05 +08:00
|
|
|
|
getAffectedRoadSectionData(false)
|
2026-04-17 14:50:25 +08:00
|
|
|
|
},
|
2026-05-07 09:32:05 +08:00
|
|
|
|
{ immediate: true },
|
|
|
|
|
|
)
|
2026-04-02 16:35:45 +08:00
|
|
|
|
// 定义 emits
|
2026-04-13 11:38:11 +08:00
|
|
|
|
const emit = defineEmits([
|
2026-04-17 14:50:25 +08:00
|
|
|
|
'districtClick',
|
|
|
|
|
|
'openTongnanTeam',
|
|
|
|
|
|
'openResponseSituation',
|
|
|
|
|
|
'openTongnanResponsible',
|
|
|
|
|
|
'riskPointStatsChange',
|
|
|
|
|
|
'update:roadvalArr',
|
|
|
|
|
|
'openHazardPointSituation',
|
2026-04-29 10:33:26 +08:00
|
|
|
|
'openRoadSectionSituation',
|
2026-05-07 09:32:05 +08:00
|
|
|
|
])
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
|
|
|
|
|
// 当前选中的区县
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const selectedDistrict = ref(null)
|
|
|
|
|
|
let selectedLayer = null
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
2026-04-08 18:47:57 +08:00
|
|
|
|
// 地图信息弹窗
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const mapInfoDialogVisible = ref(false)
|
|
|
|
|
|
const mapInfoDialogType = ref('project')
|
|
|
|
|
|
const mapInfoDialogData = ref({})
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
2026-04-13 11:38:11 +08:00
|
|
|
|
// 中心信息卡片弹窗
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const centerCardVisible = ref(false)
|
|
|
|
|
|
const centerCardTitle = ref('调度统计')
|
|
|
|
|
|
const centerCardDataList = ref([])
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 地图上显示的区县卡片标记
|
2026-05-07 09:32:05 +08:00
|
|
|
|
let countyCardMarkers = []
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
2026-04-08 18:47:57 +08:00
|
|
|
|
// 打开地图信息弹窗
|
|
|
|
|
|
const openMapInfoDialog = (type, data) => {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
mapInfoDialogType.value = type
|
|
|
|
|
|
mapInfoDialogData.value = data
|
|
|
|
|
|
mapInfoDialogVisible.value = true
|
|
|
|
|
|
}
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
2026-04-13 11:38:11 +08:00
|
|
|
|
// 清除地图上的区县卡片标记
|
|
|
|
|
|
const clearCountyCardMarkers = () => {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
countyCardMarkers.forEach((marker) => {
|
2026-04-13 11:38:11 +08:00
|
|
|
|
// 清理 Vue 组件
|
|
|
|
|
|
if (marker._vueContainer) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
render(null, marker._vueContainer)
|
2026-04-13 11:38:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (mapInstance) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
mapInstance.removeLayer(marker)
|
2026-04-13 11:38:11 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
|
|
|
|
|
countyCardMarkers = []
|
|
|
|
|
|
}
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 在地图上显示区县卡片
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const showCountyCardsOnMap = (dataList) => {
|
2026-04-13 11:38:11 +08:00
|
|
|
|
if (!mapInstance || !geoJsonLayer) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.warn('地图未初始化,无法显示区县卡片')
|
|
|
|
|
|
return
|
2026-04-13 11:38:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 清除之前的卡片标记
|
2026-05-07 09:32:05 +08:00
|
|
|
|
clearCountyCardMarkers()
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
if (!dataList || dataList.length === 0) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
return
|
2026-04-13 11:38:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 简化区县名称
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const simplifyName = (name) => {
|
|
|
|
|
|
return name.replace('土家族苗族自治县', '').replace('苗族土家族自治县', '').replace('自治县', '').replace('区', '').replace('县', '')
|
|
|
|
|
|
}
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 遍历数据列表,为每个区县创建卡片
|
2026-05-07 09:32:05 +08:00
|
|
|
|
dataList.forEach((item) => {
|
2026-04-21 15:34:43 +08:00
|
|
|
|
// if (j.countyName === item.countyName) {
|
|
|
|
|
|
// item = j;
|
|
|
|
|
|
// }
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const countyName = item.countyName || item.name
|
|
|
|
|
|
if (!countyName) return
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const targetName = simplifyName(countyName)
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 查找对应的区县图层
|
2026-05-07 09:32:05 +08:00
|
|
|
|
let targetLayer = null
|
|
|
|
|
|
geoJsonLayer.eachLayer((layer) => {
|
|
|
|
|
|
const layerName = layer.feature?.properties?.name || ''
|
2026-04-13 11:38:11 +08:00
|
|
|
|
if (simplifyName(layerName) === targetName) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
targetLayer = layer
|
2026-04-13 11:38:11 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
if (targetLayer) {
|
|
|
|
|
|
// 获取区县的中心点
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const bounds = targetLayer.getBounds()
|
|
|
|
|
|
const center = bounds.getCenter()
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 创建一个容器元素用于挂载 Vue 组件
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const container = document.createElement('div')
|
|
|
|
|
|
container.className = 'county-card-wrapper'
|
2026-04-13 11:38:11 +08:00
|
|
|
|
// 使用 Vue 的 h 函数创建组件虚拟节点
|
|
|
|
|
|
const vnode = h(centerInfoCard, {
|
|
|
|
|
|
visible: true,
|
|
|
|
|
|
title: countyName,
|
|
|
|
|
|
dataList: [item],
|
|
|
|
|
|
item: item,
|
|
|
|
|
|
onClose: () => {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
closeCenterCard()
|
2026-04-13 11:38:11 +08:00
|
|
|
|
},
|
2026-05-07 09:32:05 +08:00
|
|
|
|
onItemClick: (clickedItem) => {
|
|
|
|
|
|
handleCenterCardItemClick(clickedItem)
|
2026-04-13 11:38:11 +08:00
|
|
|
|
},
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 渲染组件到容器
|
2026-05-07 09:32:05 +08:00
|
|
|
|
render(vnode, container)
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 创建自定义图标,使用渲染后的 HTML
|
|
|
|
|
|
const customIcon = window.L.divIcon({
|
2026-04-17 14:50:25 +08:00
|
|
|
|
className: 'county-card-icon',
|
2026-04-13 11:38:11 +08:00
|
|
|
|
html: container.innerHTML,
|
2026-04-15 16:40:35 +08:00
|
|
|
|
iconSize: [140, 40],
|
2026-04-13 11:38:11 +08:00
|
|
|
|
iconAnchor: [110, 60],
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 创建标记
|
|
|
|
|
|
const marker = window.L.marker(center, {
|
|
|
|
|
|
icon: customIcon,
|
|
|
|
|
|
interactive: true,
|
2026-04-21 15:34:43 +08:00
|
|
|
|
zIndexOffset: 2000, // 提升区县卡片层级,确保在最上层
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 添加点击事件到 marker
|
2026-04-17 14:50:25 +08:00
|
|
|
|
marker.on('click', () => {
|
2026-04-13 11:38:11 +08:00
|
|
|
|
// 调用处理函数
|
2026-05-07 09:32:05 +08:00
|
|
|
|
handleCenterCardItemClick(item)
|
2026-04-13 11:38:11 +08:00
|
|
|
|
// 移动地图到该位置
|
2026-04-16 14:03:39 +08:00
|
|
|
|
// mapInstance.setView(center, 10);
|
2026-04-13 11:38:11 +08:00
|
|
|
|
// 触发点击事件
|
2026-04-17 14:50:25 +08:00
|
|
|
|
emit('districtClick', {
|
2026-04-13 11:38:11 +08:00
|
|
|
|
name: countyName,
|
|
|
|
|
|
data: item,
|
2026-04-13 14:54:48 +08:00
|
|
|
|
type: item.type,
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
|
|
|
|
|
})
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
marker.addTo(mapInstance)
|
|
|
|
|
|
countyCardMarkers.push(marker)
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 保存容器引用以便后续清理
|
2026-05-07 09:32:05 +08:00
|
|
|
|
marker._vueContainer = container
|
2026-04-13 11:38:11 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 调整地图视角以显示所有卡片
|
2026-04-16 14:03:39 +08:00
|
|
|
|
// if (countyCardMarkers.length > 0) {
|
|
|
|
|
|
// const group = new window.L.featureGroup(countyCardMarkers);
|
|
|
|
|
|
// mapInstance.fitBounds(group.getBounds().pad(0.2));
|
|
|
|
|
|
// }
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 获取公路类型文本
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const getRoadTypeText = (roadType) => {
|
2026-04-13 11:38:11 +08:00
|
|
|
|
const roadTypeMap = {
|
2026-04-17 14:50:25 +08:00
|
|
|
|
national: '国省道',
|
|
|
|
|
|
rural: '农村公路',
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
return roadTypeMap[roadType] || roadType
|
|
|
|
|
|
}
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 打开中心信息卡片弹窗
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const openCenterCard = (data) => {
|
|
|
|
|
|
centerCardDataList.value = data.dataList || []
|
|
|
|
|
|
centerCardTitle.value = data.title || '调度统计'
|
|
|
|
|
|
centerCardVisible.value = true
|
|
|
|
|
|
let affectedItems = []
|
2026-04-21 15:34:43 +08:00
|
|
|
|
// 遍历数据列表,只有影响区域的区县才添加到受影响列表中
|
2026-05-07 09:32:05 +08:00
|
|
|
|
data.dataList.forEach((item) => {
|
2026-04-21 15:34:43 +08:00
|
|
|
|
if (item.countyName && (item.countyName.includes('渝北') || item.countyName.includes('江北'))) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
item.countyName = '两江新区'
|
2026-04-21 15:34:43 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
affectedCountyData.value.sortedList.forEach((j) => {
|
2026-04-21 15:34:43 +08:00
|
|
|
|
if (item.countyName.includes(j.name)) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
affectedItems.push(item)
|
2026-04-21 15:34:43 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
|
|
|
|
|
})
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 在地图上显示区县卡片
|
2026-05-07 09:32:05 +08:00
|
|
|
|
showCountyCardsOnMap(affectedItems)
|
|
|
|
|
|
}
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 关闭中心信息卡片弹窗
|
|
|
|
|
|
const closeCenterCard = () => {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
centerCardVisible.value = false
|
|
|
|
|
|
clearCountyCardMarkers()
|
|
|
|
|
|
}
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 处理中心卡片项点击
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const handleCenterCardItemClick = (item) => {
|
|
|
|
|
|
console.log('点击了卡片项:', item)
|
2026-04-13 11:38:11 +08:00
|
|
|
|
// 根据区县名称定位地图
|
|
|
|
|
|
if (item.countyName || item.name) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const countyName = item.countyName || item.name
|
|
|
|
|
|
locateToDistrict(countyName)
|
2026-04-13 11:38:11 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
2026-04-08 18:47:57 +08:00
|
|
|
|
// 打开隧道信息弹窗(兼容旧代码)
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const openTunnelDialog = (data) => {
|
|
|
|
|
|
openMapInfoDialog('tunnel', data)
|
|
|
|
|
|
}
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
2026-04-09 14:53:44 +08:00
|
|
|
|
// 格式化日期时间为接口所需格式
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const formatDateTime = (date) => {
|
|
|
|
|
|
if (!date) return ''
|
|
|
|
|
|
const d = new Date(date)
|
|
|
|
|
|
const year = d.getFullYear()
|
|
|
|
|
|
const month = String(d.getMonth() + 1).padStart(2, '0')
|
|
|
|
|
|
const day = String(d.getDate()).padStart(2, '0')
|
|
|
|
|
|
const hours = String(d.getHours()).padStart(2, '0')
|
|
|
|
|
|
const minutes = String(d.getMinutes()).padStart(2, '0')
|
|
|
|
|
|
const seconds = String(d.getSeconds()).padStart(2, '0')
|
|
|
|
|
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
|
|
|
|
|
}
|
2026-04-09 14:53:44 +08:00
|
|
|
|
|
|
|
|
|
|
// 获取时间参数
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const getTimeParams = (type) => {
|
|
|
|
|
|
let start = ''
|
|
|
|
|
|
let end = ''
|
2026-04-09 14:53:44 +08:00
|
|
|
|
if (props.dateRange && props.dateRange.length === 2) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
start = formatDateTime(props.dateRange[0]) || ''
|
|
|
|
|
|
end = formatDateTime(props.dateRange[1]) || ''
|
2026-04-15 16:40:35 +08:00
|
|
|
|
}
|
2026-04-09 14:53:44 +08:00
|
|
|
|
return {
|
2026-04-15 16:40:35 +08:00
|
|
|
|
start: start,
|
|
|
|
|
|
end: end,
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-04-09 14:53:44 +08:00
|
|
|
|
|
2026-04-08 15:34:49 +08:00
|
|
|
|
// 受影响对象数据
|
|
|
|
|
|
const affectedCountyData = ref({
|
|
|
|
|
|
byName: {},
|
|
|
|
|
|
sortedList: [],
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-04-08 15:34:49 +08:00
|
|
|
|
|
|
|
|
|
|
// 获取受影响对象数据
|
|
|
|
|
|
const getAffectedCountyData = async () => {
|
|
|
|
|
|
try {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const timeParams = getTimeParams()
|
2026-04-08 15:34:49 +08:00
|
|
|
|
const res = await request({
|
2026-04-17 14:50:25 +08:00
|
|
|
|
url: '/snow-ops-platform/weather-warning/affected-county',
|
|
|
|
|
|
method: 'GET',
|
2026-04-09 14:53:44 +08:00
|
|
|
|
params: timeParams,
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
|
|
|
|
|
console.log('受影响对象数据:', res)
|
|
|
|
|
|
clearProjectMarkers()
|
2026-04-17 14:50:25 +08:00
|
|
|
|
if (res.code === '00000' && res.data) {
|
2026-04-08 15:34:49 +08:00
|
|
|
|
// 统计各区县预警数量
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const warningStats = countWarningsByCounty(res.data)
|
|
|
|
|
|
console.log('区县预警统计:', warningStats)
|
|
|
|
|
|
affectedCountyData.value = warningStats
|
|
|
|
|
|
|
|
|
|
|
|
getAffectedProjectData(true) // 获取受影响项目数据
|
|
|
|
|
|
getAffectedTunnelData(true) // 获取受影响隧道数据
|
|
|
|
|
|
getAffectedBridgeData(true) // 获取受影响桥梁数据
|
|
|
|
|
|
getDangerProjectData(true) // 获取危大工程数据
|
|
|
|
|
|
|
|
|
|
|
|
let item = { isWithinRedLine: '', label: '' }
|
|
|
|
|
|
for (let index = 0; index < 6; index++) {
|
|
|
|
|
|
if (index == 0) {
|
|
|
|
|
|
item = {
|
|
|
|
|
|
isWithinRedLine: '是',
|
|
|
|
|
|
label: '重大路内隐患点',
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (index == 1) {
|
|
|
|
|
|
item = {
|
|
|
|
|
|
isWithinRedLine: '否',
|
|
|
|
|
|
label: '重大路外隐患点',
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (index == 2) {
|
|
|
|
|
|
item = {
|
|
|
|
|
|
isWithinRedLine: '是',
|
|
|
|
|
|
label: '较大路内隐患点',
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (index == 3) {
|
|
|
|
|
|
item = {
|
|
|
|
|
|
isWithinRedLine: '否',
|
|
|
|
|
|
label: '较大路外隐患点',
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (index == 4) {
|
|
|
|
|
|
item = {
|
|
|
|
|
|
isWithinRedLine: '是',
|
|
|
|
|
|
label: '一般路内隐患点',
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (index == 5) {
|
|
|
|
|
|
item = {
|
|
|
|
|
|
isWithinRedLine: '是',
|
|
|
|
|
|
label: '一般路外隐患点',
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (index == 6) {
|
|
|
|
|
|
item = {
|
|
|
|
|
|
isWithinRedLine: '',
|
|
|
|
|
|
label: '',
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (item.label) {
|
|
|
|
|
|
handleHazardItemClick(item, true) // 获取风险点数据,第一次加载传入 true
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-28 09:20:54 +08:00
|
|
|
|
// 获取受影响路段数据
|
2026-04-21 15:34:43 +08:00
|
|
|
|
for (let index = 0; index < 5; index++) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.log(index)
|
2026-04-21 15:34:43 +08:00
|
|
|
|
if (index == 0) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
props.roadItem.label = '高风险路段'
|
2026-04-21 15:34:43 +08:00
|
|
|
|
} else if (index == 1) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
props.roadItem.label = '较高风险路段'
|
2026-04-21 15:34:43 +08:00
|
|
|
|
} else if (index == 2) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
props.roadItem.label = '中风险路段'
|
2026-04-21 15:34:43 +08:00
|
|
|
|
} else if (index == 3) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
props.roadItem.label = '低风险路段'
|
2026-04-21 15:34:43 +08:00
|
|
|
|
} else if (index == 4) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
props.roadItem.label = ''
|
2026-04-21 15:34:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (props.roadItem.label) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
getAffectedRoadSectionData(true)
|
2026-04-21 15:34:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-04-17 14:50:25 +08:00
|
|
|
|
|
2026-04-13 11:38:11 +08:00
|
|
|
|
// getEmergencyForceData();
|
2026-04-09 14:53:44 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
loadMapData() // 加载地图数据
|
2026-04-08 15:34:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
} catch (error) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.error('获取受影响对象数据失败:', error)
|
2026-04-08 15:34:49 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-08 15:34:49 +08:00
|
|
|
|
|
2026-04-28 09:20:54 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 通用数据过滤方法 - 根据区县筛选数据并设置坐标
|
|
|
|
|
|
* @param {Array} dataList - 原始数据列表
|
|
|
|
|
|
* @param {boolean} flag - 是否只筛选受影响区县的数据
|
|
|
|
|
|
* @param {Object} options - 配置选项
|
|
|
|
|
|
* @param {string} options.countyField - 区县字段名
|
|
|
|
|
|
* @param {string} options.countyMatchField - 匹配区县时使用的字段名(如与countyField不同)
|
|
|
|
|
|
* @param {Function} options.coordinateParser - 坐标解析函数,接收item返回[lng, lat]
|
|
|
|
|
|
* @returns {Array} 过滤后的数据
|
|
|
|
|
|
*/
|
|
|
|
|
|
const filterDataByCounty = (dataList, flag, options) => {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const { countyField = 'COUNTY', countyMatchField, coordinateParser } = options
|
|
|
|
|
|
const matchField = countyMatchField || countyField
|
|
|
|
|
|
const filteredData = []
|
|
|
|
|
|
|
|
|
|
|
|
// 提取区县名称(去掉前缀和后缀)
|
|
|
|
|
|
const extractCountyName = (value) => {
|
|
|
|
|
|
if (!value) return ''
|
|
|
|
|
|
// 去掉"重庆市"前缀
|
|
|
|
|
|
let name = value.replace(/^重庆市/, '')
|
|
|
|
|
|
// 去掉"区"、"县"后缀
|
|
|
|
|
|
name = name.replace(/(区|县)$/, '')
|
|
|
|
|
|
return name
|
|
|
|
|
|
}
|
2026-04-28 09:20:54 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
dataList.forEach((item) => {
|
2026-04-28 09:20:54 +08:00
|
|
|
|
// 区县名称处理:江北/渝北 -> 两江新区
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const countyValue = item[countyField]
|
2026-04-28 09:20:54 +08:00
|
|
|
|
if (countyValue && (countyValue.includes('江北') || countyValue.includes('渝北'))) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
item[countyField] = '两江新区'
|
2026-04-28 09:20:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const matchValue = item[matchField]
|
|
|
|
|
|
// 提取纯净的区县名称用于匹配
|
|
|
|
|
|
const extractedCountyName = extractCountyName(matchValue)
|
2026-04-29 15:55:12 +08:00
|
|
|
|
|
|
|
|
|
|
if (!flag) {
|
|
|
|
|
|
// 不过滤,直接添加所有数据
|
2026-05-07 09:32:05 +08:00
|
|
|
|
item.COORDINATE_POINT = coordinateParser(item)
|
|
|
|
|
|
filteredData.push(item)
|
2026-04-29 15:55:12 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
// 根据受影响区县列表进行过滤
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const isMatched = affectedCountyData.value.sortedList.some((j) => {
|
|
|
|
|
|
// 同时支持原始匹配和提取后的区县名称匹配
|
|
|
|
|
|
return matchValue && j.name && (matchValue.includes(j.name) || extractedCountyName === j.name)
|
|
|
|
|
|
})
|
2026-04-29 15:55:12 +08:00
|
|
|
|
if (isMatched) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
item.COORDINATE_POINT = coordinateParser(item)
|
|
|
|
|
|
filteredData.push(item)
|
2026-04-28 09:20:54 +08:00
|
|
|
|
}
|
2026-04-29 15:55:12 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-04-28 09:20:54 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
return filteredData
|
|
|
|
|
|
}
|
2026-04-28 09:20:54 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const affectedBridgeData = ref([])
|
2026-04-08 18:47:57 +08:00
|
|
|
|
// 获取受影响桥梁数据
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const getAffectedBridgeData = async (flag) => {
|
2026-04-08 18:47:57 +08:00
|
|
|
|
try {
|
2026-04-29 15:55:12 +08:00
|
|
|
|
// 检查桥梁标记是否已存在,如果存在则不加载接口
|
|
|
|
|
|
if (hasProjectMarkersByType('bridge')) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.log('类型为 bridge 的标记已存在,跳过接口调用')
|
|
|
|
|
|
return []
|
2026-04-29 15:55:12 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
|
|
|
|
|
|
const timeParams = getTimeParams()
|
2026-04-08 18:47:57 +08:00
|
|
|
|
const res = await request({
|
2026-04-17 14:50:25 +08:00
|
|
|
|
url: '/snow-ops-platform/map/bridge',
|
|
|
|
|
|
method: 'GET',
|
2026-04-09 14:53:44 +08:00
|
|
|
|
params: timeParams,
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-04-16 14:03:39 +08:00
|
|
|
|
if (res.data) {
|
2026-04-28 09:20:54 +08:00
|
|
|
|
// 使用通用过滤方法处理数据
|
|
|
|
|
|
const filteredData = filterDataByCounty(res.data, flag, {
|
|
|
|
|
|
countyField: 'COUNTY',
|
|
|
|
|
|
countyMatchField: 'GL1_QXMC',
|
2026-05-07 09:32:05 +08:00
|
|
|
|
coordinateParser: (item) => [item.GL1_QLJD, item.GL1_QLWD],
|
|
|
|
|
|
})
|
|
|
|
|
|
affectedBridgeData.value = filteredData
|
|
|
|
|
|
console.log('受影响桥梁数据:', affectedBridgeData.value)
|
|
|
|
|
|
addProjectMarkers(affectedBridgeData.value, bridgeIcon, 'bridge')
|
2026-04-08 18:47:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
} catch (error) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.error('获取受影响桥梁数据失败:', error)
|
|
|
|
|
|
return []
|
2026-04-08 18:47:57 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const tunnelInfoDialogRef = ref([])
|
2026-04-08 18:47:57 +08:00
|
|
|
|
// 获取受影响隧道数据
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const getAffectedTunnelData = async (flag) => {
|
2026-04-08 18:47:57 +08:00
|
|
|
|
try {
|
2026-04-29 15:55:12 +08:00
|
|
|
|
// 检查隧道标记是否已存在,如果存在则不加载接口
|
|
|
|
|
|
if (hasProjectMarkersByType('tunnel')) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.log('类型为 tunnel 的标记已存在,跳过接口调用')
|
|
|
|
|
|
return []
|
2026-04-29 15:55:12 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
|
|
|
|
|
|
const timeParams = getTimeParams()
|
2026-04-08 18:47:57 +08:00
|
|
|
|
const res = await request({
|
2026-04-17 14:50:25 +08:00
|
|
|
|
url: '/snow-ops-platform/map/tunnel',
|
|
|
|
|
|
method: 'GET',
|
2026-04-09 14:53:44 +08:00
|
|
|
|
params: timeParams,
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-04-17 14:50:25 +08:00
|
|
|
|
if (res.code === '00000' && res.data) {
|
2026-04-28 09:20:54 +08:00
|
|
|
|
// 使用通用过滤方法处理数据
|
|
|
|
|
|
const filteredData = filterDataByCounty(res.data, flag, {
|
|
|
|
|
|
countyField: 'COUNTY',
|
|
|
|
|
|
countyMatchField: 'GL1_QXMC',
|
2026-05-07 09:32:05 +08:00
|
|
|
|
coordinateParser: (item) => [Number(item.GL1_SDJD2), Number(item.GL1_SDWD2)],
|
|
|
|
|
|
})
|
|
|
|
|
|
tunnelInfoDialogRef.value = filteredData
|
|
|
|
|
|
console.log('受影响隧道数据:', tunnelInfoDialogRef.value)
|
|
|
|
|
|
addProjectMarkers(tunnelInfoDialogRef.value, tunnelIcon2, 'tunnel')
|
2026-04-08 18:47:57 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
return []
|
2026-04-08 18:47:57 +08:00
|
|
|
|
} catch (error) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.error('获取受影响隧道数据失败:', error)
|
|
|
|
|
|
return []
|
2026-04-08 18:47:57 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
|
|
|
|
|
// 获取受影响项目数据
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const affectedProjectData = ref([])
|
|
|
|
|
|
const getAffectedProjectData = async (flag) => {
|
2026-04-08 18:47:57 +08:00
|
|
|
|
try {
|
2026-04-29 15:55:12 +08:00
|
|
|
|
// 检查项目标记是否已存在,如果存在则不加载接口
|
|
|
|
|
|
if (hasProjectMarkersByType('project')) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.log('类型为 project 的标记已存在,跳过接口调用')
|
|
|
|
|
|
return []
|
2026-04-29 15:55:12 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
|
|
|
|
|
|
const timeParams = getTimeParams()
|
2026-04-08 18:47:57 +08:00
|
|
|
|
const res = await request({
|
2026-05-07 09:32:05 +08:00
|
|
|
|
url: '/snow-ops-platform/map/project',
|
2026-04-17 14:50:25 +08:00
|
|
|
|
method: 'GET',
|
2026-04-09 14:53:44 +08:00
|
|
|
|
params: timeParams,
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
|
|
|
|
|
console.log('受影响项目数据:', res)
|
2026-04-17 14:50:25 +08:00
|
|
|
|
if (res.code === '00000' && res.data) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.log('项目数据条数:', res.data.length)
|
2026-04-28 09:20:54 +08:00
|
|
|
|
// 预处理:解析坐标格式
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const preprocessedData = res.data.map((item) => {
|
|
|
|
|
|
const newItem = { ...item }
|
2026-04-28 09:20:54 +08:00
|
|
|
|
if (item.COORDINATE_POINT) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.log('原始坐标:', item.COORDINATE_POINT)
|
|
|
|
|
|
// 解析格式: "106.44E,29.62N" -> [经度, 纬度]
|
|
|
|
|
|
const coordStr = item.COORDINATE_POINT.trim()
|
|
|
|
|
|
// 按逗号分割
|
|
|
|
|
|
const parts = coordStr.split(',')
|
|
|
|
|
|
if (parts.length === 2) {
|
|
|
|
|
|
// 去掉 E/N 后缀并转换为数字
|
|
|
|
|
|
const lng = parseFloat(parts[0].replace(/E$/i, '').trim())
|
|
|
|
|
|
const lat = parseFloat(parts[1].replace(/N$/i, '').trim())
|
|
|
|
|
|
if (!isNaN(lng) && !isNaN(lat)) {
|
|
|
|
|
|
newItem.COORDINATE_POINT_PARSED = [lng, lat]
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
console.log('解析后坐标:', newItem.COORDINATE_POINT_PARSED)
|
2026-04-08 18:47:57 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
return newItem
|
|
|
|
|
|
})
|
2026-04-28 09:20:54 +08:00
|
|
|
|
// 使用通用过滤方法处理数据
|
|
|
|
|
|
const filteredData = filterDataByCounty(preprocessedData, flag, {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
countyField: 'ADMINISTRATIVE_REGION',
|
|
|
|
|
|
coordinateParser: (item) => item.COORDINATE_POINT_PARSED || [],
|
|
|
|
|
|
})
|
|
|
|
|
|
affectedProjectData.value = filteredData
|
2026-04-08 18:47:57 +08:00
|
|
|
|
// 在地图上添加项目标记
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.log('开始添加项目标记...')
|
|
|
|
|
|
addProjectMarkers(filteredData, projectIcon, 'project')
|
2026-04-08 18:47:57 +08:00
|
|
|
|
} else {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.warn('没有获取到项目数据或返回码错误:', res)
|
2026-04-08 18:47:57 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
return res.data || []
|
2026-04-08 18:47:57 +08:00
|
|
|
|
} catch (error) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.error('获取受影响项目数据失败:', error)
|
|
|
|
|
|
return []
|
2026-04-08 18:47:57 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
|
|
|
|
|
// 获取受影响路段数据
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const affectedRoadSectionData = ref([])
|
2026-04-17 14:50:25 +08:00
|
|
|
|
const roadvalArr = ref([
|
|
|
|
|
|
{ label: '高风险', value: 0, show: false },
|
|
|
|
|
|
{ label: '较高风险', value: 0, show: false },
|
|
|
|
|
|
{ label: '中风险', value: 0, show: false },
|
|
|
|
|
|
{ label: '低风险', value: 0, show: false },
|
2026-05-07 09:32:05 +08:00
|
|
|
|
])
|
|
|
|
|
|
const getAffectedRoadSectionData = async (flag) => {
|
2026-04-08 18:47:57 +08:00
|
|
|
|
try {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.log('受影响路段数据:', props.roadItem)
|
|
|
|
|
|
const { start, end } = getTimeParams()
|
|
|
|
|
|
let riskLevel = ''
|
2026-04-17 14:50:25 +08:00
|
|
|
|
if (props.roadItem.label == '高风险路段') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
riskLevel = '高风险'
|
2026-04-17 14:50:25 +08:00
|
|
|
|
} else if (props.roadItem.label == '较高风险路段') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
riskLevel = '较高风险'
|
2026-04-17 14:50:25 +08:00
|
|
|
|
} else if (props.roadItem.label == '中风险路段') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
riskLevel = '中风险'
|
2026-04-17 14:50:25 +08:00
|
|
|
|
} else if (props.roadItem.label == '低风险路段') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
riskLevel = '低风险'
|
2026-04-17 14:50:25 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
|
2026-04-29 15:55:12 +08:00
|
|
|
|
// 检查该等级的路段标记是否已存在,如果存在则不加载接口
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const typeKey = `road-${riskLevel}`
|
2026-04-29 15:55:12 +08:00
|
|
|
|
if (hasProjectMarkersByType(typeKey)) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.log(`类型为 ${typeKey} 的标记已存在,跳过接口调用`)
|
|
|
|
|
|
return []
|
2026-04-29 15:55:12 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
|
2026-04-08 18:47:57 +08:00
|
|
|
|
const res = await request({
|
2026-04-17 14:50:25 +08:00
|
|
|
|
// url: '/snow-ops-platform/weather-warning/affected-object/road-section',
|
|
|
|
|
|
url: '/snow-ops-platform/risk-point/road-section',
|
|
|
|
|
|
method: 'GET',
|
|
|
|
|
|
params: {
|
|
|
|
|
|
riskLevel: riskLevel,
|
|
|
|
|
|
isWithinRedLine: '是',
|
|
|
|
|
|
start: start,
|
|
|
|
|
|
end: end,
|
|
|
|
|
|
},
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
|
|
|
|
|
console.log('受影响路段数据:', res)
|
2026-04-28 09:20:54 +08:00
|
|
|
|
|
2026-04-17 14:50:25 +08:00
|
|
|
|
if (res.code === '00000' && res.data) {
|
2026-04-28 09:20:54 +08:00
|
|
|
|
// 使用通用过滤方法处理数据
|
|
|
|
|
|
const filteredData = filterDataByCounty(res.data, flag, {
|
|
|
|
|
|
countyField: 'COUNTY',
|
|
|
|
|
|
countyMatchField: 'GL1_QXMC',
|
2026-05-07 09:32:05 +08:00
|
|
|
|
coordinateParser: (item) => [item.GL1_LON, item.GL1_LAT],
|
|
|
|
|
|
})
|
|
|
|
|
|
affectedRoadSectionData.value = filteredData
|
2026-04-08 18:47:57 +08:00
|
|
|
|
// 在地图上添加项目标记
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.log('受影响路段数据:', affectedRoadSectionData.value)
|
2026-04-17 14:50:25 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
let img = tunnelLineIcon
|
2026-04-17 14:50:25 +08:00
|
|
|
|
if (riskLevel == '高风险') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
img = tunnelLineIcon3
|
2026-04-17 14:50:25 +08:00
|
|
|
|
roadvalArr.value[0] = {
|
|
|
|
|
|
label: '高风险',
|
|
|
|
|
|
value: affectedRoadSectionData.value.length,
|
|
|
|
|
|
show: true,
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-17 14:50:25 +08:00
|
|
|
|
} else if (riskLevel == '较高风险') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
img = tunnelLineIcon2
|
2026-04-17 14:50:25 +08:00
|
|
|
|
roadvalArr.value[1] = {
|
|
|
|
|
|
label: '较高风险',
|
|
|
|
|
|
value: affectedRoadSectionData.value.length,
|
|
|
|
|
|
show: true,
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-17 14:50:25 +08:00
|
|
|
|
} else if (riskLevel == '中风险') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
img = tunnelLineIcon1
|
2026-04-17 14:50:25 +08:00
|
|
|
|
roadvalArr.value[2] = {
|
|
|
|
|
|
label: '中风险',
|
|
|
|
|
|
value: affectedRoadSectionData.value.length,
|
|
|
|
|
|
show: true,
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-17 14:50:25 +08:00
|
|
|
|
} else if (riskLevel == '低风险') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
img = tunnelLineIcon
|
2026-04-17 14:50:25 +08:00
|
|
|
|
roadvalArr.value[3] = {
|
|
|
|
|
|
label: '低风险',
|
|
|
|
|
|
value: affectedRoadSectionData.value.length,
|
|
|
|
|
|
show: true,
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-17 14:50:25 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
emit('update:roadvalArr ==== 风险点总数', roadvalArr.value)
|
2026-04-17 14:50:25 +08:00
|
|
|
|
|
2026-04-29 15:55:12 +08:00
|
|
|
|
// 给数据添加风险等级字段,确保 addProjectMarkers 能正确识别类型键
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const dataWithRiskLevel = affectedRoadSectionData.value.map((item) => ({
|
2026-04-29 15:55:12 +08:00
|
|
|
|
...item,
|
2026-05-07 09:32:05 +08:00
|
|
|
|
riskLevel: riskLevel,
|
|
|
|
|
|
}))
|
|
|
|
|
|
addProjectMarkers(dataWithRiskLevel, img, 'road')
|
2026-04-08 18:47:57 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
return []
|
2026-04-08 18:47:57 +08:00
|
|
|
|
} catch (error) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.error('获取受影响路段数据失败:', error)
|
|
|
|
|
|
return []
|
2026-04-08 18:47:57 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const emergencyForceData = ref([])
|
2026-04-08 18:47:57 +08:00
|
|
|
|
// 获取应急力量数据
|
|
|
|
|
|
const getEmergencyForceData = async () => {
|
|
|
|
|
|
try {
|
2026-04-29 15:55:12 +08:00
|
|
|
|
// 检查应急力量标记是否已存在,如果存在则不加载接口
|
|
|
|
|
|
if (hasProjectMarkersByType('emergency')) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.log('类型为 emergency 的标记已存在,跳过接口调用')
|
|
|
|
|
|
return []
|
2026-04-29 15:55:12 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
|
|
|
|
|
|
const timeParams = getTimeParams()
|
2026-04-08 18:47:57 +08:00
|
|
|
|
const res = await request({
|
2026-04-20 10:22:34 +08:00
|
|
|
|
url: '/snow-ops-platform/yhYjll/listForcesAndMaterials',
|
2026-04-17 14:50:25 +08:00
|
|
|
|
method: 'GET',
|
2026-04-09 14:53:44 +08:00
|
|
|
|
params: timeParams,
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
|
|
|
|
|
console.log('应急力量数据:', res)
|
2026-04-17 14:50:25 +08:00
|
|
|
|
if (res.code === '00000' && res.data) {
|
2026-04-08 18:47:57 +08:00
|
|
|
|
// 解析坐标数据
|
2026-05-07 09:32:05 +08:00
|
|
|
|
res.data.forEach((item) => {
|
|
|
|
|
|
item.COORDINATE_POINT = [item.lng, item.lat]
|
|
|
|
|
|
console.log('解析后坐标:', item.COORDINATE_POINT)
|
|
|
|
|
|
})
|
|
|
|
|
|
emergencyForceData.value = res.data
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
|
|
|
|
|
// 在地图上添加应急力量标记
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.log('开始添加应急力量标记...', res.data)
|
|
|
|
|
|
addProjectMarkers(res.data, rescueTeamIcon, 'emergency')
|
2026-04-08 18:47:57 +08:00
|
|
|
|
} else {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.warn('没有获取到应急力量数据或返回码错误:', res)
|
2026-04-08 18:47:57 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
return res.data || []
|
2026-04-08 18:47:57 +08:00
|
|
|
|
} catch (error) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.error('获取应急力量数据失败:', error)
|
|
|
|
|
|
return []
|
2026-04-17 14:50:25 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-17 14:50:25 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const dangerProjectData = ref([])
|
2026-04-28 09:20:54 +08:00
|
|
|
|
// 获取危大工程数据
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const getDangerProjectData = async (flag) => {
|
2026-04-28 09:20:54 +08:00
|
|
|
|
try {
|
2026-04-29 15:55:12 +08:00
|
|
|
|
// 检查危大工程标记是否已存在,如果存在则不加载接口
|
|
|
|
|
|
if (hasProjectMarkersByType('engineering')) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.log('类型为 engineering 的标记已存在,跳过接口调用')
|
|
|
|
|
|
return []
|
2026-04-29 15:55:12 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
|
2026-04-28 09:20:54 +08:00
|
|
|
|
const res = await request({
|
|
|
|
|
|
url: '/snow-ops-platform/dangerProjectInfo/listAll',
|
|
|
|
|
|
method: 'GET',
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
|
|
|
|
|
console.log('危大工程数据:', res)
|
2026-04-28 09:20:54 +08:00
|
|
|
|
if (res.code === '00000' && res.data) {
|
|
|
|
|
|
// 使用通用过滤方法处理数据
|
|
|
|
|
|
const filteredData = filterDataByCounty(res.data, flag, {
|
|
|
|
|
|
countyField: 'districtName',
|
2026-05-07 09:32:05 +08:00
|
|
|
|
coordinateParser: (item) => [item.longitude, item.latitude],
|
|
|
|
|
|
})
|
|
|
|
|
|
dangerProjectData.value = filteredData
|
|
|
|
|
|
console.log('过滤后危大工程数据:', filteredData)
|
2026-04-28 09:20:54 +08:00
|
|
|
|
|
|
|
|
|
|
// 在地图上添加危大工程标记
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.log('开始添加危大工程标记...', filteredData)
|
|
|
|
|
|
addProjectMarkers(filteredData, engineeringIconIcon, 'engineering')
|
2026-04-28 09:20:54 +08:00
|
|
|
|
} else {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.warn('没有获取到危大工程数据或返回码错误:', res)
|
2026-04-28 09:20:54 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
return res.data || []
|
2026-04-28 09:20:54 +08:00
|
|
|
|
} catch (error) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.error('获取危大工程数据失败:', error)
|
|
|
|
|
|
return []
|
2026-04-28 09:20:54 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-28 09:20:54 +08:00
|
|
|
|
|
2026-04-17 14:50:25 +08:00
|
|
|
|
// 风险点数据
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const riskPointData = ref([])
|
2026-04-17 14:50:25 +08:00
|
|
|
|
// 获取风险点数据
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const getRiskPointData = async (riskLevel, item, flag) => {
|
2026-04-17 14:50:25 +08:00
|
|
|
|
try {
|
2026-04-29 15:55:12 +08:00
|
|
|
|
// 根据风险等级和在红线内外确定类型键
|
2026-05-07 09:32:05 +08:00
|
|
|
|
let riskTypeKey = 'riskPoint'
|
2026-04-29 15:55:12 +08:00
|
|
|
|
if (riskLevel) {
|
|
|
|
|
|
if (riskLevel.includes('重大') && item.isWithinRedLine === '是') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
riskTypeKey = 'riskPoint-重大路内'
|
2026-04-29 15:55:12 +08:00
|
|
|
|
} else if (riskLevel.includes('重大') && item.isWithinRedLine === '否') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
riskTypeKey = 'riskPoint-重大路外'
|
2026-04-29 15:55:12 +08:00
|
|
|
|
} else if (riskLevel.includes('较大') && item.isWithinRedLine === '是') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
riskTypeKey = 'riskPoint-较大路内'
|
2026-04-29 15:55:12 +08:00
|
|
|
|
} else if (riskLevel.includes('较大') && item.isWithinRedLine === '否') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
riskTypeKey = 'riskPoint-较大路外'
|
2026-04-29 15:55:12 +08:00
|
|
|
|
} else if (riskLevel.includes('一般') && item.isWithinRedLine === '是') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
riskTypeKey = 'riskPoint-一般路内'
|
2026-04-29 15:55:12 +08:00
|
|
|
|
} else if (riskLevel.includes('一般') && item.isWithinRedLine === '否') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
riskTypeKey = 'riskPoint-一般路外'
|
2026-04-29 15:55:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
|
|
|
|
|
|
// 检查该类型的风险点标记是否已存在,如果存在则删除旧图标,加载最新图标
|
2026-04-29 15:55:12 +08:00
|
|
|
|
if (hasProjectMarkersByType(riskTypeKey)) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.log(`类型为 ${riskTypeKey} 的标记已存在,删除旧图标并重新加载`)
|
|
|
|
|
|
clearProjectMarkersByType(riskTypeKey)
|
2026-04-29 15:55:12 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
|
2026-04-17 14:50:25 +08:00
|
|
|
|
const res = await request({
|
|
|
|
|
|
url: '/snow-ops-platform/risk-point',
|
|
|
|
|
|
method: 'GET',
|
|
|
|
|
|
params: {
|
|
|
|
|
|
riskLevel: riskLevel || '',
|
|
|
|
|
|
isWithinRedLine: item.isWithinRedLine,
|
|
|
|
|
|
},
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
|
|
|
|
|
console.log('风险点数据:', res)
|
2026-04-17 14:50:25 +08:00
|
|
|
|
if (res.code === '00000' && res.data) {
|
|
|
|
|
|
// 解析坐标数据
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const filteredData = filterDataByCounty(res.data, flag, {
|
|
|
|
|
|
countyField: 'DistrictRICT_NAME',
|
|
|
|
|
|
countyMatchField: 'GL1_QXMC',
|
|
|
|
|
|
coordinateParser: (item) => [item.GL1_LON, item.GL1_LAT],
|
|
|
|
|
|
})
|
|
|
|
|
|
filteredData.forEach((item) => {
|
|
|
|
|
|
item.COORDINATE_POINT = [item.GL1_LON, item.GL1_LAT]
|
|
|
|
|
|
})
|
|
|
|
|
|
riskPointData.value = filteredData
|
2026-04-17 14:50:25 +08:00
|
|
|
|
// 在地图上添加风险点标记
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.log('开始添加风险点标记...', filteredData)
|
2026-04-17 14:50:25 +08:00
|
|
|
|
// 根据风险等级选择不同的图标
|
2026-05-07 09:32:05 +08:00
|
|
|
|
let iconUrl = hazardIconIcon1 // 默认使用一般路内隐患点图标
|
2026-04-17 14:50:25 +08:00
|
|
|
|
if (riskLevel) {
|
|
|
|
|
|
if (riskLevel.includes('重大') && item.isWithinRedLine === '是') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
iconUrl = hazardIconIcon5 // 重大路内隐患点
|
2026-04-17 14:50:25 +08:00
|
|
|
|
} else if (riskLevel.includes('重大') && item.isWithinRedLine === '否') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
iconUrl = hazardIconIcon6 // 重大路外隐患点
|
2026-04-17 14:50:25 +08:00
|
|
|
|
} else if (riskLevel.includes('较大') && item.isWithinRedLine === '是') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
iconUrl = hazardIconIcon3 // 较大路内隐患点
|
2026-04-17 14:50:25 +08:00
|
|
|
|
} else if (riskLevel.includes('较大') && item.isWithinRedLine === '否') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
iconUrl = hazardIconIcon4 // 较大路外隐患点
|
2026-04-17 14:50:25 +08:00
|
|
|
|
} else if (riskLevel.includes('一般') && item.isWithinRedLine === '是') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
iconUrl = hazardIconIcon1 // 一般路内隐患点
|
2026-04-17 14:50:25 +08:00
|
|
|
|
} else if (riskLevel.includes('一般') && item.isWithinRedLine === '否') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
iconUrl = hazardIconIcon2 // 一般路外隐患点
|
2026-04-17 14:50:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
|
2026-04-17 14:50:25 +08:00
|
|
|
|
emit('riskPointStatsChange', {
|
|
|
|
|
|
riskLevel: riskLevel.substring(0, 2),
|
|
|
|
|
|
isWithinRedLine: item.isWithinRedLine,
|
|
|
|
|
|
value: riskPointData.value.length,
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-04-29 15:55:12 +08:00
|
|
|
|
// 给数据添加风险等级和在红线内外字段,确保 addProjectMarkers 能正确识别类型键
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const dataWithRiskInfo = riskPointData.value.map((riskItem) => ({
|
2026-04-29 15:55:12 +08:00
|
|
|
|
...riskItem,
|
|
|
|
|
|
riskLevel: riskLevel,
|
2026-05-07 09:32:05 +08:00
|
|
|
|
isWithinRedLine: item.isWithinRedLine,
|
|
|
|
|
|
}))
|
|
|
|
|
|
addProjectMarkers(dataWithRiskInfo, iconUrl, 'riskPoint')
|
2026-04-17 14:50:25 +08:00
|
|
|
|
// 获取风险点统计数据
|
|
|
|
|
|
} else {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.warn('没有获取到风险点数据或返回码错误:', res)
|
2026-04-17 14:50:25 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
return res.data || []
|
2026-04-17 14:50:25 +08:00
|
|
|
|
} catch (error) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.error('获取风险点数据失败:', error)
|
|
|
|
|
|
return []
|
2026-04-08 18:47:57 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
2026-04-29 15:55:12 +08:00
|
|
|
|
// 按类型存储项目标记,避免同类型重复刷新
|
|
|
|
|
|
// 格式: { 'road-高风险': [...], 'road-较高风险': [...], 'riskPoint-高风险': [...], ... }
|
2026-05-07 09:32:05 +08:00
|
|
|
|
let projectMarkersMap = new Map()
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
2026-04-29 15:55:12 +08:00
|
|
|
|
// 清除所有项目标记
|
2026-04-08 18:47:57 +08:00
|
|
|
|
const clearProjectMarkers = () => {
|
2026-04-29 15:55:12 +08:00
|
|
|
|
projectMarkersMap.forEach((markers, type) => {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
markers.forEach((marker) => {
|
2026-04-29 15:55:12 +08:00
|
|
|
|
if (mapInstance) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
mapInstance.removeLayer(marker)
|
2026-04-29 15:55:12 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
projectMarkersMap.clear()
|
|
|
|
|
|
clearCountyCardMarkers()
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 关闭所有弹窗
|
2026-05-07 09:32:05 +08:00
|
|
|
|
mapInfoDialogVisible.value = false
|
|
|
|
|
|
centerCardVisible.value = false
|
|
|
|
|
|
}
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
2026-04-29 15:55:12 +08:00
|
|
|
|
// 清除指定类型的项目标记
|
|
|
|
|
|
const clearProjectMarkersByType = (typeKey) => {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const markers = projectMarkersMap.get(typeKey)
|
2026-04-29 15:55:12 +08:00
|
|
|
|
if (markers) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
markers.forEach((marker) => {
|
2026-04-29 15:55:12 +08:00
|
|
|
|
if (mapInstance) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
mapInstance.removeLayer(marker)
|
2026-04-29 15:55:12 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
|
|
|
|
|
projectMarkersMap.delete(typeKey)
|
|
|
|
|
|
console.log(`已清除类型为 ${typeKey} 的标记,共 ${markers.length} 个`)
|
2026-04-29 15:55:12 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-29 15:55:12 +08:00
|
|
|
|
|
|
|
|
|
|
// 检查指定类型的项目标记是否已存在
|
|
|
|
|
|
const hasProjectMarkersByType = (typeKey) => {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const markers = projectMarkersMap.get(typeKey)
|
|
|
|
|
|
return markers && markers.length > 0
|
|
|
|
|
|
}
|
2026-04-29 15:55:12 +08:00
|
|
|
|
|
2026-04-17 14:50:25 +08:00
|
|
|
|
// 根据数据类型获取对应的图标
|
|
|
|
|
|
const getIconByType = (item, type) => {
|
|
|
|
|
|
// 如果是风险点类型,根据风险等级和是否在红线内返回对应图标
|
|
|
|
|
|
if (type === 'riskPoint' || item.riskLevel) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const riskLevel = item.riskLevel || ''
|
|
|
|
|
|
const isWithinRedLine = item.isWithinRedLine || item.iswithinredline || ''
|
2026-04-17 14:50:25 +08:00
|
|
|
|
|
|
|
|
|
|
if (riskLevel.includes('重大')) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
return isWithinRedLine === '是' ? hazardIconIcon5 : hazardIconIcon6
|
2026-04-17 14:50:25 +08:00
|
|
|
|
} else if (riskLevel.includes('较大')) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
return isWithinRedLine === '是' ? hazardIconIcon3 : hazardIconIcon4
|
2026-04-17 14:50:25 +08:00
|
|
|
|
} else if (riskLevel.includes('一般')) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
return isWithinRedLine === '是' ? hazardIconIcon1 : hazardIconIcon2
|
2026-04-17 14:50:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 如果是路段类型,根据风险等级返回对应图标
|
|
|
|
|
|
if (type === 'road' || item.riskLevel) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const riskLevel = item.riskLevel || ''
|
2026-04-17 14:50:25 +08:00
|
|
|
|
if (riskLevel.includes('高风险')) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
return tunnelLineIcon3
|
2026-04-17 14:50:25 +08:00
|
|
|
|
} else if (riskLevel.includes('较高风险')) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
return tunnelLineIcon2
|
2026-04-17 14:50:25 +08:00
|
|
|
|
} else if (riskLevel.includes('中风险')) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
return tunnelLineIcon1
|
2026-04-17 14:50:25 +08:00
|
|
|
|
} else if (riskLevel.includes('低风险')) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
return tunnelLineIcon
|
2026-04-17 14:50:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 默认返回传入的图标或项目图标
|
2026-05-07 09:32:05 +08:00
|
|
|
|
return projectIcon
|
|
|
|
|
|
}
|
2026-04-17 14:50:25 +08:00
|
|
|
|
|
2026-04-08 18:47:57 +08:00
|
|
|
|
// 在地图上添加项目标记
|
2026-04-17 14:50:25 +08:00
|
|
|
|
const addProjectMarkers = (data, iconUrl, type = 'project') => {
|
2026-04-08 18:47:57 +08:00
|
|
|
|
if (!mapInstance) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.warn('mapInstance 未初始化,无法添加标记')
|
|
|
|
|
|
return
|
2026-04-08 18:47:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (!data || data.length === 0) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.warn('没有数据,无法添加标记')
|
|
|
|
|
|
return
|
2026-04-08 18:47:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-29 15:55:12 +08:00
|
|
|
|
// 根据类型和等级生成类型键,用于区分不同类型的标记
|
|
|
|
|
|
// 例如: 'road-高风险', 'road-较高风险', 'riskPoint-高风险', 'project', 'tunnel', 'bridge'
|
2026-05-07 09:32:05 +08:00
|
|
|
|
let typeKey = type
|
|
|
|
|
|
|
2026-04-29 15:55:12 +08:00
|
|
|
|
// 对于路段类型,从数据中解析风险等级
|
|
|
|
|
|
if (type === 'road' && data.length > 0) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const riskLevel = data[0].GL1_FXDJ || data[0].riskLevel || ''
|
2026-04-29 15:55:12 +08:00
|
|
|
|
if (riskLevel) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
typeKey = `road-${riskLevel}`
|
2026-04-29 15:55:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
|
2026-04-29 15:55:12 +08:00
|
|
|
|
// 对于风险点类型,从数据中解析风险等级和在红线内外
|
|
|
|
|
|
if (type === 'riskPoint' && data.length > 0) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const riskLevel = data[0].GL1_FXDJ || data[0].riskLevel || ''
|
|
|
|
|
|
const isWithinRedLine = data[0].GL1_SFHXN || data[0].isWithinRedLine || ''
|
2026-04-29 15:55:12 +08:00
|
|
|
|
if (riskLevel) {
|
|
|
|
|
|
// 根据风险等级和在红线内外确定类型键
|
|
|
|
|
|
if (riskLevel.includes('重大') && isWithinRedLine === '是') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
typeKey = 'riskPoint-重大路内'
|
2026-04-29 15:55:12 +08:00
|
|
|
|
} else if (riskLevel.includes('重大') && isWithinRedLine === '否') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
typeKey = 'riskPoint-重大路外'
|
2026-04-29 15:55:12 +08:00
|
|
|
|
} else if (riskLevel.includes('较大') && isWithinRedLine === '是') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
typeKey = 'riskPoint-较大路内'
|
2026-04-29 15:55:12 +08:00
|
|
|
|
} else if (riskLevel.includes('较大') && isWithinRedLine === '否') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
typeKey = 'riskPoint-较大路外'
|
2026-04-29 15:55:12 +08:00
|
|
|
|
} else if (riskLevel.includes('一般') && isWithinRedLine === '是') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
typeKey = 'riskPoint-一般路内'
|
2026-04-29 15:55:12 +08:00
|
|
|
|
} else if (riskLevel.includes('一般') && isWithinRedLine === '否') {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
typeKey = 'riskPoint-一般路外'
|
2026-04-29 15:55:12 +08:00
|
|
|
|
} else {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
typeKey = `riskPoint-${riskLevel}`
|
2026-04-29 15:55:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 如果该类型的标记已存在,直接返回,避免重复渲染
|
|
|
|
|
|
if (hasProjectMarkersByType(typeKey)) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.log(`类型为 ${typeKey} 的标记已存在,跳过添加`)
|
|
|
|
|
|
return
|
2026-04-29 15:55:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 存储新添加的标记
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const newMarkers = []
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
|
|
|
|
|
// 遍历数据添加标记
|
2026-05-07 09:32:05 +08:00
|
|
|
|
data.forEach((item) => {
|
2026-04-21 15:34:43 +08:00
|
|
|
|
if (item && item.COORDINATE_POINT && item.COORDINATE_POINT.length == 2) {
|
2026-04-08 18:47:57 +08:00
|
|
|
|
// COORDINATE_POINT 格式: [经度, 纬度]
|
|
|
|
|
|
// Leaflet 需要: [纬度, 经度]
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const lng = item.COORDINATE_POINT[0]
|
|
|
|
|
|
const lat = item.COORDINATE_POINT[1]
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const latNum = parseFloat(lat)
|
|
|
|
|
|
const lngNum = parseFloat(lng)
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
|
|
|
|
|
if (!isNaN(latNum) && !isNaN(lngNum)) {
|
2026-04-17 14:50:25 +08:00
|
|
|
|
// 根据数据类型获取对应的图标
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const currentIconUrl = iconUrl || getIconByType(item, type)
|
2026-04-17 14:50:25 +08:00
|
|
|
|
|
|
|
|
|
|
// 创建自定义图标
|
|
|
|
|
|
const projectIconObj = window.L.icon({
|
|
|
|
|
|
iconUrl: currentIconUrl,
|
|
|
|
|
|
iconSize: [35, 35],
|
|
|
|
|
|
iconAnchor: [10, 10],
|
|
|
|
|
|
popupAnchor: [0, -10],
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-04-17 14:50:25 +08:00
|
|
|
|
|
2026-04-08 18:47:57 +08:00
|
|
|
|
const marker = window.L.marker([latNum, lngNum], {
|
|
|
|
|
|
icon: projectIconObj,
|
2026-04-21 15:34:43 +08:00
|
|
|
|
zIndexOffset: 1000, // 提升图标层级,确保在地图其他元素之上
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
|
|
|
|
|
// 点击 marker 打开对应类型的信息弹窗
|
2026-04-17 14:50:25 +08:00
|
|
|
|
marker.on('click', () => {
|
|
|
|
|
|
if (type === 'riskPoint') {
|
|
|
|
|
|
// 风险点类型,触发父组件打开涉灾隐患点情况弹窗
|
2026-05-07 09:32:05 +08:00
|
|
|
|
emit('openHazardPointSituation', item)
|
2026-04-29 10:33:26 +08:00
|
|
|
|
} else if (type === 'road') {
|
|
|
|
|
|
// 路段类型,触发父组件打开路段情况弹窗
|
2026-05-07 09:32:05 +08:00
|
|
|
|
emit('openRoadSectionSituation', item)
|
2026-04-17 14:50:25 +08:00
|
|
|
|
} else {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
openMapInfoDialog(type, item)
|
2026-04-17 14:50:25 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
marker.addTo(mapInstance)
|
|
|
|
|
|
newMarkers.push(marker)
|
2026-04-08 18:47:57 +08:00
|
|
|
|
} else {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.warn('无效的坐标:', item.COORDINATE_POINT, item)
|
2026-04-08 18:47:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
} else {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.warn('缺少坐标数据:', item)
|
2026-04-08 18:47:57 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
2026-04-29 15:55:12 +08:00
|
|
|
|
// 将新标记存储到对应类型中
|
2026-05-07 09:32:05 +08:00
|
|
|
|
projectMarkersMap.set(typeKey, newMarkers)
|
|
|
|
|
|
console.log(`已添加 ${newMarkers.length} 个类型为 ${typeKey} 的标记`)
|
|
|
|
|
|
}
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
2026-04-08 15:34:49 +08:00
|
|
|
|
// 确定主要预警颜色(出现最多的预警等级)
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const getMainWarningColor = (levels) => {
|
|
|
|
|
|
if (!levels || Object.keys(levels).length === 0) return '#1890ff' // 默认蓝色
|
2026-04-08 15:34:49 +08:00
|
|
|
|
|
|
|
|
|
|
// 预警等级优先级:红色 > 橙色 > 黄色 > 蓝色
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const priority = ['红色', '橙色', '黄色', '蓝色']
|
2026-04-08 15:34:49 +08:00
|
|
|
|
|
|
|
|
|
|
// 按数量排序
|
|
|
|
|
|
const sortedLevels = Object.entries(levels)
|
|
|
|
|
|
.map(([level, count]) => ({ level, count }))
|
2026-05-07 09:32:05 +08:00
|
|
|
|
.sort((a, b) => b.count - a.count)
|
2026-04-08 15:34:49 +08:00
|
|
|
|
|
|
|
|
|
|
// 如果有多个等级数量相同,按优先级排序
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const maxCount = sortedLevels[0].count
|
|
|
|
|
|
const maxLevels = sortedLevels.filter((item) => item.count === maxCount)
|
2026-04-08 15:34:49 +08:00
|
|
|
|
|
|
|
|
|
|
if (maxLevels.length === 1) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
return getColorByLevel(maxLevels[0].level)
|
2026-04-08 15:34:49 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
// 按优先级选择
|
|
|
|
|
|
for (const level of priority) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
if (maxLevels.some((item) => item.level === level)) {
|
|
|
|
|
|
return getColorByLevel(level)
|
2026-04-08 15:34:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
return getColorByLevel(maxLevels[0].level)
|
2026-04-08 15:34:49 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-08 15:34:49 +08:00
|
|
|
|
|
|
|
|
|
|
// 统计各区县的预警数量(按预警等级区分)
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const countWarningsByCounty = (data) => {
|
|
|
|
|
|
if (!data || !Array.isArray(data)) return {}
|
2026-04-08 15:34:49 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const stats = {}
|
|
|
|
|
|
data.forEach((item) => {
|
2026-04-08 15:34:49 +08:00
|
|
|
|
// 根据实际数据结构调整字段名
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const rawCountyName = item.countyName || item.name || item.qxmc || item.gl1Qxmc
|
|
|
|
|
|
const riskLevel = item.riskLevel || item.level || item.warningLevel || item.gl1Yjdj
|
2026-04-08 15:34:49 +08:00
|
|
|
|
|
|
|
|
|
|
// 简化区县名称
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const countyName = simplifyDistrictName(rawCountyName)
|
2026-04-08 15:34:49 +08:00
|
|
|
|
|
|
|
|
|
|
if (countyName) {
|
|
|
|
|
|
if (!stats[countyName]) {
|
|
|
|
|
|
stats[countyName] = {
|
|
|
|
|
|
total: 0,
|
|
|
|
|
|
levels: {},
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-08 15:34:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 统计总数
|
2026-05-07 09:32:05 +08:00
|
|
|
|
stats[countyName].total += 1
|
2026-04-08 15:34:49 +08:00
|
|
|
|
|
|
|
|
|
|
// 按预警等级统计
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const level = riskLevel || '未知'
|
2026-04-08 15:34:49 +08:00
|
|
|
|
if (stats[countyName].levels[level]) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
stats[countyName].levels[level] += 1
|
2026-04-08 15:34:49 +08:00
|
|
|
|
} else {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
stats[countyName].levels[level] = 1
|
2026-04-08 15:34:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-04-08 15:34:49 +08:00
|
|
|
|
|
|
|
|
|
|
// 合并渝北区和江北区为两江新区
|
2026-04-17 14:50:25 +08:00
|
|
|
|
if (stats['渝北区'] || stats['江北区']) {
|
|
|
|
|
|
const yubeiData = stats['渝北区'] || {
|
2026-04-08 15:34:49 +08:00
|
|
|
|
total: 0,
|
|
|
|
|
|
levels: {},
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-17 14:50:25 +08:00
|
|
|
|
const jiangbeiData = stats['江北区'] || {
|
2026-04-08 15:34:49 +08:00
|
|
|
|
total: 0,
|
|
|
|
|
|
levels: {},
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-08 15:34:49 +08:00
|
|
|
|
|
|
|
|
|
|
// 合并总数
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const total = yubeiData.total + jiangbeiData.total
|
2026-04-08 15:34:49 +08:00
|
|
|
|
|
|
|
|
|
|
// 合并各等级预警数量
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const levels = { ...yubeiData.levels }
|
2026-04-08 15:34:49 +08:00
|
|
|
|
Object.entries(jiangbeiData.levels).forEach(([level, count]) => {
|
|
|
|
|
|
if (levels[level]) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
levels[level] += count
|
2026-04-08 15:34:49 +08:00
|
|
|
|
} else {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
levels[level] = count
|
2026-04-08 15:34:49 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-04-08 15:34:49 +08:00
|
|
|
|
|
|
|
|
|
|
// 创建两江新区数据
|
2026-04-17 14:50:25 +08:00
|
|
|
|
stats['两江新区'] = {
|
2026-04-08 15:34:49 +08:00
|
|
|
|
total,
|
|
|
|
|
|
levels,
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-08 15:34:49 +08:00
|
|
|
|
|
|
|
|
|
|
// 删除渝北区和江北区
|
2026-05-07 09:32:05 +08:00
|
|
|
|
delete stats['渝北区']
|
|
|
|
|
|
delete stats['江北区']
|
2026-04-08 15:34:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 转换为数组格式并按总数排序(数量从大到小)
|
|
|
|
|
|
const sortedList = Object.entries(stats)
|
|
|
|
|
|
.map(([name, data]) => ({
|
2026-04-21 15:34:43 +08:00
|
|
|
|
name: name.substring(0, 2),
|
2026-04-08 15:34:49 +08:00
|
|
|
|
total: data.total,
|
|
|
|
|
|
levels: data.levels,
|
|
|
|
|
|
}))
|
2026-05-07 09:32:05 +08:00
|
|
|
|
.sort((a, b) => b.total - a.total)
|
2026-04-08 15:34:49 +08:00
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
byName: stats, // 对象格式:{ 区县名: { total: 总数, levels: { 等级: 数量 } } }
|
|
|
|
|
|
sortedList: sortedList, // 数组格式:[{ name: 区县名, total: 总数, levels: { 等级: 数量 } }]
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-04-08 15:34:49 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
// 重庆地图 GeoJSON API 地址 - 根据 URL 参数动态判断
|
|
|
|
|
|
const getGeoJsonUrl = () => {
|
|
|
|
|
|
const urlParams = new URLSearchParams(window.location.search)
|
|
|
|
|
|
const mapParam = urlParams.get('Map')
|
|
|
|
|
|
if (mapParam === 'dev') {
|
|
|
|
|
|
return 'https://geo.datav.aliyun.com/areas_v3/bound/500000_full.json'
|
|
|
|
|
|
}
|
|
|
|
|
|
return 'http://58.144.223.142:11501/aliyun-geo/bound/500000_full.json'
|
|
|
|
|
|
}
|
|
|
|
|
|
const GEOJSON_URL = getGeoJsonUrl()
|
2026-03-31 18:10:34 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
// 天地图配置缓存
|
|
|
|
|
|
let tiandituConfig = null
|
|
|
|
|
|
|
|
|
|
|
|
// 获取天地图配置
|
|
|
|
|
|
const getTiandituConfig = async () => {
|
|
|
|
|
|
// 如果已有缓存,直接返回
|
|
|
|
|
|
if (tiandituConfig) {
|
|
|
|
|
|
return tiandituConfig
|
|
|
|
|
|
}
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
2026-03-31 18:10:34 +08:00
|
|
|
|
try {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const res = await request({
|
|
|
|
|
|
url: '/snow-ops-platform/dataDirectory/queryCatalog',
|
|
|
|
|
|
method: 'GET',
|
|
|
|
|
|
params: {
|
|
|
|
|
|
pcatalog: 'TDT',
|
|
|
|
|
|
},
|
|
|
|
|
|
})
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
if (res.code === '00000' && res.data && res.data.length > 0) {
|
|
|
|
|
|
// 查找天地图配置
|
|
|
|
|
|
const tiandituItem = res.data.find((item) => item.Name === '天地图' || item.Name?.includes('天地图'))
|
2026-04-08 15:34:49 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
if (tiandituItem && tiandituItem.Children && tiandituItem.Children.length > 0) {
|
|
|
|
|
|
// 查找影像底图
|
|
|
|
|
|
const imgLayer = tiandituItem.Children.find((child) => child.Name?.includes('影像') || child.Name?.includes('底图'))
|
2026-04-08 15:34:49 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
// 查找行政区划图层
|
|
|
|
|
|
const boundaryLayer = tiandituItem.Children.find((child) => child.Name?.includes('行政区划') || child.Name?.includes('边界'))
|
|
|
|
|
|
|
|
|
|
|
|
const config = {}
|
|
|
|
|
|
|
|
|
|
|
|
if (imgLayer && imgLayer.Attribute && imgLayer.Attribute.servicePath) {
|
|
|
|
|
|
config.imgLayer = {
|
|
|
|
|
|
name: imgLayer.Name,
|
|
|
|
|
|
servicePath: imgLayer.Attribute.servicePath,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (boundaryLayer && boundaryLayer.Attribute && boundaryLayer.Attribute.servicePath) {
|
|
|
|
|
|
config.boundaryLayer = {
|
|
|
|
|
|
name: boundaryLayer.Name,
|
|
|
|
|
|
servicePath: boundaryLayer.Attribute.servicePath,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (Object.keys(config).length > 0) {
|
|
|
|
|
|
tiandituConfig = config
|
|
|
|
|
|
console.log('获取天地图配置成功:', tiandituConfig)
|
|
|
|
|
|
return tiandituConfig
|
|
|
|
|
|
}
|
2026-04-03 18:08:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.warn('未找到天地图配置,使用默认配置')
|
|
|
|
|
|
return null
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('获取天地图配置失败:', error)
|
|
|
|
|
|
return null
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 加载地图数据
|
|
|
|
|
|
const loadMapData = async () => {
|
|
|
|
|
|
loading.value = true
|
|
|
|
|
|
error.value = null
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
// 初始化地图 - 使用天地图配置
|
|
|
|
|
|
await initMap()
|
2026-03-31 18:10:34 +08:00
|
|
|
|
} catch (err) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.error('加载地图数据失败:', err)
|
|
|
|
|
|
error.value = '地图数据加载失败,请检查网络连接'
|
2026-03-31 18:10:34 +08:00
|
|
|
|
} finally {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
loading.value = false
|
2026-03-31 18:10:34 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
|
|
|
|
|
// 处理行政区划合并
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const processDistrictMerge = (geoJsonData) => {
|
|
|
|
|
|
if (!geoJsonData || !geoJsonData.features) return
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
|
|
|
|
|
// 查找渝北区和江北区的特征
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const yubeiIndex = geoJsonData.features.findIndex((f) => f.properties && f.properties.name === '渝北区')
|
|
|
|
|
|
const jiangbeiIndex = geoJsonData.features.findIndex((f) => f.properties && f.properties.name === '江北区')
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
|
|
|
|
|
// 如果两个区都存在,合并为两江新区
|
|
|
|
|
|
if (yubeiIndex !== -1 && jiangbeiIndex !== -1) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const yubeiFeature = geoJsonData.features[yubeiIndex]
|
|
|
|
|
|
const jiangbeiFeature = geoJsonData.features[jiangbeiIndex]
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
|
|
|
|
|
// 创建两江新区的特征
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const liangjiangFeature = JSON.parse(JSON.stringify(yubeiFeature))
|
|
|
|
|
|
liangjiangFeature.properties.name = '两江新区'
|
|
|
|
|
|
liangjiangFeature.properties.adcode = '500006' // 使用新的行政区划代码
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
|
|
|
|
|
// 如果是 MultiPolygon,合并两个区的坐标
|
2026-05-07 09:32:05 +08:00
|
|
|
|
if (yubeiFeature.geometry.type === 'MultiPolygon' && jiangbeiFeature.geometry.type === 'MultiPolygon') {
|
|
|
|
|
|
liangjiangFeature.geometry.coordinates = [...yubeiFeature.geometry.coordinates, ...jiangbeiFeature.geometry.coordinates]
|
|
|
|
|
|
} else if (yubeiFeature.geometry.type === 'Polygon' && jiangbeiFeature.geometry.type === 'Polygon') {
|
|
|
|
|
|
liangjiangFeature.geometry.type = 'MultiPolygon'
|
|
|
|
|
|
liangjiangFeature.geometry.coordinates = [[yubeiFeature.geometry.coordinates], [jiangbeiFeature.geometry.coordinates]]
|
2026-04-02 16:35:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 移除原来的两个区
|
2026-05-07 09:32:05 +08:00
|
|
|
|
geoJsonData.features.splice(Math.max(yubeiIndex, jiangbeiIndex), 1)
|
|
|
|
|
|
geoJsonData.features.splice(Math.min(yubeiIndex, jiangbeiIndex), 1)
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
|
|
|
|
|
// 添加合并后的两江新区
|
2026-05-07 09:32:05 +08:00
|
|
|
|
geoJsonData.features.push(liangjiangFeature)
|
2026-04-02 16:35:45 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
|
|
|
|
|
// 计算区县中心点
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const getCentroid = (coordinates) => {
|
|
|
|
|
|
let sumLat = 0
|
|
|
|
|
|
let sumLng = 0
|
|
|
|
|
|
let count = 0
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const processCoordinates = (coords) => {
|
2026-04-17 14:50:25 +08:00
|
|
|
|
if (typeof coords[0] === 'number') {
|
2026-04-02 16:35:45 +08:00
|
|
|
|
// 单个坐标点 [lng, lat]
|
2026-05-07 09:32:05 +08:00
|
|
|
|
sumLng += coords[0]
|
|
|
|
|
|
sumLat += coords[1]
|
|
|
|
|
|
count++
|
2026-04-02 16:35:45 +08:00
|
|
|
|
} else if (Array.isArray(coords[0])) {
|
|
|
|
|
|
// 坐标数组
|
2026-05-07 09:32:05 +08:00
|
|
|
|
coords.forEach(processCoordinates)
|
2026-04-02 16:35:45 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
processCoordinates(coordinates)
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
return count > 0 ? [sumLat / count, sumLng / count] : null
|
|
|
|
|
|
}
|
2026-03-31 18:10:34 +08:00
|
|
|
|
|
2026-04-08 15:34:49 +08:00
|
|
|
|
// 简化区县名称
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const simplifyDistrictName = (name) => {
|
2026-04-08 15:34:49 +08:00
|
|
|
|
const nameMap = {
|
2026-04-17 14:50:25 +08:00
|
|
|
|
酉阳土家族苗族自治县: '酉阳县',
|
|
|
|
|
|
秀山土家族苗族自治县: '秀山县',
|
|
|
|
|
|
彭水苗族土家族自治县: '彭水县',
|
|
|
|
|
|
石柱土家族自治县: '石柱县',
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
return nameMap[name] || name
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 根据区县名称匹配预警数据
|
|
|
|
|
|
const getCountyWarningData = (countyName) => {
|
|
|
|
|
|
if (!affectedCountyData.value || !affectedCountyData.value.byName) {
|
|
|
|
|
|
return null
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 简化区县名称进行匹配
|
|
|
|
|
|
const simplifiedName = simplifyDistrictName(countyName)
|
|
|
|
|
|
const shortName = simplifiedName.replace(/区$/, '').replace(/县$/, '')
|
|
|
|
|
|
|
|
|
|
|
|
// 尝试直接匹配
|
|
|
|
|
|
if (affectedCountyData.value.byName[simplifiedName]) {
|
|
|
|
|
|
return affectedCountyData.value.byName[simplifiedName]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 尝试匹配短名称(去掉"区"、"县"后缀)
|
|
|
|
|
|
for (const [name, data] of Object.entries(affectedCountyData.value.byName)) {
|
|
|
|
|
|
const dataShortName = name.replace(/区$/, '').replace(/县$/, '')
|
|
|
|
|
|
if (dataShortName === shortName) {
|
|
|
|
|
|
return data
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 特殊处理:两江新区
|
|
|
|
|
|
if (shortName === '两江' || countyName === '两江新区') {
|
|
|
|
|
|
return affectedCountyData.value.byName['两江新区']
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return null
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 根据预警数据获取区县填充颜色
|
|
|
|
|
|
const getCountyFillColor = (countyName) => {
|
|
|
|
|
|
const warningData = getCountyWarningData(countyName)
|
|
|
|
|
|
if (!warningData || !warningData.levels) {
|
|
|
|
|
|
return 'rgb(50, 108, 112, 0.6)' // 默认绿色,90%透明度
|
|
|
|
|
|
}
|
|
|
|
|
|
const color = getMainWarningColor(warningData.levels)
|
|
|
|
|
|
// 将颜色转换为半透明填充色,使用E6(约90%透明度)
|
|
|
|
|
|
return color
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 根据预警数据获取区县边框颜色
|
|
|
|
|
|
const getCountyStrokeColor = (countyName) => {
|
|
|
|
|
|
return '#ffffff' // 默认白色
|
|
|
|
|
|
const warningData = getCountyWarningData(countyName)
|
|
|
|
|
|
if (!warningData || !warningData.levels) {
|
|
|
|
|
|
return '' // 默认白色
|
|
|
|
|
|
}
|
|
|
|
|
|
return getMainWarningColor(warningData.levels)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 加载重庆区县 GeoJSON 数据并着色
|
|
|
|
|
|
const loadDistrictGeoJson = async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
// 清除已有的 GeoJSON 图层
|
|
|
|
|
|
if (geoJsonLayer) {
|
|
|
|
|
|
mapInstance.removeLayer(geoJsonLayer)
|
|
|
|
|
|
geoJsonLayer = null
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 清除已有的区县标签
|
|
|
|
|
|
if (window.districtLabelMarkers) {
|
|
|
|
|
|
window.districtLabelMarkers.forEach((marker) => {
|
|
|
|
|
|
if (mapInstance) {
|
|
|
|
|
|
mapInstance.removeLayer(marker)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
window.districtLabelMarkers = []
|
|
|
|
|
|
|
|
|
|
|
|
// 获取 GeoJSON 数据
|
|
|
|
|
|
const response = await fetch(GEOJSON_URL)
|
|
|
|
|
|
if (!response.ok) {
|
|
|
|
|
|
throw new Error(`获取 GeoJSON 数据失败: ${response.status}`)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const geoJsonData = await response.json()
|
|
|
|
|
|
console.log('重庆 GeoJSON 数据:', geoJsonData)
|
|
|
|
|
|
|
|
|
|
|
|
// 处理行政区划合并(渝北+江北=两江新区)
|
|
|
|
|
|
processDistrictMerge(geoJsonData)
|
|
|
|
|
|
|
|
|
|
|
|
// 创建 GeoJSON 图层
|
|
|
|
|
|
geoJsonLayer = window.L.geoJson(geoJsonData, {
|
|
|
|
|
|
style: (feature) => {
|
|
|
|
|
|
const countyName = feature.properties?.name || ''
|
|
|
|
|
|
const fillColor = getCountyFillColor(countyName)
|
|
|
|
|
|
const strokeColor = getCountyStrokeColor(countyName)
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
fillColor: fillColor,
|
|
|
|
|
|
weight: 1,
|
|
|
|
|
|
opacity: 1,
|
|
|
|
|
|
color: strokeColor, // 边框颜色
|
|
|
|
|
|
dashArray: '',
|
|
|
|
|
|
fillOpacity: 0.75, // 增加填充透明度,使颜色更明显
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
onEachFeature: (feature, layer) => {
|
|
|
|
|
|
const countyName = feature.properties?.name || ''
|
|
|
|
|
|
const warningData = getCountyWarningData(countyName)
|
|
|
|
|
|
|
|
|
|
|
|
// 获取区县中心点并添加标签
|
|
|
|
|
|
const bounds = layer.getBounds()
|
|
|
|
|
|
const center = bounds.getCenter()
|
|
|
|
|
|
|
|
|
|
|
|
// 简化区县名称显示,添加尾缀
|
|
|
|
|
|
const simplifyDisplayName = (name) => {
|
|
|
|
|
|
const nameMap = {
|
|
|
|
|
|
彭水苗族土家族自治县: '彭水县',
|
|
|
|
|
|
酉阳土家族苗族自治县: '酉阳县',
|
|
|
|
|
|
秀山土家族苗族自治县: '秀山县',
|
|
|
|
|
|
石柱土家族自治县: '石柱县',
|
|
|
|
|
|
}
|
|
|
|
|
|
// 先检查是否需要特殊处理
|
|
|
|
|
|
if (nameMap[name]) {
|
|
|
|
|
|
return nameMap[name]
|
|
|
|
|
|
}
|
|
|
|
|
|
// 如果已经有"区"或"县"后缀,直接返回
|
|
|
|
|
|
if (name.endsWith('区') || name.endsWith('县')) {
|
|
|
|
|
|
return name
|
|
|
|
|
|
}
|
|
|
|
|
|
// 根据名称判断添加"区"还是"县"
|
|
|
|
|
|
// 重庆主城9区:渝中、大渡口、江北、沙坪坝、九龙坡、南岸、北碚、渝北、巴南
|
|
|
|
|
|
const districtList = ['渝中', '大渡口', '江北', '沙坪坝', '九龙坡', '南岸', '北碚', '渝北', '巴南', '两江新区']
|
|
|
|
|
|
if (districtList.includes(name)) {
|
|
|
|
|
|
return name + '区'
|
|
|
|
|
|
}
|
|
|
|
|
|
// 其他默认添加"县"
|
|
|
|
|
|
return name + '县'
|
|
|
|
|
|
}
|
|
|
|
|
|
const displayName = simplifyDisplayName(countyName)
|
|
|
|
|
|
|
|
|
|
|
|
// 创建区县名称标签
|
|
|
|
|
|
const labelIcon = window.L.divIcon({
|
|
|
|
|
|
className: 'district-name-label',
|
|
|
|
|
|
html: `<div class="district-name-text">${displayName}</div>`,
|
|
|
|
|
|
iconSize: [80, 20],
|
|
|
|
|
|
iconAnchor: [40, 10],
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const labelMarker = window.L.marker(center, {
|
|
|
|
|
|
icon: labelIcon,
|
|
|
|
|
|
interactive: false,
|
|
|
|
|
|
zIndexOffset: 300,
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
labelMarker.addTo(mapInstance)
|
|
|
|
|
|
window.districtLabelMarkers.push(labelMarker)
|
|
|
|
|
|
|
|
|
|
|
|
// 获取当前区县的边框颜色
|
|
|
|
|
|
const strokeColor = getCountyStrokeColor(countyName)
|
|
|
|
|
|
|
|
|
|
|
|
// 添加交互事件
|
|
|
|
|
|
layer.on({
|
|
|
|
|
|
mouseover: (e) => {
|
|
|
|
|
|
const targetLayer = e.target
|
|
|
|
|
|
// 悬浮时高亮边框,使用当前区县的边框颜色,加粗边框
|
|
|
|
|
|
targetLayer.setStyle({
|
|
|
|
|
|
weight: 4,
|
|
|
|
|
|
color: strokeColor,
|
|
|
|
|
|
fillOpacity: 0.85, // 悬浮时填充更明显的颜色
|
|
|
|
|
|
})
|
|
|
|
|
|
// 将当前图层置于最上层,避免被相邻区县遮挡
|
|
|
|
|
|
targetLayer.bringToFront()
|
|
|
|
|
|
},
|
|
|
|
|
|
mouseout: (e) => {
|
|
|
|
|
|
const targetLayer = e.target
|
|
|
|
|
|
// 恢复原始样式
|
|
|
|
|
|
geoJsonLayer.resetStyle(targetLayer)
|
|
|
|
|
|
},
|
|
|
|
|
|
click: (e) => {
|
|
|
|
|
|
const targetLayer = e.target
|
|
|
|
|
|
const bounds = targetLayer.getBounds()
|
|
|
|
|
|
mapInstance.fitBounds(bounds, { padding: [50, 50] })
|
|
|
|
|
|
|
|
|
|
|
|
// 触发区县点击事件
|
|
|
|
|
|
emit('districtClick', {
|
|
|
|
|
|
name: countyName,
|
|
|
|
|
|
data: warningData || { total: 0, levels: {} },
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// 添加图层到地图
|
|
|
|
|
|
geoJsonLayer.addTo(mapInstance)
|
|
|
|
|
|
console.log('已添加区县 GeoJSON 图层')
|
|
|
|
|
|
|
|
|
|
|
|
// 将 GeoJSON 图层置于底图之上,其他标记之下
|
|
|
|
|
|
geoJsonLayer.setZIndex(100)
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
console.error('加载区县 GeoJSON 数据失败:', err)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-08 18:47:57 +08:00
|
|
|
|
// 根据预警等级获取颜色
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const getColorByLevel = (level) => {
|
2026-04-08 18:47:57 +08:00
|
|
|
|
const colorMap = {
|
2026-04-17 14:50:25 +08:00
|
|
|
|
红色预警: '#912210',
|
|
|
|
|
|
橙色预警: '#BA6527',
|
|
|
|
|
|
黄色预警: '#A47109',
|
|
|
|
|
|
蓝色预警: '#185A91',
|
|
|
|
|
|
未知: '#1890ff',
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
return colorMap[level] || '#1890ff'
|
|
|
|
|
|
}
|
2026-03-31 18:10:34 +08:00
|
|
|
|
// 初始化地图
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const initMap = async () => {
|
|
|
|
|
|
if (!mapContainer.value) return
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
2026-03-31 18:10:34 +08:00
|
|
|
|
try {
|
|
|
|
|
|
// 清除旧地图实例
|
|
|
|
|
|
if (mapInstance) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
mapInstance.remove()
|
2026-03-31 18:10:34 +08:00
|
|
|
|
}
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
2026-03-31 18:10:34 +08:00
|
|
|
|
// 创建地图实例
|
|
|
|
|
|
mapInstance = new window.L.Map(mapContainer.value, {
|
|
|
|
|
|
center: [29.563, 106.551], // 重庆中心坐标
|
2026-04-09 14:53:44 +08:00
|
|
|
|
zoom: 8,
|
2026-04-02 16:35:45 +08:00
|
|
|
|
minZoom: 6,
|
2026-03-31 18:10:34 +08:00
|
|
|
|
maxZoom: 18,
|
|
|
|
|
|
zoomControl: false,
|
2026-04-02 16:35:45 +08:00
|
|
|
|
attributionControl: false,
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// 获取天地图配置
|
|
|
|
|
|
const tdtConfig = await getTiandituConfig()
|
|
|
|
|
|
|
|
|
|
|
|
// 添加天地图影像底图
|
|
|
|
|
|
if (tdtConfig && tdtConfig.imgLayer && tdtConfig.imgLayer.servicePath) {
|
|
|
|
|
|
let servicePath = tdtConfig.imgLayer.servicePath
|
|
|
|
|
|
// 确保包含 tk 参数(天地图密钥)
|
|
|
|
|
|
if (!servicePath.includes('tk=')) {
|
|
|
|
|
|
// 使用默认的测试密钥,生产环境应该替换为正式密钥
|
|
|
|
|
|
servicePath += '&tk=b78ed71126d03ee82ce658731344a897'
|
|
|
|
|
|
}
|
|
|
|
|
|
// 天地图 URL 格式为 https://t{s}.tianditu.gov.cn/...
|
|
|
|
|
|
// subdomains 应该配置为 ['0', '1', ...] 以生成 t0, t1 等子域名
|
|
|
|
|
|
const tileLayer = new window.L.TileLayer(servicePath, {
|
|
|
|
|
|
subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
|
|
|
|
|
|
maxZoom: 18,
|
|
|
|
|
|
attribution: '天地图',
|
|
|
|
|
|
})
|
|
|
|
|
|
mapInstance.addLayer(tileLayer)
|
|
|
|
|
|
console.log('已添加天地图影像底图:', tdtConfig.imgLayer.name)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
console.warn('未获取到天地图影像底图配置,使用备用底图')
|
|
|
|
|
|
// 使用备用底图
|
|
|
|
|
|
const backupLayer = new window.L.TileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
|
|
|
|
subdomains: ['a', 'b', 'c'],
|
|
|
|
|
|
maxZoom: 19,
|
|
|
|
|
|
attribution: 'OpenStreetMap',
|
|
|
|
|
|
})
|
|
|
|
|
|
mapInstance.addLayer(backupLayer)
|
|
|
|
|
|
}
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
// 添加天地图行政区划图层(边界线)
|
|
|
|
|
|
if (tdtConfig && tdtConfig.boundaryLayer && tdtConfig.boundaryLayer.servicePath) {
|
|
|
|
|
|
let boundaryPath = tdtConfig.boundaryLayer.servicePath
|
|
|
|
|
|
// 确保包含 tk 参数
|
|
|
|
|
|
if (!boundaryPath.includes('tk=')) {
|
|
|
|
|
|
boundaryPath += '&tk=b78ed71126d03ee82ce658731344a897'
|
|
|
|
|
|
}
|
|
|
|
|
|
const boundaryLayer = new window.L.TileLayer(boundaryPath, {
|
|
|
|
|
|
subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
|
|
|
|
|
|
maxZoom: 18,
|
|
|
|
|
|
attribution: '天地图行政区划',
|
|
|
|
|
|
})
|
|
|
|
|
|
mapInstance.addLayer(boundaryLayer)
|
|
|
|
|
|
console.log('已添加天地图行政区划图层:', tdtConfig.boundaryLayer.name)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
console.warn('未获取到天地图行政区划图层配置')
|
|
|
|
|
|
}
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
// 加载重庆区县 GeoJSON 并着色
|
|
|
|
|
|
await loadDistrictGeoJson()
|
|
|
|
|
|
|
|
|
|
|
|
// 根据区县统计数据添加区县标记(使用固定坐标)
|
|
|
|
|
|
const districtCenters = {
|
|
|
|
|
|
渝中: [29.563, 106.571],
|
|
|
|
|
|
江北: [29.575, 106.573],
|
|
|
|
|
|
南岸: [29.523, 106.613],
|
|
|
|
|
|
九龙坡: [29.523, 106.513],
|
|
|
|
|
|
沙坪坝: [29.543, 106.453],
|
|
|
|
|
|
大渡口: [29.488, 106.483],
|
|
|
|
|
|
北碚: [29.803, 106.403],
|
|
|
|
|
|
渝北: [29.713, 106.623],
|
|
|
|
|
|
巴南: [29.383, 106.523],
|
|
|
|
|
|
万州: [30.803, 108.403],
|
|
|
|
|
|
涪陵: [29.703, 107.393],
|
|
|
|
|
|
永川: [29.353, 105.893],
|
|
|
|
|
|
合川: [29.973, 106.273],
|
|
|
|
|
|
江津: [29.283, 106.253],
|
|
|
|
|
|
南川: [29.153, 107.093],
|
|
|
|
|
|
綦江: [29.023, 106.653],
|
|
|
|
|
|
大足: [29.703, 105.713],
|
|
|
|
|
|
璧山: [29.593, 106.223],
|
|
|
|
|
|
铜梁: [29.843, 106.053],
|
|
|
|
|
|
潼南: [30.183, 105.833],
|
|
|
|
|
|
荣昌: [29.403, 105.593],
|
|
|
|
|
|
开州: [31.163, 108.393],
|
|
|
|
|
|
梁平: [30.673, 107.803],
|
|
|
|
|
|
武隆: [29.323, 107.753],
|
|
|
|
|
|
城口: [31.943, 108.663],
|
|
|
|
|
|
丰都: [29.863, 107.723],
|
|
|
|
|
|
垫江: [30.323, 107.333],
|
|
|
|
|
|
忠县: [30.303, 108.033],
|
|
|
|
|
|
云阳: [30.933, 108.693],
|
|
|
|
|
|
奉节: [31.023, 109.463],
|
|
|
|
|
|
巫山: [31.073, 109.873],
|
|
|
|
|
|
巫溪: [31.403, 109.633],
|
|
|
|
|
|
石柱: [30.003, 108.113],
|
|
|
|
|
|
秀山: [28.453, 108.993],
|
|
|
|
|
|
酉阳: [28.843, 108.773],
|
|
|
|
|
|
彭水: [29.293, 108.173],
|
|
|
|
|
|
两江: [29.723, 106.583],
|
|
|
|
|
|
}
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
// 根据统计数据添加区县标签
|
|
|
|
|
|
if (affectedCountyData.value && affectedCountyData.value.byName) {
|
|
|
|
|
|
Object.entries(affectedCountyData.value.byName).forEach(([districtName, data]) => {
|
|
|
|
|
|
const center = districtCenters[districtName]
|
|
|
|
|
|
if (center) {
|
|
|
|
|
|
const displayName = districtName
|
2026-04-02 16:35:45 +08:00
|
|
|
|
const label = window.L.divIcon({
|
2026-04-17 14:50:25 +08:00
|
|
|
|
className: 'district-label',
|
2026-04-08 15:34:49 +08:00
|
|
|
|
html: `<div class="label-content">${displayName}</div>`,
|
2026-04-02 16:35:45 +08:00
|
|
|
|
iconSize: [80, 30],
|
|
|
|
|
|
iconAnchor: [40, 15],
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const marker = window.L.marker(center, {
|
2026-04-21 15:34:43 +08:00
|
|
|
|
icon: label,
|
2026-05-07 09:32:05 +08:00
|
|
|
|
interactive: false,
|
|
|
|
|
|
zIndexOffset: 500,
|
|
|
|
|
|
})
|
|
|
|
|
|
marker.addTo(mapInstance)
|
2026-03-31 18:10:34 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
|
|
|
|
|
}
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
2026-03-31 18:10:34 +08:00
|
|
|
|
// 调整视图以适应重庆边界
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const chongqingBounds = [
|
|
|
|
|
|
[28.0, 105.0], // 西南角
|
|
|
|
|
|
[32.0, 110.0], // 东北角
|
|
|
|
|
|
]
|
|
|
|
|
|
mapInstance.fitBounds(chongqingBounds)
|
2026-03-31 18:10:34 +08:00
|
|
|
|
} catch (err) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.error('初始化地图失败:', err)
|
|
|
|
|
|
error.value = '地图初始化失败'
|
2026-03-31 18:10:34 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-03-31 18:10:34 +08:00
|
|
|
|
|
2026-04-15 16:40:35 +08:00
|
|
|
|
// 监听 activeitem 变化
|
2026-04-08 18:47:57 +08:00
|
|
|
|
watch(
|
2026-04-15 16:40:35 +08:00
|
|
|
|
() => props.activeitem,
|
2026-05-07 09:32:05 +08:00
|
|
|
|
async (newVal) => {
|
|
|
|
|
|
console.log('activeitem 变化:', newVal)
|
2026-04-15 16:40:35 +08:00
|
|
|
|
switch (newVal.label) {
|
2026-04-17 14:50:25 +08:00
|
|
|
|
case '涉灾隐患点':
|
|
|
|
|
|
// 点击涉灾隐患点时,获取所有风险点数据
|
2026-05-07 09:32:05 +08:00
|
|
|
|
await getRiskPointData()
|
|
|
|
|
|
break
|
|
|
|
|
|
case '驻地':
|
|
|
|
|
|
await getAffectedProjectData(false)
|
|
|
|
|
|
break
|
2026-04-17 14:50:25 +08:00
|
|
|
|
case '隧道':
|
2026-05-07 09:32:05 +08:00
|
|
|
|
await getAffectedTunnelData(false)
|
|
|
|
|
|
break
|
2026-04-17 14:50:25 +08:00
|
|
|
|
case '边坡':
|
2026-05-07 09:32:05 +08:00
|
|
|
|
break
|
2026-04-17 14:50:25 +08:00
|
|
|
|
case '桥梁':
|
2026-05-07 09:32:05 +08:00
|
|
|
|
await getAffectedBridgeData(false)
|
|
|
|
|
|
break
|
2026-04-17 14:50:25 +08:00
|
|
|
|
case '路段':
|
2026-05-07 09:32:05 +08:00
|
|
|
|
await getAffectedRoadSectionData(false)
|
|
|
|
|
|
break
|
2026-04-17 14:50:25 +08:00
|
|
|
|
case '队伍':
|
2026-05-07 09:32:05 +08:00
|
|
|
|
await getEmergencyForceData()
|
|
|
|
|
|
break
|
2026-04-28 09:20:54 +08:00
|
|
|
|
case '危大工程':
|
2026-05-07 09:32:05 +08:00
|
|
|
|
await getDangerProjectData(false)
|
|
|
|
|
|
break
|
2026-04-08 18:47:57 +08:00
|
|
|
|
default:
|
2026-05-07 09:32:05 +08:00
|
|
|
|
break
|
2026-04-08 18:47:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2026-05-07 09:32:05 +08:00
|
|
|
|
{ immediate: false },
|
|
|
|
|
|
)
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
2026-04-17 14:50:25 +08:00
|
|
|
|
// 处理隐患点点击事件
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const handleHazardItemClick = async (item, flag) => {
|
|
|
|
|
|
console.log('处理隐患点点击:', item)
|
2026-04-17 14:50:25 +08:00
|
|
|
|
// 根据隐患点类型映射风险等级
|
|
|
|
|
|
const riskLevelMap = {
|
|
|
|
|
|
重大路内隐患点: '重大隐患',
|
|
|
|
|
|
重大路外隐患点: '重大隐患',
|
|
|
|
|
|
较大路内隐患点: '较大隐患',
|
|
|
|
|
|
较大路外隐患点: '较大隐患',
|
|
|
|
|
|
一般路内隐患点: '一般隐患',
|
|
|
|
|
|
一般路外隐患点: '一般隐患',
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
const riskLevel = riskLevelMap[item.label] || ''
|
|
|
|
|
|
await getRiskPointData(riskLevel, item, flag)
|
|
|
|
|
|
}
|
2026-04-17 14:50:25 +08:00
|
|
|
|
|
2026-04-09 14:53:44 +08:00
|
|
|
|
// 监听 dateRange 变化,重新加载数据
|
|
|
|
|
|
watch(
|
|
|
|
|
|
() => props.dateRange,
|
2026-04-13 16:38:07 +08:00
|
|
|
|
async (newVal, oldVal) => {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.log('dateRange 变化:', newVal, oldVal)
|
2026-04-13 16:38:07 +08:00
|
|
|
|
// 先重新加载受影响区县数据
|
2026-05-07 09:32:05 +08:00
|
|
|
|
clearProjectMarkers() // 清除项目标记
|
|
|
|
|
|
|
|
|
|
|
|
await getAffectedCountyData()
|
|
|
|
|
|
},
|
|
|
|
|
|
{ deep: true },
|
|
|
|
|
|
)
|
2026-04-28 09:20:54 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
// 监听 affectedCountyData 变化,重新加载区县 GeoJSON 着色
|
|
|
|
|
|
watch(
|
|
|
|
|
|
() => affectedCountyData.value,
|
|
|
|
|
|
async (newVal) => {
|
|
|
|
|
|
console.log('affectedCountyData 变化,重新加载区县着色:', newVal)
|
|
|
|
|
|
if (mapInstance && newVal && newVal.byName) {
|
|
|
|
|
|
await loadDistrictGeoJson()
|
|
|
|
|
|
}
|
2026-04-09 14:53:44 +08:00
|
|
|
|
},
|
2026-05-07 09:32:05 +08:00
|
|
|
|
{ deep: true },
|
|
|
|
|
|
)
|
2026-04-09 14:53:44 +08:00
|
|
|
|
|
2026-03-31 18:10:34 +08:00
|
|
|
|
// 组件挂载时加载地图
|
|
|
|
|
|
onMounted(() => {
|
2026-04-08 15:34:49 +08:00
|
|
|
|
// 获取受影响对象数据
|
2026-05-07 09:32:05 +08:00
|
|
|
|
getAffectedCountyData()
|
2026-04-08 15:34:49 +08:00
|
|
|
|
|
2026-04-02 16:35:45 +08:00
|
|
|
|
// 检查 Leaflet 是否已加载
|
2026-04-17 14:50:25 +08:00
|
|
|
|
if (typeof window.L === 'undefined') {
|
2026-04-02 16:35:45 +08:00
|
|
|
|
// 动态加载 Leaflet CSS 和 JS
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const link = document.createElement('link')
|
|
|
|
|
|
link.rel = 'stylesheet'
|
|
|
|
|
|
link.href = 'https://unpkg.com/leaflet@1.9.4/dist/leaflet.css'
|
|
|
|
|
|
link.integrity = 'sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY='
|
|
|
|
|
|
link.crossOrigin = ''
|
|
|
|
|
|
document.head.appendChild(link)
|
|
|
|
|
|
|
|
|
|
|
|
const script = document.createElement('script')
|
|
|
|
|
|
script.src = 'https://unpkg.com/leaflet@1.9.4/dist/leaflet.js'
|
|
|
|
|
|
script.integrity = 'sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo='
|
|
|
|
|
|
script.crossOrigin = ''
|
|
|
|
|
|
script.onload = loadMapData
|
|
|
|
|
|
document.head.appendChild(script)
|
2026-03-31 18:10:34 +08:00
|
|
|
|
} else {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
loadMapData()
|
2026-03-31 18:10:34 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-03-31 18:10:34 +08:00
|
|
|
|
|
|
|
|
|
|
// 组件卸载时清理资源
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
|
|
if (mapInstance) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
mapInstance.remove()
|
|
|
|
|
|
mapInstance = null
|
2026-03-31 18:10:34 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
2026-04-13 11:38:11 +08:00
|
|
|
|
// 根据区县名称定位地图
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const locateToDistrict = (countyName) => {
|
2026-04-13 11:38:11 +08:00
|
|
|
|
if (!mapInstance || !geoJsonLayer) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.warn('地图未初始化,无法定位')
|
|
|
|
|
|
return
|
2026-04-13 11:38:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 简化区县名称
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const simplifyName = (name) => {
|
|
|
|
|
|
return name.replace('土家族苗族自治县', '').replace('苗族土家族自治县', '').replace('自治县', '').replace('区', '').replace('县', '')
|
|
|
|
|
|
}
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const targetName = simplifyName(countyName)
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 查找对应的区县图层
|
2026-05-07 09:32:05 +08:00
|
|
|
|
let targetLayer = null
|
|
|
|
|
|
geoJsonLayer.eachLayer((layer) => {
|
|
|
|
|
|
const layerName = layer.feature?.properties?.name || ''
|
2026-04-13 11:38:11 +08:00
|
|
|
|
if (simplifyName(layerName) === targetName) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
targetLayer = layer
|
2026-04-13 11:38:11 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
if (targetLayer) {
|
|
|
|
|
|
// 获取区县的中心点
|
2026-05-07 09:32:05 +08:00
|
|
|
|
const bounds = targetLayer.getBounds()
|
|
|
|
|
|
const center = bounds.getCenter()
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 移动地图到该中心点并放大
|
2026-04-16 14:03:39 +08:00
|
|
|
|
// mapInstance.setView(center, 10);
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 高亮显示该区县
|
|
|
|
|
|
if (selectedLayer) {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
geoJsonLayer.resetStyle(selectedLayer)
|
2026-04-13 11:38:11 +08:00
|
|
|
|
}
|
2026-04-13 14:54:48 +08:00
|
|
|
|
// targetLayer.setStyle({
|
|
|
|
|
|
// fillColor: "#ff7a00",
|
|
|
|
|
|
// fillOpacity: 0.6,
|
|
|
|
|
|
// weight: 3,
|
|
|
|
|
|
// color: "#ff4d4f",
|
|
|
|
|
|
// });
|
2026-05-07 09:32:05 +08:00
|
|
|
|
selectedLayer = targetLayer
|
2026-04-13 11:38:11 +08:00
|
|
|
|
} else {
|
2026-05-07 09:32:05 +08:00
|
|
|
|
console.warn('未找到区县:', countyName)
|
2026-04-13 11:38:11 +08:00
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
}
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
2026-04-08 18:47:57 +08:00
|
|
|
|
// 暴露方法给父组件调用
|
|
|
|
|
|
defineExpose({
|
|
|
|
|
|
getEmergencyForceData,
|
|
|
|
|
|
clearProjectMarkers,
|
2026-04-13 11:38:11 +08:00
|
|
|
|
openCenterCard,
|
|
|
|
|
|
locateToDistrict,
|
2026-04-17 14:50:25 +08:00
|
|
|
|
handleHazardItemClick,
|
|
|
|
|
|
getRiskPointData,
|
2026-05-07 09:32:05 +08:00
|
|
|
|
})
|
2026-03-31 18:10:34 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
2026-04-02 16:35:45 +08:00
|
|
|
|
<style lang="scss">
|
|
|
|
|
|
// 区县标签样式(需要全局样式,因为 Leaflet 动态添加元素)
|
|
|
|
|
|
.district-label {
|
|
|
|
|
|
background: transparent !important;
|
|
|
|
|
|
border: none !important;
|
|
|
|
|
|
|
|
|
|
|
|
.label-content {
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
padding: vw(4) vw(8);
|
|
|
|
|
|
border-radius: vw(2);
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
text-shadow:
|
|
|
|
|
|
0 1px 3px rgba(0, 0, 0, 0.8),
|
|
|
|
|
|
0 0 2px rgba(0, 0, 0, 0.5);
|
|
|
|
|
|
letter-spacing: 0.5px;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
width: fit-content;
|
|
|
|
|
|
transition: all 0.3s;
|
|
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
color: #40a9ff;
|
|
|
|
|
|
text-shadow: 0 0 10px rgba(64, 169, 255, 0.8);
|
|
|
|
|
|
transform: scale(1.05);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-05-07 09:32:05 +08:00
|
|
|
|
|
|
|
|
|
|
// 区县名称标签样式
|
|
|
|
|
|
.district-name-label {
|
|
|
|
|
|
background: transparent !important;
|
|
|
|
|
|
border: none !important;
|
|
|
|
|
|
|
|
|
|
|
|
.district-name-text {
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
text-shadow:
|
|
|
|
|
|
0 1px 3px rgba(0, 0, 0, 0.9),
|
|
|
|
|
|
0 0 4px rgba(0, 0, 0, 0.7);
|
|
|
|
|
|
letter-spacing: 1px;
|
|
|
|
|
|
pointer-events: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 区县弹窗样式
|
|
|
|
|
|
:deep(.county-popup) {
|
|
|
|
|
|
.leaflet-popup-content-wrapper {
|
|
|
|
|
|
background: rgba(0, 20, 40, 0.95);
|
|
|
|
|
|
border: 1px solid rgba(64, 169, 255, 0.5);
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.leaflet-popup-content {
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
line-height: 1.5;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.leaflet-popup-tip {
|
|
|
|
|
|
background: rgba(0, 20, 40, 0.95);
|
|
|
|
|
|
border: 1px solid rgba(64, 169, 255, 0.5);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.leaflet-popup-close-button {
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
|
padding: 4px;
|
|
|
|
|
|
transition: color 0.3s;
|
|
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
color: #40a9ff;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-04-02 16:35:45 +08:00
|
|
|
|
</style>
|
|
|
|
|
|
|
2026-03-31 18:10:34 +08:00
|
|
|
|
<style lang="scss" scoped>
|
2026-04-02 16:35:45 +08:00
|
|
|
|
// 视频屏幕自适应 - 基于视口宽度动态调整
|
|
|
|
|
|
@function vw($px) {
|
|
|
|
|
|
@return calc($px / 1920 * 100vw);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-31 18:10:34 +08:00
|
|
|
|
.chongqing-map-container {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.map-container {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.loading-overlay,
|
|
|
|
|
|
.error-overlay {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
background: rgba(0, 0, 0, 0.7);
|
|
|
|
|
|
z-index: 1000;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.loading-spinner {
|
2026-04-02 16:35:45 +08:00
|
|
|
|
width: vw(40);
|
|
|
|
|
|
height: vw(40);
|
|
|
|
|
|
border: vw(4) solid #3b82f6;
|
|
|
|
|
|
border-top: vw(4) solid transparent;
|
2026-03-31 18:10:34 +08:00
|
|
|
|
border-radius: 50%;
|
|
|
|
|
|
animation: spin 1s linear infinite;
|
2026-04-02 16:35:45 +08:00
|
|
|
|
margin-bottom: vw(10);
|
2026-03-31 18:10:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.loading-text {
|
|
|
|
|
|
color: #fff;
|
2026-04-02 16:35:45 +08:00
|
|
|
|
font-size: vw(14);
|
2026-03-31 18:10:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.error-text {
|
|
|
|
|
|
color: #ff6b6b;
|
2026-04-02 16:35:45 +08:00
|
|
|
|
font-size: vw(14);
|
|
|
|
|
|
margin-bottom: vw(10);
|
2026-03-31 18:10:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.retry-btn {
|
2026-04-02 16:35:45 +08:00
|
|
|
|
background: #3b82f6;
|
2026-03-31 18:10:34 +08:00
|
|
|
|
color: white;
|
|
|
|
|
|
border: none;
|
2026-04-02 16:35:45 +08:00
|
|
|
|
padding: vw(8) vw(16);
|
|
|
|
|
|
border-radius: vw(4);
|
2026-03-31 18:10:34 +08:00
|
|
|
|
cursor: pointer;
|
2026-04-02 16:35:45 +08:00
|
|
|
|
font-size: vw(12);
|
|
|
|
|
|
|
2026-03-31 18:10:34 +08:00
|
|
|
|
&:hover {
|
2026-04-02 16:35:45 +08:00
|
|
|
|
background: #2563eb;
|
2026-03-31 18:10:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@keyframes spin {
|
2026-04-02 16:35:45 +08:00
|
|
|
|
0% {
|
|
|
|
|
|
transform: rotate(0deg);
|
|
|
|
|
|
}
|
|
|
|
|
|
100% {
|
|
|
|
|
|
transform: rotate(360deg);
|
|
|
|
|
|
}
|
2026-03-31 18:10:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-04-02 16:35:45 +08:00
|
|
|
|
// Leaflet 地图样式覆盖
|
2026-03-31 18:10:34 +08:00
|
|
|
|
:deep(.leaflet-container) {
|
|
|
|
|
|
background: #0f1c2e !important;
|
2026-04-08 18:47:57 +08:00
|
|
|
|
.leaflet-popup {
|
|
|
|
|
|
left: -20px !important;
|
|
|
|
|
|
}
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
2026-03-31 18:10:34 +08:00
|
|
|
|
.leaflet-popup-content-wrapper {
|
2026-04-02 16:35:45 +08:00
|
|
|
|
background: rgba(24, 144, 255, 0.95);
|
|
|
|
|
|
border-radius: vw(4);
|
|
|
|
|
|
padding: vw(6) vw(12);
|
|
|
|
|
|
min-width: vw(80);
|
|
|
|
|
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
|
|
|
|
|
|
|
2026-03-31 18:10:34 +08:00
|
|
|
|
.map-popup {
|
|
|
|
|
|
color: #fff;
|
2026-04-02 16:35:45 +08:00
|
|
|
|
font-size: vw(12);
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
font-weight: 500;
|
2026-03-31 18:10:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
2026-03-31 18:10:34 +08:00
|
|
|
|
.leaflet-popup-tip {
|
2026-04-02 16:35:45 +08:00
|
|
|
|
background: rgba(24, 144, 255, 0.95);
|
2026-03-31 18:10:34 +08:00
|
|
|
|
}
|
2026-04-02 16:35:45 +08:00
|
|
|
|
|
|
|
|
|
|
.leaflet-popup-content {
|
|
|
|
|
|
width: max-content !important;
|
|
|
|
|
|
margin: vw(10) 10px vw(10) 0;
|
|
|
|
|
|
line-height: 1.3;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 区县高亮样式
|
|
|
|
|
|
:deep(.leaflet-interactive) {
|
|
|
|
|
|
transition: all 0.3s;
|
|
|
|
|
|
cursor: pointer;
|
2026-03-31 18:10:34 +08:00
|
|
|
|
}
|
2026-04-08 18:47:57 +08:00
|
|
|
|
|
|
|
|
|
|
.project-popup {
|
|
|
|
|
|
width: vw(120);
|
|
|
|
|
|
height: vw(20);
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
font-size: vw(12);
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
padding: 15px;
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
}
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
// 区县卡片样式
|
|
|
|
|
|
:deep(.county-card-icon) {
|
|
|
|
|
|
background: transparent !important;
|
|
|
|
|
|
border: none !important;
|
|
|
|
|
|
|
2026-04-15 16:40:35 +08:00
|
|
|
|
// .center-info-card-container {
|
|
|
|
|
|
// width: 100%;
|
|
|
|
|
|
// min-width: 120px;
|
|
|
|
|
|
// }
|
2026-04-13 11:38:11 +08:00
|
|
|
|
|
|
|
|
|
|
.center-info-card {
|
2026-05-07 15:59:49 +08:00
|
|
|
|
// box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
|
2026-04-13 11:38:11 +08:00
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
transition: all 0.3s;
|
|
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
transform: translateY(-2px);
|
|
|
|
|
|
box-shadow: 0 6px 20px rgba(24, 144, 255, 0.5);
|
|
|
|
|
|
filter: brightness(1.1);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-04-02 16:35:45 +08:00
|
|
|
|
</style>
|