diff --git a/nl-vue/src/views/nl_agv/layout/index.vue b/nl-vue/src/views/nl_agv/layout/index.vue index 3846d0f..876a054 100644 --- a/nl-vue/src/views/nl_agv/layout/index.vue +++ b/nl-vue/src/views/nl_agv/layout/index.vue @@ -89,8 +89,7 @@ @mousedown="handleDeviceMouseDown($event, device)" >
-
- ${device.name} +
{{ device.name }}
@@ -294,14 +293,8 @@ export default { renderDeviceIcon(device) { const template = this.deviceTemplates.find(d => d.id === device.templateId) if (!template) return '📍' - - const iconFontSize = Math.round((device.size || 50) * 0.64) - if (this.isImageUrl(template.icon)) { - return `${device.name}` - } else { - return `${template.icon || '📍'}` - } - }, + return `${device.name}` + }, async handleMapUpload(e) { const file = e.target.files[0] if (!file) return diff --git a/nl-vue/src/views/nl_agv/map/index.vue b/nl-vue/src/views/nl_agv/map/index.vue deleted file mode 100644 index 3743d59..0000000 --- a/nl-vue/src/views/nl_agv/map/index.vue +++ /dev/null @@ -1,528 +0,0 @@ - - - - - diff --git a/nl-vue/src/views/nl_agv/screen/index.vue b/nl-vue/src/views/nl_agv/screen/index.vue index acafd98..7891a99 100644 --- a/nl-vue/src/views/nl_agv/screen/index.vue +++ b/nl-vue/src/views/nl_agv/screen/index.vue @@ -108,6 +108,7 @@ :src="mapImageUrl" alt="厂区背景" class="map-background" + :style="mapBackgroundStyle" @load="onMapImageLoad" @error="onMapImageError" /> @@ -255,6 +256,17 @@ const progressStyle = computed(() => { } }) +const mapBackgroundStyle = computed(() => { + const style = {} + if (mapState.width > 0) { + style.width = mapState.width + 'px' + } + if (mapState.height > 0) { + style.height = mapState.height + 'px' + } + return style +}) + // ==================== 工具函数 ==================== const getDeviceIconUrl = (icon) => { if (!icon) return '' @@ -623,10 +635,12 @@ onMounted(async () => { if (mapData) { mapState.mapId = mapData.mapId mapState.origin = mapData.origin || { x: 0, y: 0 } - mapState.width = mapData.width - mapState.height = mapData.height + mapState.width = mapData.width || 0 + mapState.height = mapData.height || 0 staticDevices.value = mapData.devices || [] + console.log('地图尺寸:', { width: mapState.width, height: mapState.height }) + if (mapData.url) { mapImageUrl.value = mapData.url.startsWith('http') ? mapData.url