6 changed files with 1233 additions and 1675 deletions
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.6 KiB |
@ -0,0 +1,161 @@ |
|||||
|
<template> |
||||
|
<div class="lanyer"> |
||||
|
<div> |
||||
|
<img src="/src/assets/highScore/mapIcon1.png" /> |
||||
|
图例名称 |
||||
|
</div> |
||||
|
<div v-for="item in layerList" :key="item.id" class="custom-checkbox"> |
||||
|
<label> |
||||
|
<input type="checkbox" :checked="item.show" @change="toggleLayer(item.layerName)"/> |
||||
|
<img :src="item.url" /> |
||||
|
<span>{{ item.name }}</span> |
||||
|
</label> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import { ref, computed, watch } from 'vue'; |
||||
|
const props = defineProps({ |
||||
|
chooseBot: { |
||||
|
type: String, |
||||
|
default: '' |
||||
|
} |
||||
|
}); |
||||
|
const emit = defineEmits(['layer-toggle']); |
||||
|
const allLayerLists = { |
||||
|
default: [ |
||||
|
{ |
||||
|
id: 1, |
||||
|
layerName: 'warnLayer', |
||||
|
name: '事件', |
||||
|
show: true, |
||||
|
url: new URL('@/assets/highScore/warnicon1.png', import.meta.url).href, |
||||
|
}, |
||||
|
{ |
||||
|
id: 2, |
||||
|
layerName: 'equipmentLayer', |
||||
|
name: '设备', |
||||
|
show: true, |
||||
|
url: new URL('@/assets/highScore/equipment.png', import.meta.url).href, |
||||
|
}, |
||||
|
{ |
||||
|
id: 3, |
||||
|
layerName: 'carLayer', |
||||
|
name: '车辆', |
||||
|
show: true, |
||||
|
url: new URL('@/assets/highScore/caricon.png', import.meta.url).href, |
||||
|
}, |
||||
|
{ |
||||
|
id: 4, |
||||
|
layerName: 'emergencyLayer', |
||||
|
name: '应急设施', |
||||
|
show: true, |
||||
|
url: new URL('@/assets/highScore/Materialsicon.png', import.meta.url).href, |
||||
|
}, |
||||
|
], |
||||
|
charge: [ |
||||
|
{ |
||||
|
id: 1, |
||||
|
layerName: 'monitoring', |
||||
|
name: '监控', |
||||
|
show: true, |
||||
|
url: new URL('@/assets/highScore/monitoring.png', import.meta.url).href, |
||||
|
}, |
||||
|
{ |
||||
|
id: 2, |
||||
|
layerName: 'peopleLayer', |
||||
|
name: '设备', |
||||
|
show: true, |
||||
|
url: new URL('@/assets/highScore/equipment.png', import.meta.url).href, |
||||
|
}, |
||||
|
{ |
||||
|
id: 3, |
||||
|
layerName: 'carLayer', |
||||
|
name: '车辆', |
||||
|
show: true, |
||||
|
url: new URL('@/assets/highScore/caricon.png', import.meta.url).href, |
||||
|
}, |
||||
|
{ |
||||
|
id: 4, |
||||
|
layerName: 'tollStation', |
||||
|
name: '收费站', |
||||
|
show: true, |
||||
|
url: new URL('@/assets/highScore/tollStation.png', import.meta.url).href, |
||||
|
}, |
||||
|
], |
||||
|
}; |
||||
|
const layerList = ref(allLayerLists.default); |
||||
|
// 根据 chooseBot 过滤图层列表 |
||||
|
const filteredLayerList = computed(() => { |
||||
|
return layerList.value.filter(item => item.show); |
||||
|
}); |
||||
|
|
||||
|
// 监听 chooseBot 变化 |
||||
|
watch(() => props.chooseBot, (newVal) => { |
||||
|
switch(newVal) { |
||||
|
case 'charge': |
||||
|
layerList.value = allLayerLists.charge; |
||||
|
break; |
||||
|
case 'dataChart': |
||||
|
layerList.value = allLayerLists.charge; |
||||
|
break; |
||||
|
default: |
||||
|
layerList.value = allLayerLists.default; |
||||
|
} |
||||
|
}, { immediate: true }); |
||||
|
|
||||
|
// 切换图层显示状态 |
||||
|
const toggleLayer = (layerName: string) => { |
||||
|
const layer = layerList.value.find(item => item.layerName === layerName); |
||||
|
if (layer) { |
||||
|
layer.show = !layer.show; |
||||
|
emit('layer-toggle', { |
||||
|
layerName, |
||||
|
show: layer.show |
||||
|
}); |
||||
|
} |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style lang="less" scoped> |
||||
|
.lanyer { |
||||
|
padding: 30px 0 0 20px; |
||||
|
width: 500.34px; |
||||
|
height: 550.65px; |
||||
|
color: white; |
||||
|
z-index: 9999 !important; |
||||
|
position: absolute; |
||||
|
bottom: 20%; |
||||
|
right: 18%; |
||||
|
background: url('@/assets/highScore/lanyerBg.png') no-repeat 0 0/100% 100%; |
||||
|
div { |
||||
|
font-size: 40px; |
||||
|
} |
||||
|
.custom-checkbox { |
||||
|
margin: 30px 0 20px 80px; /* 调整间距 */ |
||||
|
} |
||||
|
|
||||
|
.custom-checkbox img { |
||||
|
width: 50px; |
||||
|
height: 50px; |
||||
|
filter: brightness(0.88) contrast(1.22) grayscale(0) hue-rotate(360deg) opacity(1) saturate(1.1) sepia(0.54) invert(0.9); |
||||
|
} |
||||
|
.custom-checkbox label { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
gap: 25px; /* 调整图标和文字的间距 */ |
||||
|
cursor: pointer; |
||||
|
} |
||||
|
.custom-checkbox input[type='checkbox'] { |
||||
|
width: 40px; |
||||
|
height: 40px; |
||||
|
cursor: pointer; |
||||
|
} |
||||
|
|
||||
|
.custom-checkbox span { |
||||
|
color: white; |
||||
|
font-size: 36px; |
||||
|
} |
||||
|
} |
||||
|
</style> |
File diff suppressed because it is too large
File diff suppressed because it is too large
Loading…
Reference in new issue