diff --git a/.env.development b/.env.development index 662a41e..361807c 100644 --- a/.env.development +++ b/.env.development @@ -10,3 +10,5 @@ VITE_APP_BASE_API = '/dev-api' VITE_API_URL = http://192.168.28.10:13080 VITE_WS_URL = ws://192.168.0.201:13080/ws +# explanation +VITE_INSPECTION_TYPE = "inspection" \ No newline at end of file diff --git a/.env.production b/.env.production index dd9f27c..4c5aa50 100644 --- a/.env.production +++ b/.env.production @@ -15,3 +15,6 @@ VITE_NODE_RED_URL = 'http://10.148.108.59:13080' VITE_API_URL = http://192.168.28.10:13080 VITE_WS_URL = ws://192.168.0.201:13080/ws + +# explanation +VITE_INSPECTION_TYPE = "inspection" \ No newline at end of file diff --git a/src/api/inspection/robot.js b/src/api/inspection/robot.js index 8844e22..c4963f2 100644 --- a/src/api/inspection/robot.js +++ b/src/api/inspection/robot.js @@ -29,4 +29,29 @@ export function deleteRobot(id) { url: `/inspection/robot/${id}`, method: 'delete' }) +} + +/** + * 获取机器人地图 + * @param {*} robotId + * @returns + */ +export function getMapByRobot(robotId) { + return request({ + url: `/inspection/robot/${robotId}/maps`, + method: 'get' + }) +} + +/** + * 获取地图JSON数据 + * @param {*} params + * @returns + */ +export function getMapJson(params) { + return request({ + url: `/inspection/robot/${params.robotId}/download-map`, + method: 'get', + params + }) } \ No newline at end of file diff --git a/src/views/inspection/cockpit/components/MapCanvas.vue b/src/views/inspection/cockpit/components/MapCanvas.vue index 0cfffc6..ee06f3a 100644 --- a/src/views/inspection/cockpit/components/MapCanvas.vue +++ b/src/views/inspection/cockpit/components/MapCanvas.vue @@ -153,7 +153,7 @@ async function loadMapIntoApplication(parsedMap) { const worldHeightMeters = parsedMap.maxY - parsedMap.originY; // 地图世界高度 const fitScaleX = inspectionStore.canvasWidthPx / worldWidthMeters; // 水平方向恰好填满的缩放 const fitScaleY = inspectionStore.canvasHeightPx / worldHeightMeters; // 垂直方向恰好填满的缩放 - inspectionStore.camera.pixelsPerMeter = Math.max(1, Math.min(fitScaleX, fitScaleY) * 1); // 取较小值 + inspectionStore.camera.pixelsPerMeter = Math.max(1, Math.max(fitScaleX, fitScaleY) * 1); // 取较小值 // 标记加载完成并更新UI applicationState.isMapLoaded = true; diff --git a/src/views/inspection/cockpit/components/MapOverview.vue b/src/views/inspection/cockpit/components/MapOverview.vue index e49ad96..82db376 100644 --- a/src/views/inspection/cockpit/components/MapOverview.vue +++ b/src/views/inspection/cockpit/components/MapOverview.vue @@ -65,10 +65,10 @@