This commit is contained in:
2025-07-28 14:36:38 +08:00
parent 1b9c2ba8e4
commit dbda3d702d
3 changed files with 9 additions and 10 deletions

View File

@@ -107,12 +107,11 @@ export default {
computed: {
...mapGetters(['agvObj']),
carData () {
try {
return JSON.parse(this.agvObj)
} catch (error) {
console.error('解析 JSON 时出错:', error)
return {}
let res = ''
if (this.agvObj !== '') {
res = JSON.parse(this.agvObj)
}
return res
}
},
mixins: [canvasZoomDrag],
@@ -124,7 +123,7 @@ export default {
this.carPositionWatcher = this.$watch(
() => this.carData,
(newVal) => {
if (newVal && newVal.x !== undefined && newVal.y !== undefined) {
if (newVal !== '') {
this.redrawCanvas()
}
},

View File

@@ -70,8 +70,8 @@ export default {
// state: '未知状态', // 车辆状态
// stateId: 7, // 车辆状态ID
// theta: 0.9073792099952698, // 车辆航向角
// x: -4.030919075012207, // 车辆x坐标
// y: -1.6574244499206543 // 车辆y坐标
// x: 0.004027, // 车辆x坐标
// y: -0.001812 // 车辆y坐标
// },
loginVisible: false,
configVisible: false
@@ -141,7 +141,7 @@ export default {
wsMessage (res) {
clearTimeout(this.timer)
this.topInfo = res.data
this.$store.dispatch('setAgvObj', this.topInfo)
this.$store.dispatch('setAgvObj', JSON.stringify(this.topInfo))
},
wsErr () {
this.timer = setTimeout(() => {

View File

@@ -1,7 +1,7 @@
import * as types from '../types'
import { getStore, setStore } from '@config/utils.js'
const baseUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.10.50:8011' : 'http://localhost:8011'
const baseUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.10.62:8011' : 'http://localhost:8011'
const setTime = '5000'
const username = 'user'
const password = '123456'