This commit is contained in:
mmc
2026-06-15 17:19:04 +08:00
parent b8a6a053cb
commit 6e312871b8
3 changed files with 12 additions and 7 deletions

View File

@@ -29,7 +29,7 @@ const DraggableBox: React.FC<Props> = ({
ref={nodeRef}
className={clsx(
'fixed select-none z-[9999] bg-white shadow-xl rounded-lg overflow-hidden',
'border-[8px] border-slate-200 top-[8px] left-[8px] w-[700px] h-[580px] ' // 整体8px外边框
'border-[8px] border-slate-200 top-[8px] right-[8px] w-[700px] h-[580px] ' // 整体8px外边框
)}
>
{/* 拖拽标题栏 + 关闭按钮 */}

View File

@@ -168,23 +168,19 @@ export default function RobotTaskPage() {
// 监听任务列表和设备列表变化,自动连接正在执行中的机器人
useEffect(() => {
if (!taskPoolList || !devices) return;
console.log('🔄 检测到任务列表或设备列表变化,开始检查正在执行中的任务', taskPoolList, devices);
// 查找正在执行中的任务
const runningTask = taskPoolList.find(item => ['EXECUTING', 'PAUSE'].includes(item.taskStaus));
console.log('🔄 检测到任务列表或设备列表变化,开始检查正在执行中的任务runningTask', runningTask);
if (!runningTask) return;
// 找到对应的设备
const targetDevice = devices.find(d => d.serialNumber === runningTask.deviceId || d.serialNumber === runningTask.deviceId);
console.log('🔄 检测到任务列表或设备列表变化,开始检查正在执行中的任务targetDevice', targetDevice);
if (!targetDevice) return;
// 判断是否是新设备(避免重复连接)
const isSameDevice = executingRobot?.serialNumber === targetDevice.serialNumber;
console.log('🔄 检测到任务列表或设备列表变化,开始检查正在执行中的任务isSameDevice', isSameDevice);
if (isSameDevice) return;
@@ -422,7 +418,7 @@ export default function RobotTaskPage() {
fetchTaskList();
fetchTaskPoolList();
fetchTaskHistoryList();
//controllerRef.current?.connectDevice(selectedRobotForExecute);
controllerRef.current?.connectDevice(selectedRobotForExecute);
setShowVideo(true); // 连接成功后自动打开视频
} else {
@@ -1592,7 +1588,7 @@ export default function RobotTaskPage() {
</div>
</Modal>
{showVideo && executingRobot && (
{showVideo && executingRobot && execute && (
<DraggableBox
defaultPosition={{ x: 50, y: 50 }}
title={`机器人全景视频 - ${executingRobot.deviceAlias || executingRobot.serialNumber}`}