优化机器人任务 界面 匹配和实时经纬度

This commit is contained in:
mmc
2026-09-21 15:13:28 +08:00
parent 0e95bb0c96
commit 1e516414d7
4 changed files with 93 additions and 53 deletions

View File

@@ -279,12 +279,15 @@ export default class DeviceController {
this.isControlled = false;
this.onControlStatusChange?.(false);
// 切换任务/设备:先清掉上一个设备的实时坐标,避免轨迹残留到新设备
this.onLocationInfoUpdate?.(null);
wsManager.close();
try {
console.log('Connecting to', this.wsUrl);
wsManager.connect(sn, this.wsUrl);
this.connectedDeviceSn = sn;
wsManager.connect(sn, this.wsUrl);
await this.getControl(sn);
} catch (err) {
@@ -313,6 +316,9 @@ export default class DeviceController {
this.isControlled = false;
this.onControlStatusChange?.(false);
// 切换设备:清掉上一个设备的实时坐标,避免轨迹残留
this.onLocationInfoUpdate?.(null);
wsManager.send({
type: 'AUTH',
token: this.userInfo.token,
@@ -392,6 +398,10 @@ export default class DeviceController {
msg.data.forEach((item) => {
data[item.name] = item.value;
});
// 切换任务/切换设备时,忽略上一个设备遗留的实时数据
if (data?.deviceId && data.deviceId !== this.connectedDeviceSn) {
break;
}
this.wsDeviceInfo = data;
this.onDeviceInfoUpdate?.(data);
break;
@@ -401,6 +411,10 @@ export default class DeviceController {
msg.data.forEach((item) => {
data[item.name] = item.value;
});
// 切换任务/切换设备时,忽略上一个设备遗留的实时经纬度,只显示当前连接设备的实时轨迹
if (data?.deviceId && data.deviceId !== this.connectedDeviceSn) {
break;
}
this.locationInfo = data;
this.onLocationInfoUpdate?.(data);
break;