This commit is contained in:
BianLzhaoMin 2025-08-29 09:10:12 +08:00
parent 171d7d331e
commit b088a7106a
6 changed files with 222 additions and 102 deletions

View File

@ -41,18 +41,27 @@
<!-- 第二行 -->
<n-grid :cols="24">
<n-grid-item :span="9">
<div class="row-2-item" v-show="false">
<div>速度</div>
<div>30</div>
<div class="row-2-item">
<!-- <div>速度</div>
<div>30</div> -->
<!-- <n-button
type="primary"
size="small"
@click="handleStopAndOverRouter('15')"
v-if="robotBaseInfo.type.includes('巡航')"
>
暂停巡航
</n-button> -->
</div>
</n-grid-item>
<n-grid-item :span="6">
<!-- <div class="row-2-item">
<div>高度</div>
<div class="row-2-item">
<!-- <div>高度</div>
<div>
{{ currentHeight }}
</div>
</div> -->
</div> -->
</div>
<div class="row-2-item">
<div></div>
@ -62,9 +71,17 @@
</div>
</n-grid-item>
<n-grid-item :span="9">
<div class="row-2-item" v-show="false">
<div>速度</div>
<div>30</div>
<div class="row-2-item">
<!-- <div>速度</div>
<div>30</div> -->
<!-- <n-button
type="primary"
size="small"
@click="handleStopAndOverRouter('14')"
v-if="robotBaseInfo.value.type.includes('巡航')"
>
结束巡航
</n-button> -->
</div>
</n-grid-item>
</n-grid>
@ -75,28 +92,24 @@
<!-- 上下左右控制按钮 -->
<img
class="arrow-top hand-direction"
@click="handleChangeCamera('up')"
@mousedown="handleChangeCamera('up')"
@mouseup="handleChangeCamera('stop')"
src="@/assets/home-imgs/control-2-arrow.png"
/>
<img
class="arrow-right hand-direction"
@click="handleChangeCamera('right')"
@mousedown="handleChangeCamera('right')"
@mouseup="handleChangeCamera('stop')"
src="@/assets/home-imgs/control-2-arrow.png"
/>
<img
class="arrow-bottom hand-direction"
@click="handleChangeCamera('down')"
@mousedown="handleChangeCamera('down')"
@mouseup="handleChangeCamera('stop')"
src="@/assets/home-imgs/control-2-arrow.png"
/>
<img
class="arrow-left hand-direction"
@click="handleChangeCamera('left')"
@mousedown="handleChangeCamera('left')"
@mouseup="handleChangeCamera('stop')"
src="@/assets/home-imgs/control-2-arrow.png"
@ -122,13 +135,11 @@
<span>缩放</span>
<img
style="margin-bottom: 2px"
@click="handleChangeZoomCamera('ZoomIn')"
@mousedown="handleChangeZoomCamera('ZoomIn')"
@mouseup="handleStopDeviceCameraZoom()"
src="@/assets/home-imgs/control-2-add.png"
/>
<img
@click="handleChangeZoomCamera('ZoomOut')"
@mousedown="handleChangeZoomCamera('ZoomOut')"
@mouseup="handleStopDeviceCameraZoom()"
src="@/assets/home-imgs/control-2-reduce.png"
@ -152,28 +163,24 @@
<!-- 上下左右控制按钮 -->
<img
class="arrow-top"
@click="handleChangeRobot('5')"
@mousedown="handleChangeRobot('5')"
@mouseup="handleChangeRobot(9)"
src="@/assets/home-imgs/control-2-arrow.png"
/>
<img
class="arrow-right"
@click="handleChangeRobot('8')"
@mousedown="handleChangeRobot('8')"
@mouseup="handleChangeRobot(9)"
src="@/assets/home-imgs/control-2-arrow.png"
/>
<img
class="arrow-bottom"
@click="handleChangeRobot('6')"
@mousedown="handleChangeRobot('6')"
@mouseup="handleChangeRobot(9)"
src="@/assets/home-imgs/control-2-arrow.png"
/>
<img
class="arrow-left"
@click="handleChangeRobot('7')"
@mousedown="handleChangeRobot('7')"
@mouseup="handleChangeRobot(9)"
src="@/assets/home-imgs/control-2-arrow.png"
@ -186,7 +193,11 @@
<div class="text-right description-text">右转</div>
<div class="row-3-item-1-center">
<img class="center-icon" :src="isStopRight ? startImg : stopImg" />
<img
class="center-icon"
@click="handleChangeRobot(9)"
:src="isStopRight ? startImg : stopImg"
/>
</div>
</div>
</n-grid-item>
@ -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) => {

View File

@ -42,8 +42,17 @@
<n-grid :cols="24">
<n-grid-item :span="9">
<div class="row-2-item" v-show="false">
<div>速度</div>
<div>30</div>
<!-- <div>速度</div>
<div>30</div> -->
<n-button
type="primary"
size="small"
@click="handleStopAndOverRouter('15')"
v-if="robotBaseInfo.value.type.includes('巡航')"
>
暂停巡航
</n-button>
</div>
</n-grid-item>
<n-grid-item :span="6">
@ -63,8 +72,16 @@
</n-grid-item>
<n-grid-item :span="9">
<div class="row-2-item" v-show="false">
<div>速度</div>
<div>30</div>
<!-- <div>速度</div>
<div>30</div> -->
<n-button
type="primary"
size="small"
@click="handleStopAndOverRouter('14')"
v-if="robotBaseInfo.value.type.includes('巡航')"
>
结束巡航
</n-button>
</div>
</n-grid-item>
</n-grid>
@ -74,28 +91,24 @@
<div class="row-3-item-1">
<!-- 上下左右控制按钮 -->
<img
@click="handleChangeCamera('up')"
class="arrow-top hand-direction"
@mousedown="handleChangeCamera('up')"
@mouseup="handleChangeCamera('stop')"
src="@/assets/home-imgs/control-2-arrow.png"
/>
<img
@click="handleChangeCamera('right')"
class="arrow-right hand-direction"
@mousedown="handleChangeCamera('right')"
@mouseup="handleChangeCamera('stop')"
src="@/assets/home-imgs/control-2-arrow.png"
/>
<img
@click="handleChangeCamera('down')"
class="arrow-bottom hand-direction"
@mousedown="handleChangeCamera('down')"
@mouseup="handleChangeCamera('stop')"
src="@/assets/home-imgs/control-2-arrow.png"
/>
<img
@click="handleChangeCamera('left')"
class="arrow-left hand-direction"
@mousedown="handleChangeCamera('left')"
@mouseup="handleChangeCamera('stop')"
@ -104,7 +117,11 @@
<!-- 中间的按钮 -->
<div class="row-3-item-1-center">
<img class="center-icon" :src="isStopLeft ? stopImg : startImg" />
<img
class="center-icon"
@click="handleChangeCamera('stop')"
:src="isStopLeft ? stopImg : startImg"
/>
</div>
<!-- 描述文字 -->
@ -118,13 +135,11 @@
<span>缩放</span>
<img
style="margin-bottom: 2px"
@click="handleChangeZoomCamera('ZoomIn')"
@mousedown="handleChangeZoomCamera('ZoomIn')"
@mouseup="handleStopDeviceCameraZoom()"
src="@/assets/home-imgs/control-2-add.png"
/>
<img
@click="handleChangeZoomCamera('ZoomOut')"
@mousedown="handleChangeZoomCamera('ZoomOut')"
@mouseup="handleStopDeviceCameraZoom()"
src="@/assets/home-imgs/control-2-reduce.png"
@ -148,28 +163,24 @@
<!-- 上下左右控制按钮 -->
<img
class="arrow-top"
@click="handleChangeRobot('5')"
@mousedown="handleChangeRobot('5')"
@mouseup="handleChangeRobot(9)"
src="@/assets/home-imgs/control-2-arrow.png"
/>
<img
class="arrow-right"
@click="handleChangeRobot('8')"
@mousedown="handleChangeRobot('8')"
@mouseup="handleChangeRobot(9)"
src="@/assets/home-imgs/control-2-arrow.png"
/>
<img
class="arrow-bottom"
@click="handleChangeRobot('6')"
@mousedown="handleChangeRobot('6')"
@mouseup="handleChangeRobot(9)"
src="@/assets/home-imgs/control-2-arrow.png"
/>
<img
class="arrow-left"
@click="handleChangeRobot('7')"
@mousedown="handleChangeRobot('7')"
@mouseup="handleChangeRobot(9)"
src="@/assets/home-imgs/control-2-arrow.png"
@ -182,7 +193,11 @@
<div class="text-right description-text">右转</div>
<div class="row-3-item-1-center">
<img class="center-icon" :src="isStopRight ? startImg : stopImg" />
<img
class="center-icon"
@click="handleChangeRobot(9)"
:src="isStopRight ? startImg : stopImg"
/>
</div>
</div>
</n-grid-item>
@ -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 () => {

View File

@ -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 || [],
}

View File

@ -79,18 +79,18 @@
<n-grid x-gap="24" :cols="24">
<n-gi :span="24">
<n-form-item label="摄像头预置位:" prop="markerPreset">
<!-- <n-input
v-model:value="markerParams.markerPreset"
<n-form-item label="摄像头预置位:" prop="preset">
<n-input
v-model:value="markerParams.preset"
placeholder="摄像头预置位"
clearable
/> -->
/>
<n-select
<!-- <n-select
:options="presetOptions"
placeholder="请选择摄像头预置位"
v-model:value="markerParams.markerPreset"
/>
/> -->
</n-form-item>
</n-gi>
</n-grid>
@ -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)
}
})
}

