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 + } +}