优化详情跳转
This commit is contained in:
@@ -423,9 +423,9 @@ const WorkOrderModelManagement: React.FC = () => {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Form.Item label="自动生成任务" name="autoGenerateTask" valuePropName="checked">
|
{/*<Form.Item label="自动生成任务" name="autoGenerateTask" valuePropName="checked">
|
||||||
<Switch />
|
<Switch />
|
||||||
</Form.Item>
|
</Form.Item>*/}
|
||||||
|
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
<Space>
|
<Space>
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ import {
|
|||||||
EditOutlined, FullscreenOutlined, InfoCircleOutlined,
|
EditOutlined, FullscreenOutlined, InfoCircleOutlined,
|
||||||
CarOutlined
|
CarOutlined
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
// 组件内
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -75,6 +78,8 @@ export default function DeviceOverviewPage() {
|
|||||||
const [currentEditRobot, setCurrentEditRobot] = useState(null);
|
const [currentEditRobot, setCurrentEditRobot] = useState(null);
|
||||||
const [editAliasInput, setEditAliasInput] = useState('');
|
const [editAliasInput, setEditAliasInput] = useState('');
|
||||||
const [editLoading, setEditLoading] = useState(false);
|
const [editLoading, setEditLoading] = useState(false);
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
|
||||||
// 获取数据
|
// 获取数据
|
||||||
const fetchAllData = async () => {
|
const fetchAllData = async () => {
|
||||||
@@ -116,7 +121,10 @@ export default function DeviceOverviewPage() {
|
|||||||
console.error('数据请求失败', err);
|
console.error('数据请求失败', err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const onViewStatus = (sn) => { }
|
const onViewStatus = (sn) => {
|
||||||
|
navigate(`/devices/status?sn=${sn}`);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 打开编辑弹窗
|
// 打开编辑弹窗
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import {
|
|||||||
getSiteUAVList,
|
getSiteUAVList,
|
||||||
addRoute,
|
addRoute,
|
||||||
} from '../../api/device.ts';
|
} from '../../api/device.ts';
|
||||||
|
import { useLocation } from 'react-router-dom';
|
||||||
|
|
||||||
import XboxController from './XboxController';
|
import XboxController from './XboxController';
|
||||||
import DroneVideoPlayer from './DroneVideoPlayer';
|
import DroneVideoPlayer from './DroneVideoPlayer';
|
||||||
@@ -110,6 +111,10 @@ export default function DeviceStatusPage() {
|
|||||||
const [isSaving, setIsSaving] = useState(false); // 是否正在保存
|
const [isSaving, setIsSaving] = useState(false); // 是否正在保存
|
||||||
const mapRef = useRef(null); // 地图 ref
|
const mapRef = useRef(null); // 地图 ref
|
||||||
|
|
||||||
|
const location = useLocation();
|
||||||
|
const queryParams = new URLSearchParams(location.search);
|
||||||
|
const urlSn = queryParams.get('sn'); // 拿到路由上的sn
|
||||||
|
|
||||||
|
|
||||||
// 开关切换回调
|
// 开关切换回调
|
||||||
const handleChange = (checked: boolean) => {
|
const handleChange = (checked: boolean) => {
|
||||||
@@ -180,10 +185,22 @@ export default function DeviceStatusPage() {
|
|||||||
// 当设备列表加载后,如果没有选中的设备,默认选中第一个
|
// 当设备列表加载后,如果没有选中的设备,默认选中第一个
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (devicesAll?.length > 0) {
|
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];
|
const firstDevice = devicesAll[0];
|
||||||
setSelectedSn(firstDevice.device_sn || firstDevice.serialNumber);
|
setSelectedSn(firstDevice.device_sn || firstDevice.serialNumber);
|
||||||
}
|
}
|
||||||
}, [devicesAll]);
|
}, [devicesAll, urlSn]);
|
||||||
|
|
||||||
|
|
||||||
// 获取当前选中的无人机设备
|
// 获取当前选中的无人机设备
|
||||||
const device = useMemo(() => {
|
const device = useMemo(() => {
|
||||||
|
|||||||
@@ -1862,8 +1862,8 @@ const NewTaskModal = ({ isOpen, onClose, robots, selectedPathWork, handlGetTaskL
|
|||||||
if (!formData.device?.serialNumber) missingFields.push('设备编号');
|
if (!formData.device?.serialNumber) missingFields.push('设备编号');
|
||||||
if (!formData.planName) missingFields.push('任务名称');
|
if (!formData.planName) missingFields.push('任务名称');
|
||||||
if (!formData.path?.id) missingFields.push('路线');
|
if (!formData.path?.id) missingFields.push('路线');
|
||||||
if (!formData.excuteDayStartTime) missingFields.push('执行开始时间');
|
//if (!formData.excuteDayStartTime) missingFields.push('执行开始时间');
|
||||||
if (!formData.excuteDayEndTime) missingFields.push('执行结束时间');
|
//if (!formData.excuteDayEndTime) missingFields.push('执行结束时间');
|
||||||
|
|
||||||
if (missingFields.length > 0) {
|
if (missingFields.length > 0) {
|
||||||
utils.message.error({ title: '提示', content: `请填写:${missingFields.join('、')}` });
|
utils.message.error({ title: '提示', content: `请填写:${missingFields.join('、')}` });
|
||||||
|
|||||||
@@ -735,7 +735,7 @@ const WorkOrderPage = () => {
|
|||||||
const params = {
|
const params = {
|
||||||
ids: values.orderIds,
|
ids: values.orderIds,
|
||||||
deviceId: values.deviceId,
|
deviceId: values.deviceId,
|
||||||
startTime: startTimeStr
|
//startTime: startTimeStr
|
||||||
};
|
};
|
||||||
const res = await startWorkOrder(params);
|
const res = await startWorkOrder(params);
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
@@ -1694,7 +1694,6 @@ const WorkOrderPage = () => {
|
|||||||
<FormItem
|
<FormItem
|
||||||
name="deviceId"
|
name="deviceId"
|
||||||
label="选择执行设备"
|
label="选择执行设备"
|
||||||
rules={[{ required: true, message: '请选择执行设备' }]}
|
|
||||||
>
|
>
|
||||||
{/*<Select
|
{/*<Select
|
||||||
style={{ width: "80%", marginBottom: 8 }}
|
style={{ width: "80%", marginBottom: 8 }}
|
||||||
@@ -1754,7 +1753,7 @@ const WorkOrderPage = () => {
|
|||||||
</Select>
|
</Select>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem
|
{/*<FormItem
|
||||||
name="startTime"
|
name="startTime"
|
||||||
label="执行开始时间"
|
label="执行开始时间"
|
||||||
>
|
>
|
||||||
@@ -1764,7 +1763,7 @@ const WorkOrderPage = () => {
|
|||||||
placeholder="请选择执行开始时间"
|
placeholder="请选择执行开始时间"
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>*/}
|
||||||
<FormItem style={{ textAlign: 'right', marginBottom: 0 }}>
|
<FormItem style={{ textAlign: 'right', marginBottom: 0 }}>
|
||||||
<Button onClick={() => setDispatchModalVisible(false)}>取消</Button>
|
<Button onClick={() => setDispatchModalVisible(false)}>取消</Button>
|
||||||
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>确认执行</Button>
|
<Button type="primary" htmlType="submit" style={{ marginLeft: 8 }}>确认执行</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user