This commit is contained in:
BianLzhaoMin 2025-09-03 16:34:40 +08:00
parent c7874326c5
commit 5e56329d21
9 changed files with 74 additions and 13 deletions

View File

@ -129,3 +129,7 @@ export const deletePersonApi = (data) => {
export const getDetailsApi = (data) => {
return service.get('/robot/sbdUser/getDetails', { params: data })
}
// 设置预置位
export const setDevicePresetApi2 = (data) => {
return service.post('/robot/instruct/sedXml', data)
}

BIN
src/assets/map-wx.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 MiB

BIN
src/assets/map-wx2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 KiB

View File

@ -47,3 +47,8 @@ export const openDeviceMKApi = (data) => {
export const stopDeviceMKApi = (data) => {
return service.post('/icvs/audio/stopTalk?token=' + data.token, data)
}
// 设置预置位
export const setDevicePresetApi = (data) => {
return service.post('/PTZ/C_PTZ_SetPresetPos?token=' + data.token, data)
}

View File

@ -5,6 +5,7 @@
<div class="map-container" ref="mapContainerRef">
<svg ref="svgMapRef" class="svg-map-container" :width="svgWidth" :height="svgHeight">
<!-- <image :href="mapImage" width="100%" height="100%" preserveAspectRatio="none" /> -->
<image :href="mapImage" width="100%" height="100%" preserveAspectRatio="none" />
<circle
v-for="(point, index) in devicePoints"
@ -16,6 +17,10 @@
/>
</svg>
<div class="map-image" v-if="isMapSwitch">
<!-- <image :href="imgSrc" width="100%" height="100%" /> -->
</div>
<n-button class="map-switch-btn" size="small" type="info" @click="onHandleMapSwitch">
地图切换
</n-button>
@ -27,7 +32,8 @@
import { ref, nextTick, onMounted } from 'vue'
import TitleBackground from '@/components/TitleBackground/index.vue'
import { getRobotDeviceListFn, getRobotMapInfoFn, getRobotPointsInfoFn } from '@/utils/getRobotInfo'
import imgSrc from '@/assets/demo.png'
import imgSrc from '@/assets/map-wx.png'
import imgSrc1 from '@/assets/map-wx2.png'
const mapTitle = ref('巡检地图') //
const svgMapRef = ref(null) // svg
@ -65,7 +71,7 @@ const markPoints = (Robot_x, Robot_y) => {
const onHandleMapSwitch = () => {
isMapSwitch.value = !isMapSwitch.value
mapImage.value = isMapSwitch.value ? imgSrc : mapInfo.value?.mapBase64
// mapImage.value = isMapSwitch.value ? imgSrc : mapInfo.value?.mapBase64
}
onMounted(async () => {
@ -105,6 +111,18 @@ onMounted(async () => {
position: absolute;
}
.map-image {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 2;
background: url('@/assets/map-wx.png') no-repeat center center;
background-size: 100% 100%;
opacity: 0.8;
}
.map-switch-btn {
position: absolute;
right: 4px;

View File

@ -195,7 +195,7 @@
clearable
v-model:value="item.pointName"
:options="markerPointList"
style="width: 110px"
style="width: 240px"
@update:value="handleChangePointName($event, index)"
/>
</n-form-item>
@ -1049,7 +1049,7 @@ watch(
/* background: skyblue; */
.svg-map-container {
background: skyblue;
// background: skyblue;
}
}

View File

@ -78,12 +78,12 @@
</n-grid>
<n-grid x-gap="24" :cols="24">
<n-gi :span="24">
<n-gi :span="20">
<n-form-item label="摄像头预置位:" prop="preset">
<n-input
v-model:value="markerParams.preset"
placeholder="摄像头预置位"
clearable
placeholder="摄像头预置位"
v-model:value="markerParams.preset"
/>
<!-- <n-select
@ -93,6 +93,10 @@
/> -->
</n-form-item>
</n-gi>
<n-gi :span="4" style="text-align: right">
<n-button type="primary" @click="onHandleSetPreset"> 设置预置位 </n-button>
</n-gi>
</n-grid>
<n-grid x-gap="24" :cols="24">
@ -151,7 +155,8 @@ import ControlDeck from './control-deck.vue'
import { useMessage, useDialog } from 'naive-ui'
import { watch, ref, onMounted, nextTick, onBeforeUnmount } from 'vue'
import { getRobotTokenFn, getRobotDeviceListFn, getRobotMapInfoFn } from '@/utils/getRobotInfo'
import { handleRobotActionApi, addMarkerApi } from '@/api/home'
import { handleRobotActionApi, addMarkerApi, setDevicePresetApi2 } from '@/api/home'
import { setDevicePresetApi } from '@/utils/initLogin'
const message = useMessage()
const deviceToken = ref('')
@ -272,6 +277,34 @@ const getRobotCurrentPosition = async (puId) => {
}
}
// ()
const onHandleSetPreset = async () => {
// const params = {
// idx: 0,
// token: deviceToken.value,
// puid: deviceInfo.value?.puId,
// PresetPos: markerParams.value.preset,
// Name: markerParams.value.markerName,
// }
// const res = setDevicePresetApi(params)
// console.log('', res)
const params = {
puId: deviceInfo.value?.puId,
type: '21',
value: markerParams.value.preset,
name: 'robot' + markerParams.value.preset,
}
const { data: res } = await setDevicePresetApi2(params)
if (res.data.code == 200) {
message.success('预置位设置成功')
} else {
message.error('预置位设置失败')
}
}
//
const addOrEditMarker = async (isCurrentPosition, isSuccess) => {
@ -398,7 +431,7 @@ watch(
markerParams.value.markerY1 = newVal?.markerY1
markerParams.value.markerName = newVal?.markerName
markerParams.value.markerAngle = newVal?.markerAngle
markerParams.value.markerPreset = newVal?.markerPreset
markerParams.value.preset = newVal?.markerPreset
markerParams.value.xCount = Math.ceil(newVal?.xCount).toString()
markerParams.value.yCount = Math.ceil(newVal?.yCount).toString()

View File

@ -3,7 +3,7 @@
<DialogModal
@onHandleCloseModal="onHandleCloseModal"
:modalTitle="modalTitle"
:width="`80vw`"
:width="`90vw`"
style="position: relative"
>
<!-- 平面图操作区域 -->
@ -756,6 +756,7 @@ const getMarkerListAll = async () => {
markerY1: logicalY1,
markerName: item.pointName,
markerAngle: item.theta,
markerPreset: item.preset,
isAdd: false,
})

View File

@ -100,14 +100,14 @@ const endImage = ref('')
const imgPreviewUrl = import.meta.env.VITE_APP_imgPreviewUrl
const isSendOptions = ref([
{ label: '正常', value: '1' },
{ label: '异常', value: '0' },
{ label: '正常', value: '0' },
{ label: '异常', value: '1' },
])
const queryParams = ref({
pageNum: 1,
pageSize: 10,
pointName: '',
status: '',
status: null,
type: 996,
})