From 10d711d844107ff2b2f2822292eafd703879afd7 Mon Sep 17 00:00:00 2001 From: yyy <2605810609@qq.com> Date: Tue, 18 Mar 2025 10:01:33 +0800 Subject: [PATCH 1/5] 1 --- .../example/转换成实际坐标demo.vue | 151 ------------------ 1 file changed, 151 deletions(-) delete mode 100644 src/views/mapPage/example/转换成实际坐标demo.vue diff --git a/src/views/mapPage/example/转换成实际坐标demo.vue b/src/views/mapPage/example/转换成实际坐标demo.vue deleted file mode 100644 index cc418af3..00000000 --- a/src/views/mapPage/example/转换成实际坐标demo.vue +++ /dev/null @@ -1,151 +0,0 @@ - - - - - From 6ea7dfb6342285086b932b50a8190ca24c7710a0 Mon Sep 17 00:00:00 2001 From: yyy <2605810609@qq.com> Date: Tue, 18 Mar 2025 14:56:12 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=8B=96=E6=8B=BD=E5=AE=BD=E9=AB=98?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.dev | 2 +- src/views/mapPage/realTimeMap/editMap.vue | 24 ++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.env.dev b/.env.dev index cd36402f..fb9b85ed 100644 --- a/.env.dev +++ b/.env.dev @@ -6,7 +6,7 @@ VITE_DEV=true # 请求路径 # VITE_BASE_URL='http://192.168.0.66:48080' # VITE_BASE_URL='http://192.168.0.189:48080' -VITE_BASE_URL='http://127.0.0.1:48080' +VITE_BASE_URL='http://192.168.0.45:48080' # 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持S3服务 VITE_UPLOAD_TYPE=server diff --git a/src/views/mapPage/realTimeMap/editMap.vue b/src/views/mapPage/realTimeMap/editMap.vue index 547acba9..238f2ff0 100644 --- a/src/views/mapPage/realTimeMap/editMap.vue +++ b/src/views/mapPage/realTimeMap/editMap.vue @@ -760,10 +760,15 @@ const resizeEnd = (locationX, locationY, w, h, item, index) => { nextTick(() => { let x = Number(locationX) + Number(item.locationWidePx) / 2 let y = Number(locationY) + Number(item.locationDeepPx) / 2 + let width = Number(w) * imgBgObj.resolution * 100 //实际的宽高cm + let height = Number(h) * imgBgObj.resolution * 100 + let actualPoint = disposeEventPoint(x, y) state.allMapPointInfo[index].locationX = x state.allMapPointInfo[index].locationY = y + state.allMapPointInfo[index].locationWide = width + state.allMapPointInfo[index].locationDeep = height state.allMapPointInfo[index].locationWidePx = w state.allMapPointInfo[index].locationDeepPx = h state.allMapPointInfo[index].actualLocationX = actualPoint.actualLocationX @@ -781,8 +786,8 @@ const resizeEnd = (locationX, locationY, w, h, item, index) => { if (item.id === route.endPointId) { route.endPointX = x route.endPointY = y - route.endHigh = Number(item.locationDeep) - route.endWidth = Number(item.locationDeep) + route.endHigh = Number(item.locationDeepPx) + route.endWidth = Number(item.locationWidePx) route.actualEndPointX = actualPoint.actualLocationX route.actualEndPointY = actualPoint.actualLocationY } @@ -2515,7 +2520,20 @@ const saveMap = async () => { const saveNodeList = async () => { let list = state.allMapPointInfo list.forEach((item) => { - if (item.type === 7) { + if (item.type === 2) { + // 库位点 类型为数组 + item.dataList.forEach((node) => { + node.locationDeep = item.locationDeep + node.locationWide = item.locationWide + }) + item.dataJson = JSON.stringify(item.dataList) + } else if (item.type === 3 || item.type === 4) { + //设备类型 + item.dataObj.locationWide = item.locationWide + item.dataObj.locationDeep = item.locationDeep + item.dataJson = JSON.stringify(item.dataObj) + } else if (item.type === 7) { + //文字类型 item.dataObj.positionMapId = imgBgObj.positionMapId item.dataObj.text = item.text item.dataObj.fontColor = item.fontColor From 12739441d6adb12ea0fedd245f72431f3a3b7f7d Mon Sep 17 00:00:00 2001 From: yyy <2605810609@qq.com> Date: Tue, 18 Mar 2025 16:42:50 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=B7=BB=E5=8A=A0bug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.local | 3 +- .../components-tool/equipmentToolDialog.vue | 24 ++++++++---- src/views/mapPage/realTimeMap/editMap.vue | 38 +++++++++---------- 3 files changed, 36 insertions(+), 29 deletions(-) diff --git a/.env.local b/.env.local index a3752946..731be2fa 100644 --- a/.env.local +++ b/.env.local @@ -4,8 +4,9 @@ NODE_ENV=development VITE_DEV=true # 请求路径 -VITE_BASE_URL='http://192.168.0.74:48080' +# VITE_BASE_URL='http://192.168.0.74:48080' # VITE_BASE_URL='http://192.168.0.189:48080' +VITE_BASE_URL='http://192.168.0.45:48080' # 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持 S3 服务 VITE_UPLOAD_TYPE=server diff --git a/src/views/mapPage/realTimeMap/components-tool/equipmentToolDialog.vue b/src/views/mapPage/realTimeMap/components-tool/equipmentToolDialog.vue index 10e4c45b..165090f2 100644 --- a/src/views/mapPage/realTimeMap/components-tool/equipmentToolDialog.vue +++ b/src/views/mapPage/realTimeMap/components-tool/equipmentToolDialog.vue @@ -23,8 +23,8 @@ - - + + - + { }) } //新增表单新增 +const ruleFormRef = ref() +const rules = reactive({ + deviceType: [{ required: true, message: '请选择设备类型', trigger: 'change' }], + deviceInfoId: [{ required: true, message: '请选择设备类型', trigger: 'change' }] +}) const submitAddForm = async () => { - deviceInfo.value.positionMapId = props.positionMapId - await MapApi.mapBindDeviceInfo(deviceInfo.value) - message.success('新增成功') - addDeviceVisible.value = false - getDeviceList() + await ruleFormRef.value.validate(async (valid, fields) => { + if (!valid) return + deviceInfo.value.positionMapId = props.positionMapId + await MapApi.mapBindDeviceInfo(deviceInfo.value) + message.success('新增成功') + addDeviceVisible.value = false + getDeviceList() + }) } const equipmentList = ref([]) diff --git a/src/views/mapPage/realTimeMap/editMap.vue b/src/views/mapPage/realTimeMap/editMap.vue index 238f2ff0..3cb2d597 100644 --- a/src/views/mapPage/realTimeMap/editMap.vue +++ b/src/views/mapPage/realTimeMap/editMap.vue @@ -395,8 +395,6 @@ v-if="item.type === 7 && item.layerSelectionShow" :style="{ position: 'absolute', - left: item.locationX + 'px', - top: item.locationY + 'px', color: item.fontColor, fontSize: item.fontSize + 'px', fontFamily: item.fontFamily, @@ -1352,6 +1350,7 @@ const toolbarClick = async (item) => { break case 'move': //移动 + console.log(state.allMapPointInfo[state.currentItemIndex]) state.moveForm.locationX = Number(state.allMapPointInfo[state.currentItemIndex].locationX) state.moveForm.locationY = Number(state.allMapPointInfo[state.currentItemIndex].locationY) break @@ -1701,25 +1700,24 @@ const startFromPoint = (index, event) => { //开始框选绘制 const startDrawSelection = (event) => { if ( - toolbarSwitchType.value !== 'createLineLibrary' && - toolbarSwitchType.value !== 'createRegion' && - toolbarSwitchType.value !== 'drawRoute' && - toolbarSwitchType.value !== 'generateLine' - ) - return + toolbarSwitchType.value === 'createLineLibrary' || + toolbarSwitchType.value === 'createRegion' || + toolbarSwitchType.value === 'drawRoute' || + toolbarSwitchType.value == 'generateLine' + ) { + const backgroundRect = mapBackgroundRef.value.getBoundingClientRect() - const backgroundRect = mapBackgroundRef.value.getBoundingClientRect() + const x = disposeEventPoints(event).x + const y = disposeEventPoints(event).y - const x = disposeEventPoints(event).x - const y = disposeEventPoints(event).y - - // 确保点击在背景区域内 - if (x >= 0 && x <= backgroundRect.width && y >= 0 && y <= backgroundRect.height) { - state.drawSelectionAreaShow = true - state.drawSelectionStartPoint = { x: x, y: y } - state.drawSelectionAreaBox = { x: x, y: y, width: 0, height: 0 } + // 确保点击在背景区域内 + if (x >= 0 && x <= backgroundRect.width && y >= 0 && y <= backgroundRect.height) { + state.drawSelectionAreaShow = true + state.drawSelectionStartPoint = { x: x, y: y } + state.drawSelectionAreaBox = { x: x, y: y, width: 0, height: 0 } + } + event.preventDefault() // 阻止默认行为(避免选中图片或文本) } - event.preventDefault() // 阻止默认行为(避免选中图片或文本) } // 更新框选区域 const updateDrawSelection = (event) => { @@ -1741,7 +1739,6 @@ const updateDrawSelection = (event) => { } } event.preventDefault() // 阻止默认行为(避免选中图片或文本) - return } if (toolbarSwitchType.value === 'clickDrawRoute') { // 实时绘制 @@ -1753,7 +1750,6 @@ const updateDrawSelection = (event) => { state.currentDrawY = y } event.preventDefault() // 阻止默认行为(避免选中图片或文本) - return } } //结束框选绘制 @@ -2473,6 +2469,8 @@ const getAllNodeList = async () => { item.resizable = false item.rotatable = true item.lockAspectRatio = true + item.locationDeep = 10 + item.locationWide = 10 } //要将实际的cm改成px From 50d0e654fb5343d7bbe72a4173fbecad5c8afcb9 Mon Sep 17 00:00:00 2001 From: yyy <2605810609@qq.com> Date: Tue, 18 Mar 2025 16:50:58 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=AD=97=E4=BD=93=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E5=8F=AF=E7=A7=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mapPage/realTimeMap/editMap.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/views/mapPage/realTimeMap/editMap.vue b/src/views/mapPage/realTimeMap/editMap.vue index 3cb2d597..86434cac 100644 --- a/src/views/mapPage/realTimeMap/editMap.vue +++ b/src/views/mapPage/realTimeMap/editMap.vue @@ -987,7 +987,11 @@ const handleInputEnd = () => { fontFamily: state.inputBoxStyle.fontFamily, //字体类型 fontSize: state.inputBoxStyle.fontSize, dataObj: {}, //存 设备点 停车点 文字 - layerSelectionShow: true + layerSelectionShow: true, + locationDeep: 20, + locationWide: 20, + locationDeepPx: 4, + locationWidePx: 4 }) addEditHistory() state.inputBoxValue = '' @@ -2469,8 +2473,8 @@ const getAllNodeList = async () => { item.resizable = false item.rotatable = true item.lockAspectRatio = true - item.locationDeep = 10 - item.locationWide = 10 + item.locationDeep = 20 + item.locationWide = 20 } //要将实际的cm改成px From 085b6cf130b13846f656829dce6121c42caa0582 Mon Sep 17 00:00:00 2001 From: yyy <2605810609@qq.com> Date: Tue, 18 Mar 2025 17:15:19 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E8=AE=BE=E5=A4=87bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../realTimeMap/components-tool/equipmentToolDialog.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/views/mapPage/realTimeMap/components-tool/equipmentToolDialog.vue b/src/views/mapPage/realTimeMap/components-tool/equipmentToolDialog.vue index 165090f2..2d70e096 100644 --- a/src/views/mapPage/realTimeMap/components-tool/equipmentToolDialog.vue +++ b/src/views/mapPage/realTimeMap/components-tool/equipmentToolDialog.vue @@ -127,6 +127,7 @@ const addDevice = () => { } //类型改变 const deviceTypeChange = async () => { + deviceInfo.value.deviceInfoId = '' getAllDeviceList() } const getAllDeviceList = async () => { @@ -167,7 +168,7 @@ const dialogClose = () => { const initAddForm = () => { deviceInfo.value.deviceInfoId = '' deviceInfo.value.deviceType = '' - getAllDeviceList() + allDeviceList.value = [] } defineExpose({ open }) // 提供 open 方法,用于打开弹窗