From 5fdd0f6cd14a9dad6e728f6528a4b61be2147024 Mon Sep 17 00:00:00 2001 From: yyy <2605810609@qq.com> Date: Tue, 15 Jul 2025 14:06:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/locationSelectionDialog.vue | 20 +- src/views/mapPage/realTimeMap/editMap.vue | 680 ++++++++++++++---- 2 files changed, 548 insertions(+), 152 deletions(-) diff --git a/src/views/mapPage/components/locationSelectionDialog.vue b/src/views/mapPage/components/locationSelectionDialog.vue index ee7b00f7..ab6299b5 100644 --- a/src/views/mapPage/components/locationSelectionDialog.vue +++ b/src/views/mapPage/components/locationSelectionDialog.vue @@ -271,8 +271,9 @@ const getAllNodeList = async () => { positionMapId: imgBgObj.positionMapId }) allMapPointInfo.value = [] - list.forEach((item) => { + item.locationX = convertActualToBrowser(item.actualLocationX, item.actualLocationY).x + item.locationY = convertActualToBrowser(item.actualLocationX, item.actualLocationY).y //只要库位 if (locationTypeNumber.value == 1 && item.type === 2) { item.locationX = Number(item.locationX) * (imgBgObj.showWidth / imgBgObj.width) @@ -420,6 +421,23 @@ const handleWheel = (event) => { const emit = defineEmits(['locationSelectionDialogSuccess']) defineExpose({ open }) // 提供 open 方法,用于打开弹窗 + +// 传入实际现场的数据,转换成浏览器坐标的数据 +const convertActualToBrowser = (pointX, pointY) => { + const y1 = Number(imgBgObj.origin[1]) + Number(imgBgObj.height) * Number(imgBgObj.resolution) + let x = + Math.round( + (Math.max(Number(pointX) - Number(imgBgObj.origin[0]), 0) / Number(imgBgObj.resolution)) * + 10000 + ) / 10000 + let y = + Math.round((Math.max(y1 - Number(pointY), 0) / Number(imgBgObj.resolution)) * 10000) / 10000 + + return { + x, + y + } +}