更新地图组件

This commit is contained in:
g82tt
2025-10-18 03:34:32 +08:00
parent 64a731b4a5
commit e1c2e6e4aa
13 changed files with 84 additions and 61 deletions

View File

@@ -10,7 +10,7 @@
<link rel="stylesheet" href="./fonts/iconfont.css" /> <link rel="stylesheet" href="./fonts/iconfont.css" />
<script> <script>
window.$config = { window.$config = {
api: "./api.vgomap.com/", api: "/api.vgomap.com/",
offline: true, offline: true,
mapTheme: "home", mapTheme: "home",
tenantId: "1958120048849719296", tenantId: "1958120048849719296",

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -7,7 +7,7 @@ const map = inject("map")
const { const {
pathIdList, pathIdList,
addPathId, addPath,
startNavi, startNavi,
pauseNavi, pauseNavi,
restoreNavi, restoreNavi,
@@ -18,11 +18,11 @@ map.value.on('click', (e) => {
const polygon = e.object?.userData?.polygonData // 获取点位数据 const polygon = e.object?.userData?.polygonData // 获取点位数据
if(!polygon?.isNavi) return if(!polygon?.isNavi) return
addPathId(polygon.id) addPath(polygon)
}) })
defineExpose({ defineExpose({
addPathId, addPath,
}) })
</script> </script>

View File

@@ -53,8 +53,8 @@ const markerStatus = ref({});
const checkedStatus = ref({}) const checkedStatus = ref({})
watch(checkedStatus, (checked) => { watch(checkedStatus, (checked) => {
for (let key in checked) { for (let key in checked) {
markerStatus.value[key].forEach((marker) => { markerStatus.value?.[key]?.forEach((marker) => {
marker.visible = checked[key] marker.visible = !checked[key]
}) })
} }
}, { }, {
@@ -67,7 +67,8 @@ function createDivMarker(content, polygon) {
contentNode.className = "marker" contentNode.className = "marker"
contentNode.textContent = content contentNode.textContent = content
contentNode.onclick = (e) => { contentNode.onclick = (e) => {
routeLineRef.value.addPathId(polygon.id) if(!polygon?.isNavi) return
routeLineRef.value.addPath(polygon)
} }
wrapper.appendChild(contentNode) wrapper.appendChild(contentNode)

View File

@@ -3,8 +3,19 @@ import { ref, watch } from "vue"
export function useNavi(map) { export function useNavi(map) {
const pathIdList = ref([]) const pathIdList = ref([])
function addPath(polygon) {
if(polygon?.id && pathIdList.value[pathIdList.value.length - 1] === polygon?.id) return // 不连续添加相同的项
const modelId = polygon.extrasModelId;
const model = map.value.getModelById(modelId)
const modelName = model.userData.modelData.name
console.log(modelName, 'model.name')
addPathId(polygon.id)
}
function addPathId(id) { function addPathId(id) {
if(pathIdList.value[pathIdList.value.length - 1] === id) return if(id && pathIdList.value[pathIdList.value.length - 1] === id) return
pathIdList.value.push(id) pathIdList.value.push(id)
} }
@@ -70,6 +81,7 @@ export function useNavi(map) {
return { return {
pathIdList, pathIdList,
addPath,
addPathId, addPathId,
startNavi, startNavi,
pauseNavi, pauseNavi,

View File

@@ -290,6 +290,10 @@ onMounted(() => {
backdrop-filter: blur(5px); backdrop-filter: blur(5px);
} }
:deep(.el-table tr){
background: transparent !important;
}
:deep(.el-table__header th) { :deep(.el-table__header th) {
background: rgba(12, 43, 77, 0.7) !important; background: rgba(12, 43, 77, 0.7) !important;
border-bottom: 1px solid #68c9ff !important; border-bottom: 1px solid #68c9ff !important;

View File

@@ -41,12 +41,13 @@
</div> </div>
<!-- 地图展示区域 --> <!-- 地图展示区域 -->
<!--建立 一个全局变量用于存放用户点击的设备名称列表同步到编辑框的点位设备列表中-->
<div class="mb-6"> <div class="mb-6">
<h3 class="text-lg font-medium text-blue-300 mb-4">路径地图</h3> <h3 class="text-lg font-medium text-blue-300 mb-4">路径地图</h3>
<div class="border border-blue-400 rounded-lg overflow-hidden relative"> <div class="border border-blue-400 rounded-lg overflow-hidden relative">
<!-- 地图容器设置固定高度 --> <!-- 地图容器设置固定高度 -->
<div class="path-map-container"> <div class="path-map-container">
<Map /> <Map el-id="etsfs"/>
</div> </div>
<!-- 地图操作提示 --> <!-- 地图操作提示 -->
<div class="map-tip"> <div class="map-tip">