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) => { export const getDetailsApi = (data) => {
return service.get('/robot/sbdUser/getDetails', { params: 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) => { export const stopDeviceMKApi = (data) => {
return service.post('/icvs/audio/stopTalk?token=' + data.token, 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"> <div class="map-container" ref="mapContainerRef">
<svg ref="svgMapRef" class="svg-map-container" :width="svgWidth" :height="svgHeight"> <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" /> <image :href="mapImage" width="100%" height="100%" preserveAspectRatio="none" />
<circle <circle
v-for="(point, index) in devicePoints" v-for="(point, index) in devicePoints"
@ -16,6 +17,10 @@
/> />
</svg> </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 class="map-switch-btn" size="small" type="info" @click="onHandleMapSwitch">
地图切换 地图切换
</n-button> </n-button>
@ -27,7 +32,8 @@
import { ref, nextTick, onMounted } from 'vue' import { ref, nextTick, onMounted } from 'vue'
import TitleBackground from '@/components/TitleBackground/index.vue' import TitleBackground from '@/components/TitleBackground/index.vue'
import { getRobotDeviceListFn, getRobotMapInfoFn, getRobotPointsInfoFn } from '@/utils/getRobotInfo' 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 mapTitle = ref('巡检地图') //
const svgMapRef = ref(null) // svg const svgMapRef = ref(null) // svg
@ -65,7 +71,7 @@ const markPoints = (Robot_x, Robot_y) => {
const onHandleMapSwitch = () => { const onHandleMapSwitch = () => {
isMapSwitch.value = !isMapSwitch.value isMapSwitch.value = !isMapSwitch.value
mapImage.value = isMapSwitch.value ? imgSrc : mapInfo.value?.mapBase64 // mapImage.value = isMapSwitch.value ? imgSrc : mapInfo.value?.mapBase64
} }
onMounted(async () => { onMounted(async () => {
@ -105,6 +111,18 @@ onMounted(async () => {
position: absolute; 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 { .map-switch-btn {
position: absolute; position: absolute;
right: 4px; right: 4px;

View File

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

View File

@ -78,12 +78,12 @@
</n-grid> </n-grid>
<n-grid x-gap="24" :cols="24"> <n-grid x-gap="24" :cols="24">
<n-gi :span="24"> <n-gi :span="20">
<n-form-item label="摄像头预置位:" prop="preset"> <n-form-item label="摄像头预置位:" prop="preset">
<n-input <n-input
v-model:value="markerParams.preset"
placeholder="摄像头预置位"
clearable clearable
placeholder="摄像头预置位"
v-model:value="markerParams.preset"
/> />
<!-- <n-select <!-- <n-select
@ -93,6 +93,10 @@
/> --> /> -->
</n-form-item> </n-form-item>
</n-gi> </n-gi>
<n-gi :span="4" style="text-align: right">
<n-button type="primary" @click="onHandleSetPreset"> 设置预置位 </n-button>
</n-gi>
</n-grid> </n-grid>
<n-grid x-gap="24" :cols="24"> <n-grid x-gap="24" :cols="24">
@ -151,7 +155,8 @@ import ControlDeck from './control-deck.vue'
import { useMessage, useDialog } from 'naive-ui' import { useMessage, useDialog } from 'naive-ui'
import { watch, ref, onMounted, nextTick, onBeforeUnmount } from 'vue' import { watch, ref, onMounted, nextTick, onBeforeUnmount } from 'vue'
import { getRobotTokenFn, getRobotDeviceListFn, getRobotMapInfoFn } from '@/utils/getRobotInfo' 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 message = useMessage()
const deviceToken = ref('') 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) => { const addOrEditMarker = async (isCurrentPosition, isSuccess) => {
@ -398,7 +431,7 @@ watch(
markerParams.value.markerY1 = newVal?.markerY1 markerParams.value.markerY1 = newVal?.markerY1
markerParams.value.markerName = newVal?.markerName markerParams.value.markerName = newVal?.markerName
markerParams.value.markerAngle = newVal?.markerAngle 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.xCount = Math.ceil(newVal?.xCount).toString()
markerParams.value.yCount = Math.ceil(newVal?.yCount).toString() markerParams.value.yCount = Math.ceil(newVal?.yCount).toString()

View File

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

View File

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