From 0116509dab4e9194d72c81e250685a7407c3d1e6 Mon Sep 17 00:00:00 2001
From: mmc <1556375442@qq.com>
Date: Tue, 4 Aug 2026 16:11:27 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AF=A6=E6=83=85=E8=B7=B3?=
=?UTF-8?q?=E8=BD=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../WorkOrderSettingsManagement.tsx | 4 ++--
src/components/devices/DeviceOverviewPage.tsx | 10 +++++++++-
src/components/devices/DeviceStatusPage.tsx | 19 ++++++++++++++++++-
src/components/devices/RobotTaskPage.tsx | 4 ++--
src/pages/WorkOrder.tsx | 7 +++----
5 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/src/components/SystemSetting/WorkOrderSettingsManagement.tsx b/src/components/SystemSetting/WorkOrderSettingsManagement.tsx
index 0420749..db4cf3c 100644
--- a/src/components/SystemSetting/WorkOrderSettingsManagement.tsx
+++ b/src/components/SystemSetting/WorkOrderSettingsManagement.tsx
@@ -423,9 +423,9 @@ const WorkOrderModelManagement: React.FC = () => {
)}
-
+ {/*
-
+ */}
diff --git a/src/components/devices/DeviceOverviewPage.tsx b/src/components/devices/DeviceOverviewPage.tsx
index cbd41e7..08de4f5 100644
--- a/src/components/devices/DeviceOverviewPage.tsx
+++ b/src/components/devices/DeviceOverviewPage.tsx
@@ -15,6 +15,9 @@ import {
EditOutlined, FullscreenOutlined, InfoCircleOutlined,
CarOutlined
} from '@ant-design/icons';
+import { useNavigate } from 'react-router-dom';
+
+// 组件内
@@ -75,6 +78,8 @@ export default function DeviceOverviewPage() {
const [currentEditRobot, setCurrentEditRobot] = useState(null);
const [editAliasInput, setEditAliasInput] = useState('');
const [editLoading, setEditLoading] = useState(false);
+ const navigate = useNavigate();
+
// 获取数据
const fetchAllData = async () => {
@@ -116,7 +121,10 @@ export default function DeviceOverviewPage() {
console.error('数据请求失败', err);
}
};
- const onViewStatus = (sn) => { }
+ const onViewStatus = (sn) => {
+ navigate(`/devices/status?sn=${sn}`);
+
+ }
// 打开编辑弹窗
diff --git a/src/components/devices/DeviceStatusPage.tsx b/src/components/devices/DeviceStatusPage.tsx
index 5c78c72..45dcac3 100644
--- a/src/components/devices/DeviceStatusPage.tsx
+++ b/src/components/devices/DeviceStatusPage.tsx
@@ -44,6 +44,7 @@ import {
getSiteUAVList,
addRoute,
} from '../../api/device.ts';
+import { useLocation } from 'react-router-dom';
import XboxController from './XboxController';
import DroneVideoPlayer from './DroneVideoPlayer';
@@ -110,6 +111,10 @@ export default function DeviceStatusPage() {
const [isSaving, setIsSaving] = useState(false); // 是否正在保存
const mapRef = useRef(null); // 地图 ref
+ const location = useLocation();
+ const queryParams = new URLSearchParams(location.search);
+ const urlSn = queryParams.get('sn'); // 拿到路由上的sn
+
// 开关切换回调
const handleChange = (checked: boolean) => {
@@ -180,10 +185,22 @@ export default function DeviceStatusPage() {
// 当设备列表加载后,如果没有选中的设备,默认选中第一个
useEffect(() => {
if (devicesAll?.length > 0) {
+ // 优先从url参数匹配设备
+ if (urlSn) {
+ const target = devicesAll.find(d =>
+ (d.device_sn || d.serialNumber) === urlSn
+ );
+ if (target) {
+ setSelectedSn(urlSn);
+ return;
+ }
+ }
+ // url无sn / 没匹配到对应设备:默认选中第一个
const firstDevice = devicesAll[0];
setSelectedSn(firstDevice.device_sn || firstDevice.serialNumber);
}
- }, [devicesAll]);
+ }, [devicesAll, urlSn]);
+
// 获取当前选中的无人机设备
const device = useMemo(() => {
diff --git a/src/components/devices/RobotTaskPage.tsx b/src/components/devices/RobotTaskPage.tsx
index 04bb19e..fe0f050 100644
--- a/src/components/devices/RobotTaskPage.tsx
+++ b/src/components/devices/RobotTaskPage.tsx
@@ -1862,8 +1862,8 @@ const NewTaskModal = ({ isOpen, onClose, robots, selectedPathWork, handlGetTaskL
if (!formData.device?.serialNumber) missingFields.push('设备编号');
if (!formData.planName) missingFields.push('任务名称');
if (!formData.path?.id) missingFields.push('路线');
- if (!formData.excuteDayStartTime) missingFields.push('执行开始时间');
- if (!formData.excuteDayEndTime) missingFields.push('执行结束时间');
+ //if (!formData.excuteDayStartTime) missingFields.push('执行开始时间');
+ //if (!formData.excuteDayEndTime) missingFields.push('执行结束时间');
if (missingFields.length > 0) {
utils.message.error({ title: '提示', content: `请填写:${missingFields.join('、')}` });
diff --git a/src/pages/WorkOrder.tsx b/src/pages/WorkOrder.tsx
index 8356d39..dcfa51b 100644
--- a/src/pages/WorkOrder.tsx
+++ b/src/pages/WorkOrder.tsx
@@ -735,7 +735,7 @@ const WorkOrderPage = () => {
const params = {
ids: values.orderIds,
deviceId: values.deviceId,
- startTime: startTimeStr
+ //startTime: startTimeStr
};
const res = await startWorkOrder(params);
if (res.code == 200) {
@@ -1694,7 +1694,6 @@ const WorkOrderPage = () => {
{/*
-
@@ -1764,7 +1763,7 @@ const WorkOrderPage = () => {
placeholder="请选择执行开始时间"
style={{ width: '100%' }}
/>
-
+ */}