Compare commits

..

No commits in common. "5dd78c1166159e743d6232dfce826556f5a8f034" and "618be7bf0cb00d7d5dc8e7ec47807f8b95b8a58c" have entirely different histories.

2 changed files with 63 additions and 117 deletions

View File

@ -5,134 +5,85 @@ const robotData = useRobotDataStore()
// 获取机器人token
export const getRobotTokenFn = async () => {
// if (!robotData.tokenInfo.deviceToken) {
// const loginParams = {
// address: '112.31.70.193',
// port: '9988',
// user: 'bns3',
// password: 'Bns@admin**',
// epid: 'system',
// bfix: 1,
// }
// const res = await initLoginApi(loginParams)
// robotData.setTokenInfo({
// deviceToken: res.data.token,
// })
// return res.data.token
// } else {
// return robotData.tokenInfo.deviceToken
// }
const loginParams = {
address: '112.31.70.193',
port: '9988',
user: 'bns3',
password: 'Bns@admin**',
epid: 'system',
bfix: 1,
if (!robotData.tokenInfo.deviceToken) {
const loginParams = {
address: '112.31.70.193',
port: '9988',
user: 'bns3',
password: 'Bns@admin**',
epid: 'system',
bfix: 1,
}
const res = await initLoginApi(loginParams)
robotData.setTokenInfo({
deviceToken: res.data.token,
})
return res.data.token
} else {
return robotData.tokenInfo.deviceToken
}
const res = await initLoginApi(loginParams)
return res.data.token
}
// 获取设备信息
export const getRobotDeviceListFn = async () => {
// if (!robotData.robotInfo.puId) {
// const { data: res } = await getDeviceInfoApi()
// if (res?.data?.length > 0) {
// const deviceInfo = res.data[0]
// robotData.setRobotInfo({
// devName: deviceInfo.devName,
// puId: deviceInfo.puId,
// })
if (!robotData.robotInfo.puId) {
const { data: res } = await getDeviceInfoApi()
if (res?.data?.length > 0) {
const deviceInfo = res.data[0]
robotData.setRobotInfo({
devName: deviceInfo.devName,
puId: deviceInfo.puId,
})
// return {
// devName: deviceInfo.devName,
// puId: deviceInfo.puId,
// }
// }
// } else {
// return robotData.robotInfo
// }
const { data: res } = await getDeviceInfoApi()
if (res?.data?.length > 0) {
const deviceInfo = res.data[0]
return {
devName: deviceInfo.devName,
puId: deviceInfo.puId,
return {
devName: deviceInfo.devName,
puId: deviceInfo.puId,
}
}
} else {
return robotData.robotInfo
}
}
// 获取地图信息
export const getRobotMapInfoFn = async (puId) => {
// if (!robotData.mapInfo.mapBase64) {
// const { data: res } = await handleRobotActionApi({
// puId,
// type: 4,
// })
// if (res.code === 200) {
// const { Data, Height, Width, MapId, Name } = res.data
// const mapInfo = {
// mapBase64: 'data:image/png;base64,' + Data,
// mapWidth: Width,
// mapHeight: Height,
// mapName: Name,
// mapId: MapId,
// }
// robotData.setMapInfo(mapInfo)
// return mapInfo
// }
// } else {
// return robotData.mapInfo
// }
const { data: res } = await handleRobotActionApi({
puId,
type: 4,
})
if (res.code === 200) {
const { Data, Height, Width, MapId, Name } = res.data
const mapInfo = {
mapBase64: 'data:image/png;base64,' + Data,
mapWidth: Width,
mapHeight: Height,
mapName: Name,
mapId: MapId,
if (!robotData.mapInfo.mapBase64) {
const { data: res } = await handleRobotActionApi({
puId,
type: 4,
})
if (res.code === 200) {
const { Data, Height, Width, MapId, Name } = res.data
const mapInfo = {
mapBase64: 'data:image/png;base64,' + Data,
mapWidth: Width,
mapHeight: Height,
mapName: Name,
mapId: MapId,
}
robotData.setMapInfo(mapInfo)
return mapInfo
}
return mapInfo
} else {
return robotData.mapInfo
}
}
// 获取机器人实时定位信息
export const getRobotPointsInfoFn = async (puId) => {
// if (!robotData.robotPoints.Robot_x && !robotData.robotPoints.Robot_y) {
// const { data: res } = await handleRobotActionApi({
// puId,
// type: 2,
// })
// if (res.code === 200) {
// const pointsInfo = {
// Robot_x: res?.data?.Robot_x,
// Robot_y: res?.data?.Robot_y,
// }
// robotData.setRobotPoints(pointsInfo)
// return pointsInfo
// }
// } else {
// return robotData.robotPoints
// }
const { data: res } = await handleRobotActionApi({
puId,
type: 2,
})
if (res.code === 200) {
const pointsInfo = {
Robot_x: res?.data?.Robot_x,
Robot_y: res?.data?.Robot_y,
if (!robotData.robotPoints.Robot_x && !robotData.robotPoints.Robot_y) {
const { data: res } = await handleRobotActionApi({
puId,
type: 2,
})
if (res.code === 200) {
const pointsInfo = {
Robot_x: res?.data?.Robot_x,
Robot_y: res?.data?.Robot_y,
}
robotData.setRobotPoints(pointsInfo)
return pointsInfo
}
return pointsInfo
} else {
return robotData.robotPoints
}
}

View File

@ -563,11 +563,6 @@ const handleModifyPoint = () => {
id: point.id,
isAdd: point.isAdd,
}
if (point.markerAngle === null) {
message.warning('请先选择角度')
return
}
emits('onHandleAddMarker', markerInfo)
}
closeContextMenu()
@ -602,7 +597,7 @@ const addDevicePoint = (x, y, y1) => {
markerY: y, //
markerY1: y1, //
markerName: '',
markerAngle: null, //
markerAngle: '', //
markerPreset: '', //
isAdd: true,
})