From b088a7106aaf70da64be742905006ffd29cf343e Mon Sep 17 00:00:00 2001 From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com> Date: Fri, 29 Aug 2025 09:10:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/components/control-deck-new.vue | 105 +++++++++++++----- src/views/home/components/control-deck.vue | 97 ++++++++++++---- .../modal-content/add-or-edit-form.vue | 11 +- .../modal-content/add-or-edit-marker-form.vue | 41 ++++--- .../components/modal-content/control-deck.vue | 41 ++++--- .../home/components/right-two/taps-three.vue | 29 +++-- 6 files changed, 222 insertions(+), 102 deletions(-) diff --git a/src/views/home/components/control-deck-new.vue b/src/views/home/components/control-deck-new.vue index 5387471..c4898fa 100644 --- a/src/views/home/components/control-deck-new.vue +++ b/src/views/home/components/control-deck-new.vue @@ -41,18 +41,27 @@ -
-
速度
-
30
+
+ + +
- +
--> +
@@ -62,9 +71,17 @@
-
-
速度
-
30
+
+ +
@@ -75,28 +92,24 @@ 缩放 右转
- +
@@ -478,31 +489,65 @@ const beforeUpload = ({ file }) => { return true } +// 暂停和停止巡航 +const handleStopAndOverRouter = async (type) => { + return new Promise((resolve) => { + dialog.warning({ + title: '提示', + content: `当前机器人正在巡检中,确定${type == 15 ? '暂停' : '结束'}巡检吗?`, + positiveText: '确定', + negativeText: '取消', + onPositiveClick: async () => { + try { + const { data: res } = await handleRobotActionApi({ + puId: robotData.robotInfo?.puId, + type: type, + }) + if (res.code == 200) { + message.success(`已${type == 15 ? '暂停' : '结束'}巡检`) + getRobotBaseInfo() + resolve(false) // 已暂停巡检,返回false表示不处于巡检状态 + } else { + message.error(`${type == 15 ? '暂停' : '结束'}巡检失败` + res.message) + resolve(true) // 暂停失败,仍然处于巡检状态 + } + } catch (error) { + message.error(`${type == 15 ? '暂停' : '结束'}巡检出错`) + resolve(true) // 出错时,假设仍然处于巡检状态 + } + }, + onNegativeClick: () => { + resolve(true) // 用户取消,仍然处于巡检状态 + }, + }) + }) +} + // 判断当前机器人是否在 巡检中 如果在巡检中 则不可进行任何操作 可弹框提示客户暂停巡检 然后重新获取机器人状态再进行操作 const handleInspection = async () => { if (robotBaseInfo.value.type.includes('巡航')) { return new Promise((resolve) => { dialog.warning({ title: '提示', - content: '当前机器人正在巡检中,可暂停巡检后再进行操作', - positiveText: '暂停巡检', + content: '当前机器人正在巡检中,可停止巡检后再进行操作', + positiveText: '停止巡检', negativeText: '取消', onPositiveClick: async () => { try { const { data: res } = await handleRobotActionApi({ puId: robotData.robotInfo?.puId, - type: '15', + type: '14', }) if (res.code == 200) { - message.success('已暂停巡检') + message.success('已停止巡检') getRobotBaseInfo() resolve(false) // 已暂停巡检,返回false表示不处于巡检状态 } else { - message.error('暂停巡检失败' + res.message) + message.error('停止巡检失败' + res.message) resolve(true) // 暂停失败,仍然处于巡检状态 } } catch (error) { - message.error('暂停巡检出错') + message.error('停止巡检出错') resolve(true) // 出错时,假设仍然处于巡检状态 } }, @@ -713,7 +758,7 @@ const handleChangeCamera = debounce(async (motion) => { idx: 0, motion, }) -}, 1000) +}, 0) // 球机缩放 const handleChangeZoomCamera = async (motion) => { @@ -774,7 +819,7 @@ const handleChangeRobot = debounce(async (type) => { if (res.code == 200 && type == 9) { isStopRight.value = false } -}, 1000) +}, 0) // 停止机器人 const handleStopRobot = async () => { @@ -824,7 +869,7 @@ const handleChangeVolume = debounce(async (value) => { } else { message.error('音量调整失败') } -}, 1000) +}, 0) const isOpenMK = ref(false) const onHandleOpenOrCloseMK = async (type) => { diff --git a/src/views/home/components/control-deck.vue b/src/views/home/components/control-deck.vue index 922bf33..13f7c83 100644 --- a/src/views/home/components/control-deck.vue +++ b/src/views/home/components/control-deck.vue @@ -42,8 +42,17 @@
-
速度
-
30
+ + + + 暂停巡航 +
@@ -63,8 +72,16 @@
-
速度
-
30
+ + + 结束巡航 +
@@ -74,28 +91,24 @@
- +
@@ -118,13 +135,11 @@ 缩放 右转
- +
@@ -470,6 +485,40 @@ const beforeUpload = ({ file }) => { return true } +// 暂停和停止巡航 +const handleStopAndOverRouter = async (type) => { + return new Promise((resolve) => { + dialog.warning({ + title: '提示', + content: `当前机器人正在巡检中,确定${type == 15 ? '暂停' : '结束'}巡检吗?`, + positiveText: '确定', + negativeText: '取消', + onPositiveClick: async () => { + try { + const { data: res } = await handleRobotActionApi({ + puId: robotData.robotInfo?.puId, + type: type, + }) + if (res.code == 200) { + message.success(`已${type == 15 ? '暂停' : '结束'}巡检`) + getRobotBaseInfo() + resolve(false) // 已暂停巡检,返回false表示不处于巡检状态 + } else { + message.error(`${type == 15 ? '暂停' : '结束'}巡检失败` + res.message) + resolve(true) // 暂停失败,仍然处于巡检状态 + } + } catch (error) { + message.error(`${type == 15 ? '暂停' : '结束'}巡检出错`) + resolve(true) // 出错时,假设仍然处于巡检状态 + } + }, + onNegativeClick: () => { + resolve(true) // 用户取消,仍然处于巡检状态 + }, + }) + }) +} + // 判断当前机器人是否在 巡检中 如果在巡检中 则不可进行任何操作 可弹框提示客户暂停巡检 然后重新获取机器人状态再进行操作 const handleInspection = async () => { // if (robotBaseInfo.value.type.includes('巡检')) { @@ -501,25 +550,25 @@ const handleInspection = async () => { return new Promise((resolve) => { dialog.warning({ title: '提示', - content: '当前机器人正在巡检中,可暂停巡检后再进行操作', - positiveText: '暂停巡检', + content: '当前机器人正在巡检中,可停止巡检后再进行操作', + positiveText: '停止巡检', negativeText: '取消', onPositiveClick: async () => { try { const { data: res } = await handleRobotActionApi({ puId: robotData.robotInfo?.puId, - type: '15', + type: '14', }) if (res.code == 200) { - message.success('已暂停巡检') + message.success('已停止巡检') getRobotBaseInfo() resolve(false) // 已暂停巡检,返回false表示不处于巡检状态 } else { - message.error('暂停巡检失败' + res.message) + message.error('停止巡检失败' + res.message) resolve(true) // 暂停失败,仍然处于巡检状态 } } catch (error) { - message.error('暂停巡检出错') + message.error('停止巡检出错') resolve(true) // 出错时,假设仍然处于巡检状态 } }, @@ -729,7 +778,7 @@ const handleChangeCamera = debounce(async (motion) => { idx: 0, motion, }) -}, 1000) +}, 0) // 球机缩放 const handleChangeZoomCamera = async (motion) => { @@ -843,7 +892,7 @@ const handleChangeRobot = debounce(async (type) => { if (res.code == 200 && type == 9) { isStopRight.value = false } -}, 1000) +}, 0) // 停止机器人 const handleStopRobot = async () => { diff --git a/src/views/home/components/modal-content/add-or-edit-form.vue b/src/views/home/components/modal-content/add-or-edit-form.vue index c30e73e..c4eea79 100644 --- a/src/views/home/components/modal-content/add-or-edit-form.vue +++ b/src/views/home/components/modal-content/add-or-edit-form.vue @@ -584,6 +584,7 @@ const onHandleAddRoute = () => { ptzy: '', ptzz: '', actions: [], + preset: '', }) } @@ -637,7 +638,7 @@ const handleChangePointName = (event, index) => { } const pointInfo = markerPointList.value.find((item) => item.value == event) - const { positionX, positionY, theta, ptzx, ptzy, ptzz } = pointInfo + const { positionX, positionY, theta, ptzx, ptzy, ptzz, preset } = pointInfo routeList.value[index].pointName = pointInfo?.label routeList.value[index].pointId = pointInfo?.value routeList.value[index].x = positionX @@ -646,6 +647,7 @@ const handleChangePointName = (event, index) => { routeList.value[index].ptzx = ptzx routeList.value[index].ptzy = ptzy routeList.value[index].ptzz = ptzz + routeList.value[index].preset = preset markPoints(positionX, positionY, pointInfo?.value, index) } @@ -731,10 +733,12 @@ const onHandleSave = async () => { ptzx: item.ptzx, ptzy: item.ptzy, ptzz: item.ptzz, + preset: item.preset, x: item.x, y: item.y, actions: item.actions, num: index + 1, + imgNum: item.num, interval: item.interval, }) }) @@ -742,7 +746,7 @@ const onHandleSave = async () => { positions.forEach((item) => { if (item.actions && item.actions.length > 0) { item.actions.forEach((action) => { - action.num = item.num + action.num = item.imgNum action.interval = item.interval }) } @@ -991,7 +995,7 @@ watch( pointName: item.positionId, theta: item.theta, actionType: null, - num: '', + num: item.num, interval: '', x: item.x, y: item.y, @@ -999,6 +1003,7 @@ watch( ptzx: item.ptzx, ptzy: item.ptzy, ptzz: item.ptzz, + preset: item.preset, actions: item.actions || [], } diff --git a/src/views/home/components/modal-content/add-or-edit-marker-form.vue b/src/views/home/components/modal-content/add-or-edit-marker-form.vue index 2d4d72f..23bf950 100644 --- a/src/views/home/components/modal-content/add-or-edit-marker-form.vue +++ b/src/views/home/components/modal-content/add-or-edit-marker-form.vue @@ -79,18 +79,18 @@ - - + /> - + /> --> @@ -198,6 +198,7 @@ const markerParams = ref({ PTZ_x: '', PTZ_y: '', id: '', + preset: '', }) const addOrEditMarkerFormRules = ref({ @@ -273,14 +274,16 @@ const getRobotCurrentPosition = async (puId) => { // 新增或者修改点位 -const addOrEditMarker = async (isCurrentPosition) => { - const { Robot_x, Robot_y, PTZ_x, PTZ_y, PTZ_zoom, Robot_theta } = isCurrentPosition - markerParams.value.xCount = Robot_x - markerParams.value.yCount = Robot_y - markerParams.value.PTZ_x = PTZ_x - markerParams.value.PTZ_y = PTZ_y - // markerParams.value.markerAngle = Robot_theta - markerParams.value.PTZ_zoom = PTZ_zoom +const addOrEditMarker = async (isCurrentPosition, isSuccess) => { + if (isSuccess) { + const { Robot_x, Robot_y, PTZ_x, PTZ_y, PTZ_zoom, Robot_theta } = isCurrentPosition + markerParams.value.xCount = Robot_x + markerParams.value.yCount = Robot_y + markerParams.value.PTZ_x = PTZ_x + markerParams.value.PTZ_y = PTZ_y + markerParams.value.markerAngle = Robot_theta + markerParams.value.PTZ_zoom = PTZ_zoom + } const addMarkerParams = { ptzz: markerParams.value.PTZ_zoom, @@ -291,6 +294,7 @@ const addOrEditMarker = async (isCurrentPosition) => { positionY: Math.ceil(markerParams.value.yCount), mapId: markerParams.value.mapId, pointName: markerParams.value.markerName, + preset: markerParams.value.preset, } if (markerParams.value.type === '修改') { @@ -316,6 +320,8 @@ const onHandleConfirm = () => { }).then(async (res) => { const { Robot_x, Robot_y, PTZ_x, PTZ_y, PTZ_zoom, Robot_theta } = res?.data.data + const isSuccess = res?.data?.data ? true : false + // 判断当前点位和机器人位置是否一致 if ( Math.abs(Robot_x - markerParams.value.xCount) > 50 || @@ -340,7 +346,7 @@ const onHandleConfirm = () => { onHandleGoToPoint() }, onNegativeClick: async () => { - addOrEditMarker(Position) + addOrEditMarker(Position, isSuccess) }, }) } else { @@ -350,7 +356,7 @@ const onHandleConfirm = () => { positiveText: '确定新增', negativeText: '取消', onPositiveClick: async () => { - addOrEditMarker(Position) + addOrEditMarker(Position, isSuccess) }, onNegativeClick: () => {}, }) @@ -364,7 +370,8 @@ const onHandleConfirm = () => { PTZ_zoom, Robot_theta, } - addOrEditMarker(isCurrentPosition) + + addOrEditMarker(isCurrentPosition, isSuccess) } }) } diff --git a/src/views/home/components/modal-content/control-deck.vue b/src/views/home/components/modal-content/control-deck.vue index 817e9cd..22a5539 100644 --- a/src/views/home/components/modal-content/control-deck.vue +++ b/src/views/home/components/modal-content/control-deck.vue @@ -12,13 +12,11 @@ alt="" @mousedown="handleChangeCamera('up')" @mouseup="handleChangeCamera('stop')" - @click="handleChangeCamera('up')" /> @@ -26,7 +24,6 @@ class="arrow-bottom hand-direction" src="@/assets/home-imgs/control-2-arrow.png" alt="" - @click="handleChangeCamera('down')" @mousedown="handleChangeCamera('down')" @mouseup="handleChangeCamera('stop')" /> @@ -34,14 +31,18 @@ class="arrow-left hand-direction" src="@/assets/home-imgs/control-2-arrow.png" alt="" - @click="handleChangeCamera('left')" @mousedown="handleChangeCamera('left')" @mouseup="handleChangeCamera('stop')" /> -
- +
+
@@ -54,14 +55,12 @@
缩放 右转
- +
@@ -171,25 +170,25 @@ const handleInspection = async () => { return new Promise((resolve) => { dialog.warning({ title: '提示', - content: '当前机器人正在巡检中,可暂停巡检后再进行操作', - positiveText: '暂停巡检', + content: '当前机器人正在巡检中,可停止巡检后再进行操作', + positiveText: '停止巡检', negativeText: '取消', onPositiveClick: async () => { try { const { data: res } = await handleRobotActionApi({ puId: robotData.robotInfo?.puId, - type: '15', + type: '14', }) if (res.code == 200) { - message.success('已暂停巡检') + message.success('已停止巡检') getRobotBaseInfo() resolve(false) // 已暂停巡检,返回false表示不处于巡检状态 } else { - message.error('暂停巡检失败' + res.message) + message.error('停止巡检失败' + res.message) resolve(true) // 暂停失败,仍然处于巡检状态 } } catch (error) { - message.error('暂停巡检出错') + message.error('停止巡检出错') resolve(true) // 出错时,假设仍然处于巡检状态 } }, @@ -246,7 +245,7 @@ const handleChangeCamera = debounce(async (motion) => { idx: 0, motion, }) -}, 1000) +}, 0) // 球机缩放 const handleChangeZoomCamera = async (motion) => { @@ -297,7 +296,7 @@ const handleChangeRobot = debounce(async (type) => { isStopRight.value = true } } -}, 600) +}, 0) onMounted(async () => { getRobotBaseInfo() diff --git a/src/views/home/components/right-two/taps-three.vue b/src/views/home/components/right-two/taps-three.vue index 227fdec..0bc159f 100644 --- a/src/views/home/components/right-two/taps-three.vue +++ b/src/views/home/components/right-two/taps-three.vue @@ -56,21 +56,22 @@ modalTitle="比对图片" @onHandleCloseModal="imageModalVisible = false" > -
-
+ +
+
第一张巡检照片
-
+
上一次巡检照片
@@ -240,4 +241,18 @@ getImagePageList() width: 100%; height: 100%; } + +.image-container { + display: flex; + justify-content: space-around; + align-items: center; + + .image-item { + margin: 0 10px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + } +}