|
|
@@ -1,2016 +0,0 @@
|
|
|
-<template>
|
|
|
- <div class="map-page">
|
|
|
- <div ref="mapContainer"
|
|
|
- class="map-container"
|
|
|
- ></div>
|
|
|
- <div v-if="error" class="error">{{ error }}</div>
|
|
|
- <!-- 覆盖层控制 -->
|
|
|
- <div class="control-panel">
|
|
|
- <label>
|
|
|
- <input type="checkbox" v-model="state.showOverlay" @change="toggleOverlay" />
|
|
|
- 显示土壤类型覆盖
|
|
|
- </label>
|
|
|
- </div>
|
|
|
- <div class="control-panel">
|
|
|
- <label>
|
|
|
- <input type="checkbox" v-model="state.showSoilTypes" @change="toggleSoilTypeLayer" />
|
|
|
- 显示韶关市评估单元
|
|
|
- </label>
|
|
|
- <label>
|
|
|
- <input type="checkbox" v-model="state.showSurveyData" @change="toggleSurveyDataLayer" />
|
|
|
- 显示韶关市调查数据
|
|
|
- </label>
|
|
|
- <!-- 截图控制 -->
|
|
|
- <div class="export-controls">
|
|
|
- <button @click="exportMapImage" :disabled="!isMapReady">
|
|
|
- {{ isExporting ? '生成中...' : '导出截图' }}
|
|
|
- </button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script setup>
|
|
|
-import { ref, reactive, onMounted, onBeforeUnmount } from 'vue'
|
|
|
-import html2canvas from 'html2canvas'
|
|
|
-
|
|
|
-const isExporting = ref(false)
|
|
|
-const isMapReady = ref(false)
|
|
|
-const exportSettings = reactive({
|
|
|
- quality: 0.9,
|
|
|
- showMapControls: false,
|
|
|
- showWatermark: true
|
|
|
-})
|
|
|
-const mapContainer = ref(null)
|
|
|
-const activeMarker = ref(null)
|
|
|
-const error = ref(null)
|
|
|
-const TMap = ref(null);
|
|
|
-let activeTempMarker = ref(null)
|
|
|
-let infoWindow = ref(null)
|
|
|
-let map = null
|
|
|
-let markersLayer = null
|
|
|
-let markersVectorLayer=null;//标记点向量图层
|
|
|
-let soilTypeVectorLayer=null;//土壤类型多边形图层
|
|
|
-let overlay = null
|
|
|
-const state = reactive({
|
|
|
- showOverlay: false,
|
|
|
- showSoilTypes: true,
|
|
|
- showSurveyData: true,
|
|
|
- excelData: [],
|
|
|
- lastTapTime: 0
|
|
|
-})
|
|
|
-let soilTypeLayer = null
|
|
|
-let geoJSONLayer;
|
|
|
-let currentInfoWindow = null;
|
|
|
-let surveyDataLayer = ref(null);
|
|
|
-let multiPolygon;
|
|
|
-
|
|
|
-const categoryColors = { // 分类颜色配置
|
|
|
- '优先保护类': '#00C853', // 绿色
|
|
|
- '安全利用类': '#FFD600', // 黄色
|
|
|
- '严格管控类': '#D50000' // 红色
|
|
|
-};
|
|
|
-
|
|
|
-const tMapConfig = reactive({
|
|
|
- key: import.meta.env.VITE_TMAP_KEY, // 请替换为你的开发者密钥
|
|
|
- geocoderURL: 'https://apis.map.qq.com/ws/geocoder/v1/'
|
|
|
-})
|
|
|
-
|
|
|
-
|
|
|
-const loadSDK = () => {
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- if (window.TMap?.service?.Geocoder) {
|
|
|
- TMap.value = window.TMap
|
|
|
- return resolve(window.TMap)
|
|
|
- }
|
|
|
-
|
|
|
- const script = document.createElement('script')
|
|
|
- script.src = `https://map.qq.com/api/gljs?v=2.exp&libraries=basic,service,vector&key=${tMapConfig.key}&callback=initTMap`
|
|
|
- window.initTMap = () => {
|
|
|
- if (!window.TMap?.service?.Geocoder) {
|
|
|
- reject(new Error('地图SDK加载失败'))
|
|
|
- return
|
|
|
- }
|
|
|
- TMap.value = window.TMap
|
|
|
- resolve(window.TMap)
|
|
|
- }
|
|
|
-
|
|
|
- script.onerror = (err) => {
|
|
|
- reject(`地图资源加载失败: ${err.message}`)
|
|
|
- document.head.removeChild(script)
|
|
|
- }
|
|
|
-
|
|
|
- document.head.appendChild(script)
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-// 初始化数据
|
|
|
-const initData = () => {
|
|
|
- state.excelData = [
|
|
|
- {
|
|
|
- "water_sample_ID": "water1",
|
|
|
- "sampling_location": "广东省韶关市乳源瑶族自治县大布镇·914乡道",
|
|
|
- "sample_time": "2024.5.21 8:51",
|
|
|
- "sample_code": "W36",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.161073,
|
|
|
- "longitude": 24.54181,
|
|
|
- "weather": "中雨",
|
|
|
- "storage_container_material": "聚乙烯",
|
|
|
- "storage_container_color": "白色",
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": "无色、无沉淀",
|
|
|
- "water_quality": "无味、无悬浮物",
|
|
|
- "water_environment": "河流",
|
|
|
- "storage_method": "①②③",
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water2",
|
|
|
- "sampling_location": "广东省韶关市乳源瑶族自治县大布镇·枫树窝",
|
|
|
- "sample_time": "2024.5.21 11:29",
|
|
|
- "sample_code": "W40",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.075739,
|
|
|
- "longitude": 24.505885,
|
|
|
- "weather": "小雨",
|
|
|
- "storage_container_material": "聚乙烯",
|
|
|
- "storage_container_color": "白色",
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": "无色、无沉淀",
|
|
|
- "water_quality": "无味、无悬浮物",
|
|
|
- "water_environment": "水渠",
|
|
|
- "storage_method": "①②③",
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water3",
|
|
|
- "sampling_location": "广东省韶关市乳源瑶族自治县大布镇·蓓蕾幼儿园",
|
|
|
- "sample_time": "2024.5.21 9:25",
|
|
|
- "sample_code": "W48",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.134857,
|
|
|
- "longitude": 24.548262,
|
|
|
- "weather": "小雨",
|
|
|
- "storage_container_material": "聚乙烯",
|
|
|
- "storage_container_color": "白色",
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": "无色、无沉淀",
|
|
|
- "water_quality": "无味、无悬浮物",
|
|
|
- "water_environment": "河流",
|
|
|
- "storage_method": "①②③",
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water4",
|
|
|
- "sampling_location": "广东省韶关市乳源瑶族自治县大布镇·258省道",
|
|
|
- "sample_time": "2024.5.21 10:02",
|
|
|
- "sample_code": "W49",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.122959,
|
|
|
- "longitude": 24.542255,
|
|
|
- "weather": "小雨",
|
|
|
- "storage_container_material": "聚乙烯",
|
|
|
- "storage_container_color": "白色",
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": "稍浑浊、有沉淀",
|
|
|
- "water_quality": "无味、无悬浮物",
|
|
|
- "water_environment": "河流",
|
|
|
- "storage_method": "①②③",
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water5",
|
|
|
- "sampling_location": "广东省韶关市乳源瑶族自治县大布镇·圳下",
|
|
|
- "sample_time": "2024.5.21 10:23",
|
|
|
- "sample_code": "W50",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.115802,
|
|
|
- "longitude": 24.540335,
|
|
|
- "weather": "小雨",
|
|
|
- "storage_container_material": "聚乙烯",
|
|
|
- "storage_container_color": "白色",
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": "无色、无沉淀",
|
|
|
- "water_quality": "无味、无悬浮物",
|
|
|
- "water_environment": "河流",
|
|
|
- "storage_method": "①②③",
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water6",
|
|
|
- "sampling_location": "广东省韶关市仁化县周田镇·陂下",
|
|
|
- "sample_time": "2024.05.22 15:43",
|
|
|
- "sample_code": "W51",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.885527,
|
|
|
- "longitude": 24.876994,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water7",
|
|
|
- "sampling_location": "广东省韶关市仁化县黄坑镇·黄坑镇林场",
|
|
|
- "sample_time": "2024.05.22 17:31",
|
|
|
- "sample_code": "W57",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.796154,
|
|
|
- "longitude": 25.022423,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water8",
|
|
|
- "sampling_location": "广东省韶关市仁化县黄坑镇·244省道",
|
|
|
- "sample_time": "2024.05.23 10:14",
|
|
|
- "sample_code": "W60",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.818861,
|
|
|
- "longitude": 25.054684,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water9",
|
|
|
- "sampling_location": "广东省韶关市仁化县丹霞街道·丹霞大道",
|
|
|
- "sample_time": "2024.05.23 09:46",
|
|
|
- "sample_code": "W79",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.749503,
|
|
|
- "longitude": 25.061978,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water10",
|
|
|
- "sampling_location": "广东省韶关市仁化县丹霞街道·康溪1号桥",
|
|
|
- "sample_time": "2024.05.23 09:19",
|
|
|
- "sample_code": "W85",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.761433,
|
|
|
- "longitude": 25.118153,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water11",
|
|
|
- "sampling_location": "广东省韶关市仁化县周田镇·635乡道",
|
|
|
- "sample_time": "2024.05.22 17:12",
|
|
|
- "sample_code": "W86",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.792797,
|
|
|
- "longitude": 24.987394,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water12",
|
|
|
- "sampling_location": "广东省韶关市仁化县长江镇·仁化县长江镇河田村村民委员会",
|
|
|
- "sample_time": "2024-05-16 09:49:08",
|
|
|
- "sample_code": "73",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.930119,
|
|
|
- "longitude": 25.356334,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water13",
|
|
|
- "sampling_location": "广东省韶关市仁化县长江镇·520乡道",
|
|
|
- "sample_time": "2024-05-16 10:26:35",
|
|
|
- "sample_code": "74",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.965294,
|
|
|
- "longitude": 25.337432,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water14",
|
|
|
- "sampling_location": "广东省韶关市仁化县长江镇·黄土坑",
|
|
|
- "sample_time": "2024-05-17 10:43:03",
|
|
|
- "sample_code": "75",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.867311,
|
|
|
- "longitude": 25.343983,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water15",
|
|
|
- "sampling_location": "广东省韶关市仁化县长江镇·陈奢垇",
|
|
|
- "sample_time": "2024.05.16 09:15",
|
|
|
- "sample_code": "83",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.899667,
|
|
|
- "longitude": 25.386507,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water16",
|
|
|
- "sampling_location": "广东省韶关市仁化县长江镇·520乡道",
|
|
|
- "sample_time": "2024-05-16 10:51:44",
|
|
|
- "sample_code": "89",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.967071,
|
|
|
- "longitude": 25.318061,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water17",
|
|
|
- "sampling_location": "广东省韶关市乳源瑶族自治县大桥镇·862乡道",
|
|
|
- "sample_time": "2024.5.24 13:18",
|
|
|
- "sample_code": "W12",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.158031,
|
|
|
- "longitude": 25.033346,
|
|
|
- "weather": "多云",
|
|
|
- "storage_container_material": "聚乙烯",
|
|
|
- "storage_container_color": "白色",
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": "无色、无沉淀",
|
|
|
- "water_quality": "无味、无悬浮物",
|
|
|
- "water_environment": "河流",
|
|
|
- "storage_method": "①②③",
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water18",
|
|
|
- "sampling_location": "广东省韶关市乳源瑶族自治县大桥镇·862乡道",
|
|
|
- "sample_time": "2024.5.24 13:55",
|
|
|
- "sample_code": "W13",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.18198,
|
|
|
- "longitude": 25.055958,
|
|
|
- "weather": "小雨",
|
|
|
- "storage_container_material": "聚乙烯",
|
|
|
- "storage_container_color": "白色",
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": "无色、无沉淀",
|
|
|
- "water_quality": "无味、无悬浮物",
|
|
|
- "water_environment": "河流",
|
|
|
- "storage_method": "①②③",
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water19",
|
|
|
- "sampling_location": "广东省韶关市乳源瑶族自治县游溪镇·水源宫",
|
|
|
- "sample_time": "2024.5.23 16:35",
|
|
|
- "sample_code": "W19",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.332907,
|
|
|
- "longitude": 24.847581,
|
|
|
- "weather": "阴",
|
|
|
- "storage_container_material": "聚乙烯",
|
|
|
- "storage_container_color": "白色",
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": "无色、无沉淀",
|
|
|
- "water_quality": "无味、无悬浮物",
|
|
|
- "water_environment": "河流",
|
|
|
- "storage_method": "①②③",
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water20",
|
|
|
- "sampling_location": "广东省韶关市乳源瑶族自治县乳城镇·鹰峰东路",
|
|
|
- "sample_time": "2024.5.22 16:40",
|
|
|
- "sample_code": "W20",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.295062,
|
|
|
- "longitude": 24.767324,
|
|
|
- "weather": "阴",
|
|
|
- "storage_container_material": "聚乙烯",
|
|
|
- "storage_container_color": "白色",
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": "无色、无沉淀",
|
|
|
- "water_quality": "无味、无悬浮物",
|
|
|
- "water_environment": "河流",
|
|
|
- "storage_method": "①②③",
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water21",
|
|
|
- "sampling_location": "山里没网络,无法显示具体位置",
|
|
|
- "sample_time": "2024.5.23 11:19",
|
|
|
- "sample_code": "W21",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.264569,
|
|
|
- "longitude": 24.818586,
|
|
|
- "weather": "阴",
|
|
|
- "storage_container_material": "聚乙烯",
|
|
|
- "storage_container_color": "白色",
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": "无色、无沉淀",
|
|
|
- "water_quality": "无味、无悬浮物",
|
|
|
- "water_environment": "水渠",
|
|
|
- "storage_method": "①②③",
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water22",
|
|
|
- "sampling_location": "广东省韶关市乳源瑶族自治县乳城镇·800乡道",
|
|
|
- "sample_time": "2024.5.23 14:51",
|
|
|
- "sample_code": "W27",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.273083,
|
|
|
- "longitude": 24.714532,
|
|
|
- "weather": "多云",
|
|
|
- "storage_container_material": "聚乙烯",
|
|
|
- "storage_container_color": "白色",
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": "无色、无沉淀",
|
|
|
- "water_quality": "无味、无悬浮物",
|
|
|
- "water_environment": "河流",
|
|
|
- "storage_method": "①②③",
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water23",
|
|
|
- "sampling_location": "广东省韶关市乳源瑶族自治县乳城镇·南水河",
|
|
|
- "sample_time": "2024.5.22 15:50",
|
|
|
- "sample_code": "W28",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.350766,
|
|
|
- "longitude": 24.739597,
|
|
|
- "weather": "阴",
|
|
|
- "storage_container_material": "聚乙烯",
|
|
|
- "storage_container_color": "白色",
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": "无色、无沉淀",
|
|
|
- "water_quality": "无味、无悬浮物",
|
|
|
- "water_environment": "河流",
|
|
|
- "storage_method": "①②③",
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water24",
|
|
|
- "sampling_location": "广东省韶关市乳源瑶族自治县乳城镇·801乡道",
|
|
|
- "sample_time": "2024.5.22 16:17",
|
|
|
- "sample_code": "W32",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.324407,
|
|
|
- "longitude": 24.714868,
|
|
|
- "weather": "阴",
|
|
|
- "storage_container_material": "聚乙烯",
|
|
|
- "storage_container_color": "白色",
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": "稍浑浊、有沉淀",
|
|
|
- "water_quality": "无味、无悬浮物",
|
|
|
- "water_environment": "河流",
|
|
|
- "storage_method": "①②③",
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water25",
|
|
|
- "sampling_location": "广东省韶关市乳源瑶族自治县乳城镇·大塘洞",
|
|
|
- "sample_time": "2024.5.22 15:27",
|
|
|
- "sample_code": "W33",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.357618,
|
|
|
- "longitude": 24.760639,
|
|
|
- "weather": "多云",
|
|
|
- "storage_container_material": "聚乙烯",
|
|
|
- "storage_container_color": "白色",
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": "无色、无沉淀",
|
|
|
- "water_quality": "无味、无悬浮物",
|
|
|
- "water_environment": "河流",
|
|
|
- "storage_method": "①②③",
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water26",
|
|
|
- "sampling_location": "广东省韶关市乳源瑶族自治县乳城镇·新邓屋",
|
|
|
- "sample_time": "2024.5.22 16:56",
|
|
|
- "sample_code": "W35",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.32175,
|
|
|
- "longitude": 24.788096,
|
|
|
- "weather": "阴",
|
|
|
- "storage_container_material": "聚乙烯",
|
|
|
- "storage_container_color": "白色",
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": "无色、无沉淀",
|
|
|
- "water_quality": "无味、无悬浮物",
|
|
|
- "water_environment": "河流",
|
|
|
- "storage_method": "①②③",
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water27",
|
|
|
- "sampling_location": "广东省韶关市乳源瑶族自治县乳城镇·韶关市乳源公路养护中心",
|
|
|
- "sample_time": "2024.5.23 14:20",
|
|
|
- "sample_code": "W38",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.257542,
|
|
|
- "longitude": 24.77105,
|
|
|
- "weather": "多云",
|
|
|
- "storage_container_material": "聚乙烯",
|
|
|
- "storage_container_color": "白色",
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": "无色、无沉淀",
|
|
|
- "water_quality": "无味、无悬浮物",
|
|
|
- "water_environment": "河流",
|
|
|
- "storage_method": "①②③",
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water28",
|
|
|
- "sampling_location": "广东省韶关市乳源瑶族自治县大桥镇·大桥服务区(京港澳高速深圳方向)",
|
|
|
- "sample_time": "2024.5.24 12:51",
|
|
|
- "sample_code": "W41",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.141115,
|
|
|
- "longitude": 25.012915,
|
|
|
- "weather": "小雨",
|
|
|
- "storage_container_material": "聚乙烯",
|
|
|
- "storage_container_color": "白色",
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": "无色、无沉淀",
|
|
|
- "water_quality": "无味、无悬浮物",
|
|
|
- "water_environment": "瀑布",
|
|
|
- "storage_method": "①②③",
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water29",
|
|
|
- "sampling_location": "广东省韶关市乳源瑶族自治县一六镇·G0423乐广高速",
|
|
|
- "sample_time": "2024.5.23 15:34",
|
|
|
- "sample_code": "W42",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.401954,
|
|
|
- "longitude": 24.804447,
|
|
|
- "weather": "多云",
|
|
|
- "storage_container_material": "聚乙烯",
|
|
|
- "storage_container_color": "白色",
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": "无色、无沉淀",
|
|
|
- "water_quality": "无味、无悬浮物",
|
|
|
- "water_environment": "河流",
|
|
|
- "storage_method": "①②③",
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water30",
|
|
|
- "sampling_location": "广东省韶关市乳源瑶族自治县大桥镇·866乡道",
|
|
|
- "sample_time": "2024.5.24 11:14",
|
|
|
- "sample_code": "W45",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.168659,
|
|
|
- "longitude": 25.005002,
|
|
|
- "weather": "晴",
|
|
|
- "storage_container_material": "聚乙烯",
|
|
|
- "storage_container_color": "白色",
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": "无色、无沉淀",
|
|
|
- "water_quality": "无味、无悬浮物",
|
|
|
- "water_environment": "河流",
|
|
|
- "storage_method": "①②③",
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water31",
|
|
|
- "sampling_location": "广东省韶关市乳源瑶族自治县大桥镇·东京洞",
|
|
|
- "sample_time": "2024.5.24 11:44",
|
|
|
- "sample_code": "W46",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.151351,
|
|
|
- "longitude": 25.018036,
|
|
|
- "weather": "多云",
|
|
|
- "storage_container_material": "聚乙烯",
|
|
|
- "storage_container_color": "白色",
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": "无色、无沉淀",
|
|
|
- "water_quality": "无味、无悬浮物",
|
|
|
- "water_environment": "水渠",
|
|
|
- "storage_method": "①②③",
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water32",
|
|
|
- "sampling_location": "韶关市乐昌市坪石镇535国道",
|
|
|
- "sample_time": "2024.05.23 14:42",
|
|
|
- "sample_code": "W90",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.118613,
|
|
|
- "longitude": 25.340751,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water33",
|
|
|
- "sampling_location": "韶关市乐昌市梅花镇黄泥塘",
|
|
|
- "sample_time": "2024.05.22 16:20",
|
|
|
- "sample_code": "W92",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.127812,
|
|
|
- "longitude": 25.177312,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water34",
|
|
|
- "sampling_location": "韶关市乐昌市五山镇247省道",
|
|
|
- "sample_time": "2024.05.21 11:14",
|
|
|
- "sample_code": "W97",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.499578,
|
|
|
- "longitude": 25.34466,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water35",
|
|
|
- "sampling_location": "韶关市乐昌市梅花镇坛司村",
|
|
|
- "sample_time": "2024.05.22 16:35",
|
|
|
- "sample_code": "W100",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.096132,
|
|
|
- "longitude": 25.175297,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water36",
|
|
|
- "sampling_location": "韶关市乐昌市北乡镇下秧田",
|
|
|
- "sample_time": "2024.05.21 16:05",
|
|
|
- "sample_code": "W111",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.337597,
|
|
|
- "longitude": 25.168542,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water37",
|
|
|
- "sampling_location": "韶关市乐昌市廊田镇641乡道",
|
|
|
- "sample_time": "2024.05.21 13:08",
|
|
|
- "sample_code": "W112",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.448766,
|
|
|
- "longitude": 25.128146,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water38",
|
|
|
- "sampling_location": "韶关市乐昌市坪石镇330县道",
|
|
|
- "sample_time": "2024.05.23 15:00",
|
|
|
- "sample_code": "W114",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 113.097487,
|
|
|
- "longitude": 25.300121,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": "500",
|
|
|
- "sampling_volume": 500,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water39",
|
|
|
- "sampling_location": "广东省韶关市南雄市珠玑镇·417乡道",
|
|
|
- "sample_time": "2024.07.19 09:13",
|
|
|
- "sample_code": "NX-GGS-1",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 114.396304,
|
|
|
- "longitude": 25.242905,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": null,
|
|
|
- "sampling_volume": null,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water40",
|
|
|
- "sampling_location": "广东省韶关市南雄市珠玑镇·417乡道",
|
|
|
- "sample_time": "2024.07.19 09:13",
|
|
|
- "sample_code": "NX-GGS-2",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 114.396964,
|
|
|
- "longitude": 25.243337,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": null,
|
|
|
- "sampling_volume": null,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water41",
|
|
|
- "sampling_location": "广东省韶关市南雄市珠玑镇·417乡道",
|
|
|
- "sample_time": "2024.07.19 09:13",
|
|
|
- "sample_code": "NX-GGS-3",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 114.397697,
|
|
|
- "longitude": 25.244161,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": null,
|
|
|
- "sampling_volume": null,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- },
|
|
|
- {
|
|
|
- "water_sample_ID": "water42",
|
|
|
- "sampling_location": "广东省韶关市南雄市珠玑镇·417乡道",
|
|
|
- "sample_time": "2024.07.19 09:13",
|
|
|
- "sample_code": "NX-GGS-4",
|
|
|
- "water_usage_ID": null,
|
|
|
- "latitude": 114.395773,
|
|
|
- "longitude": 25.242348,
|
|
|
- "weather": null,
|
|
|
- "storage_container_material": null,
|
|
|
- "storage_container_color": null,
|
|
|
- "storage_container_capacity": null,
|
|
|
- "sampling_volume": null,
|
|
|
- "sample_description": null,
|
|
|
- "water_quality": null,
|
|
|
- "water_environment": null,
|
|
|
- "storage_method": null,
|
|
|
- "remark": null,
|
|
|
- "sampler_id": null,
|
|
|
- "proofreader_id": null,
|
|
|
- "reviewer_id": null
|
|
|
- }
|
|
|
- ].map(item => {
|
|
|
- const lat = Number(item.latitude);
|
|
|
- const lng = Number(item.longitude);
|
|
|
-
|
|
|
- if (isNaN(lat) || isNaN(lng)) {
|
|
|
- console.error('无效的经纬度数据:', item);
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- return {
|
|
|
- ...item,
|
|
|
- latitude: lat,
|
|
|
- longitude: lng
|
|
|
- };
|
|
|
- }).filter(item => item !== null);
|
|
|
-}
|
|
|
-
|
|
|
-let currentTooltip = null;//当前显示的悬浮窗
|
|
|
-
|
|
|
-// 初始化地图
|
|
|
-const initMap = async () => {
|
|
|
- try {
|
|
|
- await loadSDK()
|
|
|
-
|
|
|
- map = new TMap.value.Map(mapContainer.value, {
|
|
|
- center: new TMap.value.LatLng(24.81088,113.59762),
|
|
|
- zoom: 8,
|
|
|
- renderOptions: {
|
|
|
- preserveDrawingBuffer: true, // 必须开启以支持截图
|
|
|
- antialias: true
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- // 创建标记点向量图层
|
|
|
- markersLayer = new TMap.value.MultiMarker({
|
|
|
- map: map,
|
|
|
- styles: {
|
|
|
- default: new TMap.value.MarkerStyle({
|
|
|
- width: 34,
|
|
|
- height: 34,
|
|
|
- anchor: { x: 17, y: 34 },
|
|
|
- })
|
|
|
- } });
|
|
|
-
|
|
|
- // 创建土壤类型多边形图层
|
|
|
- soilTypeVectorLayer = new TMap.value.MultiPolygon({
|
|
|
- map: map,
|
|
|
- styles: {
|
|
|
- default: new TMap.value.PolygonStyle({
|
|
|
- fillColor: '#cccccc',
|
|
|
- fillOpacity: 0.4,
|
|
|
- strokeColor: '#333',
|
|
|
- strokeWidth: 1
|
|
|
- })
|
|
|
- } });
|
|
|
-
|
|
|
- //const geojsonData = await loadGeoJSON('/data/单元格.geojson');
|
|
|
- //initMapWithGeoJSON(geojsonData, map);
|
|
|
- // 绑定点击事件
|
|
|
-
|
|
|
- soilTypeVectorLayer.on('mouseover', handlePolygonHover);
|
|
|
- soilTypeVectorLayer.on('mouseout', handlePolygonOut);
|
|
|
-
|
|
|
-
|
|
|
- initData()
|
|
|
- //loadData()
|
|
|
- updateMarkers()
|
|
|
- await initSurveyDataLayer(map);
|
|
|
- initSoilTypeLayer();
|
|
|
-
|
|
|
- // 6. 绑定事件
|
|
|
- map.on('click', handleMapClick);
|
|
|
- markersLayer.on('hover', handleMarkerHover);
|
|
|
- markersLayer.on('mouseout', handleMarkerOut);
|
|
|
- soilTypeVectorLayer.on('mouseover', handlePolygonHover);
|
|
|
- soilTypeVectorLayer.on('mouseout', handlePolygonOut);
|
|
|
-
|
|
|
- // 新增地图就绪状态监听
|
|
|
- map.on('idle', () => {
|
|
|
- isMapReady.value = true
|
|
|
- })
|
|
|
- } catch (err) {
|
|
|
- error.value = err.message
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-// 更新标记点,添加Label显示
|
|
|
-const updateMarkers = () => {
|
|
|
- // 正确的标记点创建方式
|
|
|
- const geometries = state.excelData.map(item => {
|
|
|
- return {
|
|
|
- id: item.土壤编号,
|
|
|
- styleId: 'default',
|
|
|
- position: new TMap.value.LatLng(item.longitude, item.latitude),
|
|
|
- properties: {
|
|
|
- title: item.sampling_location,
|
|
|
- sampler_id:item.water_sample_ID
|
|
|
- }
|
|
|
- };
|
|
|
- });
|
|
|
-
|
|
|
- // 一次性设置所有标记
|
|
|
- markersLayer.setGeometries(geometries);
|
|
|
- // 调试信息
|
|
|
- console.log('成功添加标记点数量:', geometries.length);
|
|
|
- geometries.forEach(geo => {
|
|
|
- console.log(`标记点: ${geo.properties.title} (${geo.position.lat}, ${geo.position.lng})`);
|
|
|
- });
|
|
|
-};
|
|
|
-
|
|
|
-// 初始化土壤类型图层
|
|
|
-const initSoilTypeLayer = () => {
|
|
|
- const assessmentUnits = generateSoilAssessmentUnits();
|
|
|
-
|
|
|
- const geometries = assessmentUnits.map(unit => {
|
|
|
- return {
|
|
|
- id: unit.id,
|
|
|
- styleId: unit.category,
|
|
|
- paths: unit.paths.map(coord => new TMap.value.LatLng(coord[0], coord[1])),
|
|
|
- properties: {
|
|
|
- name: unit.name,
|
|
|
- category: unit.category,
|
|
|
- phValue: unit.phValue
|
|
|
- }
|
|
|
- };
|
|
|
- });
|
|
|
-
|
|
|
- // 设置多边形样式
|
|
|
- soilTypeVectorLayer.setStyles(
|
|
|
- Object.keys(categoryColors).reduce((styles, category) => {
|
|
|
- styles[category] = new TMap.value.PolygonStyle({
|
|
|
- fillColor: categoryColors[category],
|
|
|
- fillOpacity: 0.4,
|
|
|
- strokeColor: '#333',
|
|
|
- strokeWidth: 1
|
|
|
- });
|
|
|
- return styles;
|
|
|
- }, {})
|
|
|
- );
|
|
|
-
|
|
|
- soilTypeVectorLayer.setGeometries(geometries);
|
|
|
-};
|
|
|
-
|
|
|
-// 标记点悬停事件
|
|
|
-const handleMarkerHover = (e) => {
|
|
|
-
|
|
|
- const geometry = e.geometry;
|
|
|
- const properties=e.properties;
|
|
|
-
|
|
|
- if (!geometry) return;
|
|
|
- const pixel=map.project(geometry.position);
|
|
|
-
|
|
|
- // 移除之前的悬浮框
|
|
|
- if (currentTooltip) {
|
|
|
- currentTooltip.classList.remove('visible');
|
|
|
- setTimeout(() => {
|
|
|
- document.body.removeChild(currentTooltip);
|
|
|
- currentTooltip = null;
|
|
|
- }, 200);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // 创建悬浮框
|
|
|
- currentTooltip = document.createElement('div');
|
|
|
- currentTooltip.className = 'tooltip';
|
|
|
- currentTooltip.innerHTML = `
|
|
|
- <div>
|
|
|
- <strong>${properties.sampler_id}</strong><br>
|
|
|
- PH值: ${properties.title}
|
|
|
- </div>
|
|
|
- `;
|
|
|
-
|
|
|
-
|
|
|
- // 添加到文档
|
|
|
- document.body.appendChild(currentTooltip);
|
|
|
-
|
|
|
- // 计算并设置位置
|
|
|
- const tooltipWidth = currentTooltip.offsetWidth;
|
|
|
- const tooltipHeight = currentTooltip.offsetHeight;
|
|
|
- const position = calculateTooltipPosition(pixel, tooltipWidth, tooltipHeight);
|
|
|
- currentTooltip.style.left = `${position.left}px`;
|
|
|
- currentTooltip.style.top = `${position.top}px`;
|
|
|
-
|
|
|
- // 显示悬浮框
|
|
|
- setTimeout(() => {
|
|
|
- currentTooltip.classList.add('visible');
|
|
|
- }, 50);
|
|
|
-};
|
|
|
-
|
|
|
-// 标记点鼠标移出事件
|
|
|
-const handleMarkerOut = () => {
|
|
|
- if (currentTooltip) {
|
|
|
- currentTooltip.classList.remove('visible');
|
|
|
- setTimeout(() => {
|
|
|
- document.body.removeChild(currentTooltip);
|
|
|
- currentTooltip = null;
|
|
|
- }, 200);
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-// 多边形悬停事件
|
|
|
-const handlePolygonHover = (e) => {
|
|
|
- const feature = e.feature;
|
|
|
- if (!feature) return;
|
|
|
-
|
|
|
- const properties = feature.properties;
|
|
|
-
|
|
|
- // 创建信息窗口
|
|
|
- if (currentInfoWindow) {
|
|
|
- currentInfoWindow.close();
|
|
|
- }
|
|
|
-
|
|
|
- currentInfoWindow = new TMap.value.InfoWindow({
|
|
|
- map: map,
|
|
|
- position: new TMap.value.LatLng(
|
|
|
- feature.geometry.getBounds().getCenter().lat,
|
|
|
- feature.geometry.getBounds().getCenter().lng
|
|
|
- ),
|
|
|
- content: `
|
|
|
- <div class="polygon-info">
|
|
|
- <h3>${properties.name}</h3>
|
|
|
- <table>
|
|
|
- <tr><th>类别:</th><td>${properties.category}</td></tr>
|
|
|
- <tr><th>PH值:</th><td>${properties.phValue}</td></tr>
|
|
|
- </table>
|
|
|
- </div>
|
|
|
- `,
|
|
|
- offset: { x: 0, y: -20 }
|
|
|
- });
|
|
|
-
|
|
|
- currentInfoWindow.open();
|
|
|
-}
|
|
|
-
|
|
|
-// 多边形鼠标移出事件
|
|
|
-const handlePolygonOut = () => {
|
|
|
- if (currentInfoWindow) {
|
|
|
- currentInfoWindow.close();
|
|
|
- currentInfoWindow = null;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-// 计算悬浮框位置
|
|
|
-const calculateTooltipPosition = (pixel, tooltipWidth, tooltipHeight) => {
|
|
|
-
|
|
|
- const mapContainer = document.querySelector('.map-container');
|
|
|
- if (!mapContainer) return { left: 0, top: 0 };
|
|
|
-
|
|
|
- const mapRect = mapContainer.getBoundingClientRect();
|
|
|
- let left = pixel.x - tooltipWidth / 2;
|
|
|
- let top = pixel.y + 10;
|
|
|
-
|
|
|
- // 边界检测
|
|
|
- if (top < mapRect.top) top = pixel.y - tooltipHeight - 10;
|
|
|
- if (left + tooltipWidth > mapRect.right) left = mapRect.right - tooltipWidth;
|
|
|
- if (left < mapRect.left) left = mapRect.left;
|
|
|
-
|
|
|
- return { left, top };
|
|
|
-};
|
|
|
-
|
|
|
-// 加载数据并创建标记
|
|
|
-const loadData = () => {
|
|
|
- const geometries = state.excelData.map(item => ({
|
|
|
- id: item.土壤编号,
|
|
|
- styleId: 'default',
|
|
|
- position: new TMap.value.LatLng(item.latitude, item.longitude),
|
|
|
- properties: {
|
|
|
- title: item.地点,
|
|
|
- phValue: parseFloat(item.dust_emissions).toFixed(2),
|
|
|
- isTemp: false
|
|
|
- },
|
|
|
- }))
|
|
|
- //markersLayer.setGeometries(geometries)
|
|
|
-}
|
|
|
-
|
|
|
-// 新增截图方法
|
|
|
-const exportMapImage = async () => {
|
|
|
- try {
|
|
|
- isExporting.value = true
|
|
|
-
|
|
|
- // 等待地图稳定
|
|
|
- await new Promise(resolve => setTimeout(resolve, 300))
|
|
|
-
|
|
|
- const canvas = await html2canvas(mapContainer.value, {
|
|
|
- useCORS: true,
|
|
|
- scale: window.devicePixelRatio || 2,
|
|
|
- backgroundColor: null,
|
|
|
- logging: true,
|
|
|
- onclone: (clonedDoc) => {
|
|
|
- // 处理控件可见性
|
|
|
- clonedDoc.querySelectorAll('.tmap-control').forEach(control => {
|
|
|
- control.style.visibility = exportSettings.showMapControls ? 'visible' : 'hidden'
|
|
|
- })
|
|
|
-
|
|
|
- // 添加水印
|
|
|
- if(exportSettings.showWatermark){
|
|
|
- const watermark = document.createElement('div')
|
|
|
- watermark.style = `
|
|
|
- position: absolute;
|
|
|
- bottom: 20px;
|
|
|
- right: 20px;
|
|
|
- color: rgba(0,0,0,0.2);
|
|
|
- font-size: 24px;
|
|
|
- transform: rotate(-15deg);
|
|
|
- z-index: 9999;
|
|
|
- `
|
|
|
- watermark.textContent = '机密地图 - 禁止外传'
|
|
|
- clonedDoc.body.appendChild(watermark)
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- // 转换为Blob
|
|
|
- canvas.toBlob(blob => {
|
|
|
- const link = document.createElement('a')
|
|
|
- link.download = `土壤地图_${new Date().toISOString().slice(0,10)}.png`
|
|
|
- link.href = URL.createObjectURL(blob)
|
|
|
- link.click()
|
|
|
- URL.revokeObjectURL(link.href)
|
|
|
- }, 'image/png', exportSettings.quality)
|
|
|
-
|
|
|
- } catch (error) {
|
|
|
- console.error('截图失败:', error)
|
|
|
- error.value = '截图失败,请尝试缩小地图层级'
|
|
|
- setTimeout(() => error.value = null, 3000)
|
|
|
- } finally {
|
|
|
- isExporting.value = false
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// 新增Marker点击事件处理
|
|
|
-const handleMarkerClick = (e) => {
|
|
|
- const marker = e.geometry
|
|
|
- if (!marker) return
|
|
|
-
|
|
|
- // 关闭之前的信息窗口
|
|
|
- if (activeMarker.value?.id === marker.id) {
|
|
|
- infoWindow.close()
|
|
|
- activeMarker.value = null
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- // 创建信息窗口内容
|
|
|
- const content = `
|
|
|
- <div style="padding:12px">
|
|
|
- <h3>${marker.properties.title}</h3>
|
|
|
- <p>PH值: ${marker.properties.phValue}</p>
|
|
|
- </div>
|
|
|
- `
|
|
|
-
|
|
|
- // 打开信息窗口
|
|
|
- infoWindow = new TMap.value.InfoWindow({
|
|
|
- map: map,
|
|
|
- position: marker.position,
|
|
|
- content: content,
|
|
|
- offset: {x: 0, y: -32}
|
|
|
- })
|
|
|
-
|
|
|
- // 记录当前激活的Marker
|
|
|
- activeMarker.value = marker
|
|
|
-
|
|
|
- // 点击其他区域关闭窗口
|
|
|
- map.on('click', closeInfoWindow)
|
|
|
-}
|
|
|
-
|
|
|
-const manageTempMarker = {
|
|
|
- add: (lat, lng, phValue) => {
|
|
|
- if (activeTempMarker.value) {
|
|
|
- markersLayer.remove("-999")
|
|
|
- }
|
|
|
-
|
|
|
- const tempMarker = markersLayer.add({
|
|
|
- id: "-999",
|
|
|
- position: new TMap.value.LatLng(lat, lng),
|
|
|
- styleId: 'temp',
|
|
|
- properties: {
|
|
|
- title: '克里金插值',
|
|
|
- phValue: parseFloat(phValue).toFixed(2),
|
|
|
- isTemp: true
|
|
|
- }
|
|
|
- })
|
|
|
- activeTempMarker.value = tempMarker
|
|
|
- },
|
|
|
- remove: () => {
|
|
|
- if (activeTempMarker.value) {
|
|
|
- markersLayer.remove("-999")
|
|
|
- activeTempMarker.value = null
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
- const handleMapClick = async (e) => {
|
|
|
- if (selectedPolygon.value) {
|
|
|
- resetPolygonStyle();
|
|
|
- infoWindow.value?.close();
|
|
|
- }
|
|
|
- const now = Date.now()
|
|
|
-
|
|
|
- if (now - state.lastTapTime < 1000) return
|
|
|
- state.lastTapTime = now
|
|
|
-
|
|
|
- try {
|
|
|
- const latLng = e?.latLng
|
|
|
- if (!latLng) throw new Error("地图点击事件缺少坐标信息")
|
|
|
-
|
|
|
- const lat = Number(latLng.lat)
|
|
|
- const lng = Number(latLng.lng)
|
|
|
-
|
|
|
- if (!isValidCoordinate(lat, lng)) throw new Error(`非法坐标值 (${lat}, ${lng})`)
|
|
|
-
|
|
|
- console.log('有效坐标:', lat, lng)
|
|
|
-
|
|
|
- const result = await reverseGeocode(lat, lng)
|
|
|
- if (!validateLocation(result)) throw new Error('非有效陆地区域')
|
|
|
- const phValue = await getPhValue(lng, lat)
|
|
|
-
|
|
|
- // 使用封装方法添加临时标记
|
|
|
- manageTempMarker.add(lat, lng, phValue)
|
|
|
-
|
|
|
- if (infoWindow.value) {
|
|
|
- infoWindow.value.close()
|
|
|
- }
|
|
|
- infoWindow.value = new TMap.value.InfoWindow({
|
|
|
- map: map,
|
|
|
- position: new TMap.value.LatLng(lat,lng),
|
|
|
- content: `
|
|
|
- <div style="padding:12px">
|
|
|
- <h3>${manageTempMarker.activeTempMarker.value.properties.title}</h3>
|
|
|
- <p>PH值: ${manageTempMarker.activeTempMarker.value.properties.phValue}</p>
|
|
|
- </div>
|
|
|
- `
|
|
|
- })
|
|
|
- infoWindow.value.open()
|
|
|
- } catch (error) {
|
|
|
- console.error('操作失败详情:', error)
|
|
|
- error.value = error.message.includes('非法坐标')
|
|
|
- ? '请点击有效地图区域'
|
|
|
- : '服务暂时不可用,请稍后重试'
|
|
|
- setTimeout(() => error.value = null, 3000)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 关闭信息窗口时同步移除临时标记
|
|
|
- const closeInfoWindow = () => {
|
|
|
- if (activeTempMarker.value) {
|
|
|
- manageTempMarker.remove()
|
|
|
- }
|
|
|
- if (infoWindow.value) {
|
|
|
- infoWindow.value.close()
|
|
|
- infoWindow.value = null
|
|
|
- }
|
|
|
-map.off('click', closeInfoWindow)
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-// // 验证坐标有效性
|
|
|
- const isValidCoordinate = (lat, lng) => {
|
|
|
- return !isNaN(lat) && !isNaN(lng) &&
|
|
|
- lat >= -90 && lat <= 90 &&
|
|
|
- lng >= -180 && lng <= 180
|
|
|
- }
|
|
|
-
|
|
|
-// // 逆地理编码
|
|
|
- const reverseGeocode = (lat, lng) => {
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- const callbackName = `tmap_callback_${Date.now()}`
|
|
|
- window[callbackName] = (response) => {
|
|
|
- delete window[callbackName]
|
|
|
- document.body.removeChild(script)
|
|
|
- if (response.status !== 0) reject(response.message)
|
|
|
- else resolve(response.result)
|
|
|
- }
|
|
|
-
|
|
|
- const script = document.createElement('script')
|
|
|
- script.src = `https://apis.map.qq.com/ws/geocoder/v1/?location=${lat},${lng}&key=${tMapConfig.key}&output=jsonp&callback=${callbackName}`
|
|
|
- script.onerror = reject
|
|
|
- document.body.appendChild(script)
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
-// // 验证地理位置
|
|
|
- const validateLocation = (result) => {
|
|
|
- if (!result || !result.address_component) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- return result.address_component.nation === '中国' &&
|
|
|
- !['香港特别行政区', '澳门特别行政区', '台湾省'].includes(
|
|
|
- result.address_component.province
|
|
|
- )
|
|
|
- }
|
|
|
-
|
|
|
-// // 获取PH值
|
|
|
- const getPhValue = async (lng, lat) => {
|
|
|
- try {
|
|
|
- const { data } = await axios.post('https://soilgd.com:5000/kriging_interpolation', {
|
|
|
- file_name: 'emissions.xlsx',
|
|
|
- emission_column: 'dust_emissions',
|
|
|
- points: [[lng, lat]]
|
|
|
- })
|
|
|
- return parseFloat(data.interpolated_concentrations[0]).toFixed(2)
|
|
|
- } catch (error) {
|
|
|
- console.error('获取PH值失败:', error)
|
|
|
- throw error
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-async function loadGeoJSON(url) {
|
|
|
- const response = await fetch(url);
|
|
|
- return await response.json();
|
|
|
-}
|
|
|
-
|
|
|
-function initMapWithGeoJSON(geojsonData, map) {
|
|
|
- // 销毁旧图层
|
|
|
- if (geoJSONLayer) {
|
|
|
- geoJSONLayer.setMap(null);
|
|
|
- geoJSONLayer = null;
|
|
|
- }
|
|
|
- const filteredData = {
|
|
|
- ...geojsonData,
|
|
|
- features: geojsonData.features.filter(feature =>
|
|
|
- feature.properties['raster_value'] !== null &&
|
|
|
- feature.properties['raster_value'] !== undefined
|
|
|
- )
|
|
|
- };
|
|
|
- // 创建 GeoJSONLayer
|
|
|
- geoJSONLayer = new TMap.value.vector.GeoJSONLayer({
|
|
|
- map: map,
|
|
|
- data: filteredData,
|
|
|
- zIndex: 1,
|
|
|
- polygonStyle: new TMap.value.PolygonStyle({ // 必须用 PolygonStyle 类实例
|
|
|
- color: 'rgba(255, 0, 0, 0.25)',
|
|
|
- showBorder: true,
|
|
|
- borderColor: '#FF0000',
|
|
|
- borderWidth: 2
|
|
|
- })
|
|
|
- });
|
|
|
-
|
|
|
- // 获取多边形覆盖层
|
|
|
- multiPolygon = geoJSONLayer.getGeometryOverlay('polygon');
|
|
|
-
|
|
|
- // 高亮选中图层
|
|
|
- const highlightLayer = new TMap.value.MultiPolygon({
|
|
|
- map,
|
|
|
- zIndex: 2,
|
|
|
- styles: {
|
|
|
- highlight: new TMap.value.PolygonStyle({ // 注意要改为 PolygonStyle
|
|
|
- color: 'rgba(0, 123, 255, 0.5)', // 半透明蓝色填充
|
|
|
- borderColor: '#00FF00', // 荧光绿边框
|
|
|
- borderWidth: 2, // 加粗边框
|
|
|
- showBorder: true,
|
|
|
- extrudeHeight: 15 // 3D拔起效果[1](@ref)
|
|
|
- })
|
|
|
- }});
|
|
|
- // 高亮区域
|
|
|
- let highlightGeometry = {
|
|
|
- id: 'highlightGeo',
|
|
|
- styleId: 'highlight'
|
|
|
- }
|
|
|
-
|
|
|
- // 绑定点击事件(替换原有的事件监听)
|
|
|
- multiPolygon.on('hover', (e) => {
|
|
|
- if (e.geometry) {
|
|
|
- // 鼠标选中时高亮区域覆盖
|
|
|
- highlightGeometry.paths = e.geometry.paths;
|
|
|
- highlightLayer.updateGeometries([highlightGeometry]);
|
|
|
- } else {
|
|
|
- // 鼠标移出时取消高亮区域覆盖
|
|
|
- highlightLayer.setGeometries([]);
|
|
|
- }
|
|
|
- })
|
|
|
-};
|
|
|
-
|
|
|
-
|
|
|
-// 加载调查数据并初始化图层
|
|
|
-const initSurveyDataLayer = async (map) => {
|
|
|
- try {
|
|
|
- // 加载GeoJSON数据
|
|
|
- const surveyData = await loadGeoJSON('/data/调查数据.geojson');
|
|
|
-
|
|
|
- // 创建分类样式
|
|
|
- const pointStyles = Object.keys(categoryColors).map(category => ({
|
|
|
- id: category,
|
|
|
- style: new TMap.value.MarkerStyle({
|
|
|
- width: 12,
|
|
|
- height: 12,
|
|
|
- anchor: { x: 6, y: 6 },
|
|
|
- src: createColoredCircle(categoryColors[category]) // 生成圆形图标
|
|
|
- })
|
|
|
- }));
|
|
|
-
|
|
|
- // 初始化图层
|
|
|
- surveyDataLayer = new TMap.value.MultiMarker({
|
|
|
- map: map,
|
|
|
- styles: Object.assign({}, ...pointStyles.map(s => ({ [s.id]: s.style }))),
|
|
|
- geometries: surveyData.features.map(feature => ({
|
|
|
- id: feature.properties.ID,
|
|
|
- styleId: feature.properties.H_XTFX,
|
|
|
- position: new TMap.value.LatLng(
|
|
|
- feature.geometry.coordinates[1],
|
|
|
- feature.geometry.coordinates[0]
|
|
|
- ),
|
|
|
- properties: {
|
|
|
- ...feature.properties,
|
|
|
-
|
|
|
- }
|
|
|
- }))
|
|
|
- });
|
|
|
-
|
|
|
- // 添加点击事件
|
|
|
- surveyDataLayer.on('click', (event) => {
|
|
|
- const prop = event.geometry.properties;
|
|
|
- if (currentInfoWindow) currentInfoWindow.close();
|
|
|
- currentInfoWindow = new TMap.value.InfoWindow({
|
|
|
- map: map,
|
|
|
- position: event.geometry.position,
|
|
|
- content: `
|
|
|
- <div class="point-info">
|
|
|
- <h3>${prop.XMC} ${prop.ZMC} ${prop.CMC}</h3>
|
|
|
- <p>${prop.H_XTFX}</p>
|
|
|
- </div>
|
|
|
- `
|
|
|
- });
|
|
|
- });
|
|
|
- } catch (error) {
|
|
|
- console.error('调查数据加载失败:', error);
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-// 生成圆形图标的base64数据
|
|
|
-const createColoredCircle = (color) => {
|
|
|
- const canvas = document.createElement('canvas');
|
|
|
- canvas.width = 24;
|
|
|
- canvas.height = 24;
|
|
|
- const ctx = canvas.getContext('2d');
|
|
|
-
|
|
|
- // 绘制圆形
|
|
|
- ctx.beginPath();
|
|
|
- ctx.arc(12, 12, 8, 0, 2 * Math.PI);
|
|
|
- ctx.fillStyle = color;
|
|
|
- ctx.fill();
|
|
|
-
|
|
|
- // 添加白色边框
|
|
|
- ctx.strokeStyle = 'black';
|
|
|
- ctx.lineWidth = 2;
|
|
|
- ctx.stroke();
|
|
|
-
|
|
|
- return canvas.toDataURL();
|
|
|
-};
|
|
|
-
|
|
|
- const toggleSoilTypeLayer = () => {
|
|
|
- if (soilTypeVectorLayer) {
|
|
|
- soilTypeVectorLayer.setVisible(state.showSoilTypes);
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- const toggleSurveyDataLayer = () => {
|
|
|
- if (surveyDataLayer.value) {
|
|
|
- surveyDataLayer.value.setVisible(state.showSurveyData);
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
-// // 切换覆盖层
|
|
|
- const toggleOverlay = () => {
|
|
|
- if (state.showOverlay) {
|
|
|
- overlay = new TMap.value.ImageGroundLayer({
|
|
|
- map: map,
|
|
|
- bounds: new TMap.value.LatLngBounds(
|
|
|
- new TMap.value.LatLng(18.17, 103.55),
|
|
|
- new TMap.value.LatLng(32.32, 119.82)
|
|
|
- ),
|
|
|
- src: 'https://soilgd.com/images/farmland_cut.png'
|
|
|
- })
|
|
|
- } else {
|
|
|
- if (overlay) {
|
|
|
- overlay.setMap(null)
|
|
|
- overlay = null
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-onMounted(async () => {
|
|
|
- try {
|
|
|
- await loadSDK()
|
|
|
- initData()
|
|
|
- await initMap()
|
|
|
- } catch (err) {
|
|
|
- error.value = err.message
|
|
|
- }
|
|
|
-})
|
|
|
-
|
|
|
-onBeforeUnmount(() => {
|
|
|
- if (activeTempMarker.value) {
|
|
|
- manageTempMarker.remove()
|
|
|
- }
|
|
|
- if (markersLayer) markersLayer.setMap(null)
|
|
|
- if (overlay) overlay.setMap(null)
|
|
|
- if (infoWindow.value) {
|
|
|
- infoWindow.value.close()
|
|
|
- infoWindow.value = null
|
|
|
- }
|
|
|
- if (farmlandLayer) {
|
|
|
- farmlandLayer.destroy();
|
|
|
- farmlandLayer = null;
|
|
|
- }
|
|
|
- if (bboxLayer) {
|
|
|
- bboxLayer.destroy();
|
|
|
- bboxLayer = null;
|
|
|
- }
|
|
|
- if (soilTypeLayer) {
|
|
|
- soilTypeLayer.destroy();
|
|
|
- soilTypeLayer = null;
|
|
|
- }
|
|
|
- if (surveyDataLayer) {
|
|
|
- surveyDataLayer.destroy();
|
|
|
- surveyDataLayer = null;
|
|
|
- }
|
|
|
-})
|
|
|
-</script>
|
|
|
-
|
|
|
-<style scoped>
|
|
|
-.map-page {
|
|
|
- position: relative;
|
|
|
- width: 100vw;
|
|
|
- height: 100vh;
|
|
|
-}
|
|
|
-
|
|
|
-.map-container {
|
|
|
- width: 100%;
|
|
|
- height: 100vh ;
|
|
|
- min-height: 600px;
|
|
|
-}
|
|
|
-
|
|
|
-.control-panel {
|
|
|
- position: fixed;
|
|
|
- top: 24px;
|
|
|
- right: 24px;
|
|
|
- background: rgba(255, 255, 255, 0.95);
|
|
|
- padding: 16px;
|
|
|
- border-radius: 12px;
|
|
|
- box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
|
|
|
- backdrop-filter: blur(8px);
|
|
|
- border: 1px solid rgba(255, 255, 255, 0.2);
|
|
|
- z-index: 1000;
|
|
|
- min-width: 240px;
|
|
|
- transition: all 0.3s ease;
|
|
|
-}
|
|
|
-
|
|
|
-.control-panel:hover {
|
|
|
- box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
|
|
|
- transform: translateY(-2px);
|
|
|
-}
|
|
|
-
|
|
|
-.control-panel label {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- gap: 8px;
|
|
|
- padding: 8px 12px;
|
|
|
- border-radius: 8px;
|
|
|
- transition: background 0.2s ease;
|
|
|
- cursor: pointer;
|
|
|
-}
|
|
|
-
|
|
|
-.control-panel label:hover {
|
|
|
- background: rgba(56, 118, 255, 0.05);
|
|
|
-}
|
|
|
-
|
|
|
-.control-panel input[type="checkbox"] {
|
|
|
- width: 18px;
|
|
|
- height: 18px;
|
|
|
- border: 2px solid #3876ff;
|
|
|
- border-radius: 4px;
|
|
|
- appearance: none;
|
|
|
- cursor: pointer;
|
|
|
- transition: all 0.2s ease;
|
|
|
-}
|
|
|
-
|
|
|
-.control-panel input[type="checkbox"]:checked {
|
|
|
- background: #3876ff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E") no-repeat center;
|
|
|
- background-size: 12px;
|
|
|
-}
|
|
|
-
|
|
|
-.export-controls {
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- gap: 12px;
|
|
|
- margin-top: 16px;
|
|
|
-}
|
|
|
-
|
|
|
-.export-controls button {
|
|
|
- padding: 10px 16px;
|
|
|
- font-size: 14px;
|
|
|
- font-weight: 500;
|
|
|
- border: none;
|
|
|
- border-radius: 8px;
|
|
|
- cursor: pointer;
|
|
|
- transition: all 0.2s ease;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- gap: 8px;
|
|
|
- background: #3876ff;
|
|
|
- color: white;
|
|
|
-}
|
|
|
-
|
|
|
-.export-controls button:disabled {
|
|
|
- background: #e0e0e0;
|
|
|
- color: #9e9e9e;
|
|
|
- cursor: not-allowed;
|
|
|
- opacity: 0.8;
|
|
|
-}
|
|
|
-
|
|
|
-.export-controls button:not(:disabled):hover {
|
|
|
- background: #2b5dc5;
|
|
|
- box-shadow: 0 4px 12px rgba(56, 118, 255, 0.3);
|
|
|
-}
|
|
|
-
|
|
|
-/* 新增加载动画 */
|
|
|
-@keyframes spin {
|
|
|
- 0% { transform: rotate(0deg); }
|
|
|
- 100% { transform: rotate(360deg); }
|
|
|
-}
|
|
|
-
|
|
|
-.loading-spinner {
|
|
|
- width: 18px;
|
|
|
- height: 18px;
|
|
|
- border: 2px solid rgba(255, 255, 255, 0.3);
|
|
|
- border-top-color: white;
|
|
|
- border-radius: 50%;
|
|
|
- animation: spin 0.8s linear infinite;
|
|
|
-}
|
|
|
-
|
|
|
-/* 响应式调整 */
|
|
|
-@media (max-width: 768px) {
|
|
|
- .control-panel {
|
|
|
- top: 16px;
|
|
|
- right: 16px;
|
|
|
- left: 16px;
|
|
|
- width: auto;
|
|
|
- min-width: auto;
|
|
|
- }
|
|
|
-
|
|
|
- .export-controls {
|
|
|
- flex-direction: row;
|
|
|
- flex-wrap: wrap;
|
|
|
- }
|
|
|
-
|
|
|
- .export-controls button {
|
|
|
- flex: 1;
|
|
|
- justify-content: center;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-/* 信息窗口样式 */
|
|
|
-:deep(.tmap-infowindow) {
|
|
|
- padding: 12px;
|
|
|
- min-width: 200px;
|
|
|
- border-radius: 8px;
|
|
|
- box-shadow: 0 2px 8px rgba(0,0,0,0.15);
|
|
|
- background-color: white;
|
|
|
-}
|
|
|
-
|
|
|
-:deep(.tmap-infowindow h3) {
|
|
|
- margin: 0 0 8px;
|
|
|
- font-size: 16px;
|
|
|
- color: #333;
|
|
|
-}
|
|
|
-
|
|
|
-:deep(.tmap-infowindow p) {
|
|
|
- margin: 4px 0;
|
|
|
- color: #666;
|
|
|
- font-size: 14px;
|
|
|
-}
|
|
|
-.polygon-info {
|
|
|
- padding: 12px;
|
|
|
- max-width: 300px;
|
|
|
-
|
|
|
- h3 {
|
|
|
- margin: 0 0 8px;
|
|
|
- color: #333;
|
|
|
- font-size: 16px;
|
|
|
- }
|
|
|
-
|
|
|
- table {
|
|
|
- width: 100%;
|
|
|
- border-collapse: collapse;
|
|
|
-
|
|
|
- tr {
|
|
|
- border-bottom: 1px solid #eee;
|
|
|
- }
|
|
|
-
|
|
|
- th, td {
|
|
|
- padding: 6px 4px;
|
|
|
- text-align: left;
|
|
|
- font-size: 14px;
|
|
|
- }
|
|
|
-
|
|
|
- th {
|
|
|
- color: #666;
|
|
|
- white-space: nowrap;
|
|
|
- padding-right: 8px;
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-.point-info {
|
|
|
- padding: 12px;
|
|
|
- min-width: 200px;
|
|
|
-
|
|
|
- h3 {
|
|
|
- margin: 0 0 8px;
|
|
|
- font-size: 14px;
|
|
|
- color: white;
|
|
|
- padding: 4px 8px;
|
|
|
- border-radius: 4px;
|
|
|
- display: inline-block;
|
|
|
- background: var(--category-color);
|
|
|
- }
|
|
|
-
|
|
|
- p {
|
|
|
- margin: 6px 0;
|
|
|
- font-size: 13px;
|
|
|
- line-height: 1.4;
|
|
|
-
|
|
|
- &:last-child {
|
|
|
- margin-bottom: 0;
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-/* 动态类别颜色 */
|
|
|
-.point-info h3[data-category="优先保护类"] { --category-color: #00C853; }
|
|
|
-.point-info h3[data-category="安全利用类"] { --category-color: #FFD600; }
|
|
|
-.point-info h3[data-category="严格管控类"] { --category-color: #D50000; }
|
|
|
-.highlight-status {
|
|
|
- padding: 8px;
|
|
|
- background: rgba(0, 255, 0, 0.1);
|
|
|
- border-left: 3px solid #00FF00;
|
|
|
- margin-top: 12px;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-.tooltip {
|
|
|
- position: absolute;
|
|
|
- padding: 8px 12px;
|
|
|
- background: rgba(255, 255, 255, 0.9);
|
|
|
- border-radius: 6px;
|
|
|
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
|
|
- z-index: 1001;
|
|
|
- font-size: 14px;
|
|
|
- white-space: nowrap;
|
|
|
- opacity: 0;
|
|
|
- transform: translateY(10px);
|
|
|
- visibility: hidden;
|
|
|
- transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
|
|
|
- border: 1px solid #e0e0e0;
|
|
|
-}
|
|
|
-
|
|
|
-.tooltip.visible {
|
|
|
- opacity: 1;
|
|
|
- transform: translateY(0);
|
|
|
- visibility: visible;
|
|
|
-}
|
|
|
-
|
|
|
-.tooltip::after {
|
|
|
- content: "";
|
|
|
- position: absolute;
|
|
|
- width: 0;
|
|
|
- height: 0;
|
|
|
- border-left: 6px solid transparent;
|
|
|
- border-right: 6px solid transparent;
|
|
|
- top: 100%;
|
|
|
- left: 50%;
|
|
|
- transform: translateX(-50%);
|
|
|
- border-top: 6px solid rgba(255, 255, 255, 0.9);
|
|
|
- border-top-color: inherit;
|
|
|
-}
|
|
|
-
|
|
|
-:deep(.tmap-vector-label) {
|
|
|
- white-space: nowrap;
|
|
|
- pointer-events: none; /* 允许点击穿透,不影响地图交互 */
|
|
|
-}
|
|
|
-</style>
|