View File

@ -12,13 +12,11 @@
alt=""
@mousedown="handleChangeCamera('up')"
@mouseup="handleChangeCamera('stop')"
@click="handleChangeCamera('up')"
/>
<img
class="arrow-right hand-direction"
src="@/assets/home-imgs/control-2-arrow.png"
alt=""
@click="handleChangeCamera('right')"
@mousedown="handleChangeCamera('right')"
@mouseup="handleChangeCamera('stop')"
/>
@ -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')"
/>
<!-- 中间的按钮 -->
<div class="row-3-item-1-center" @click="handleStopCamera">
<img alt="" class="center-icon" :src="isStopLeft ? startImg : stopImg" />
<div class="row-3-item-1-center">
<img
alt=""
class="center-icon"
:src="isStopLeft ? startImg : stopImg"
@click="handleChangeCamera('stop')"
/>
</div>
<!-- 描述文字 -->
@ -54,14 +55,12 @@
<div class="add-reduce-btn">
<span>缩放</span>
<img
@click="handleChangeZoomCamera('ZoomIn')"
style="margin-left: 20px; transform: rotate(-90deg)"
src="@/assets/home-imgs/control-2-add.png"
@mousedown="handleChangeZoomCamera('ZoomIn')"
@mouseup="handleStopDeviceCameraZoom()"
/>
<img
@click="handleChangeZoomCamera('ZoomOut')"
style="margin-left: 50px; transform: rotate(-90deg)"
src="@/assets/home-imgs/control-2-reduce.png"
@mousedown="handleChangeZoomCamera('ZoomOut')"
@ -75,7 +74,6 @@
<div class="row-3-item-3">
<!-- 上下左右控制按钮 -->
<img
@click="handleChangeRobot('5')"
@mousedown="handleChangeRobot('5')"
@mouseup="handleChangeRobot(9)"
class="arrow-top"
@ -83,7 +81,6 @@
alt=""
/>
<img
@click="handleChangeRobot('8')"
@mousedown="handleChangeRobot('8')"
@mouseup="handleChangeRobot(9)"
class="arrow-right"
@ -91,7 +88,6 @@
alt=""
/>
<img
@click="handleChangeRobot('6')"
@mousedown="handleChangeRobot('6')"
@mouseup="handleChangeRobot(9)"
class="arrow-bottom"
@ -99,7 +95,6 @@
alt=""
/>
<img
@click="handleChangeRobot('7')"
@mousedown="handleChangeRobot('7')"
@mouseup="handleChangeRobot(9)"
class="arrow-left"
@ -114,7 +109,11 @@
<div class="text-right description-text">右转</div>
<div class="row-3-item-1-center">
<img class="center-icon" :src="isStopRight ? startImg : stopImg" />
<img
class="center-icon"
:src="isStopRight ? startImg : stopImg"
@click="handleChangeRobot(9)"
/>
</div>
</div>
</n-grid-item>
@ -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()

View File

@ -56,21 +56,22 @@
modalTitle="比对图片"
@onHandleCloseModal="imageModalVisible = false"
>
<div style="display: flex; justify-content: space-around">
<div>
<!-- 巡检比对图片 -->
<div class="image-container">
<div class="image-item">
<div style="margin-bottom: 10px; color: #fff">第一张巡检照片</div>
<n-image
width="100%"
height="100%"
width="420"
height="420"
fit="cover"
:src="imgPreviewUrl + startImage"
/>
</div>
<div>
<div class="image-item">
<div style="color: #fff">上一次巡检照片</div>
<n-image
width="100%"
height="100%"
width="420"
height="420"
fit="cover"
:src="imgPreviewUrl + endImage"
/>
@ -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;
}
}
</style>