diff --git a/src/components/devices/DeviceOverviewPage.tsx b/src/components/devices/DeviceOverviewPage.tsx index 3ed1a2b..efb9eb8 100644 --- a/src/components/devices/DeviceOverviewPage.tsx +++ b/src/components/devices/DeviceOverviewPage.tsx @@ -340,7 +340,7 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll, )} - AI分析与操作建议} bordered={false} style={{ borderRadius: 12, marginBottom: 16 }}> + AI分析与操作建议} bordered={false} style={{ borderRadius: 12, marginBottom: 8 }}>
🔥
热斑疑似
2 处
杂草高发区
3 块
@@ -371,7 +371,7 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll,
{(selectedDevice?.productName?.includes('无人机') || selectedDevice?.device_sn) && ( - +
风速
{fix2(selectedDevice?.wind_speed)} m/s
@@ -391,7 +391,7 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll, )} {(!selectedDevice?.productName?.includes('无人机') && !selectedDevice?.device_sn) && ( - 机器人作业状态
} bordered={false} style={{ borderRadius: 12, marginBottom: 16, boxShadow: '0 2px 8px rgba(0,0,0,0.06)', border: '1px solid #f0f0f0' }}> + 机器人作业状态
} bordered={false} style={{ borderRadius: 12, marginBottom: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)', border: '1px solid #f0f0f0' }}>
diff --git a/src/components/devices/WayLinePage.tsx b/src/components/devices/WayLinePage.tsx index 8e08504..4010218 100644 --- a/src/components/devices/WayLinePage.tsx +++ b/src/components/devices/WayLinePage.tsx @@ -17,7 +17,7 @@ import { LayoutGrid, Clock, CheckCircle2, AlertCircle, Zap, Waves, Calendar, User, TrendingUp, Maximize2, Play, Square, X, MapPin, RotateCw } from 'lucide-react'; -import { getsinglePlan, getsinglePlanTrack, updateFlightTaskStatus, postFlightCommmand, getWayLine, createWaylineTask } from '@/api/device'; +import { getsinglePlan, getsinglePlanTrack, updateFlightTaskStatus, postFlightCommmand, getWayLine, createWaylineTask, getFlightTaskDetail } from '@/api/device'; import dayjs from 'dayjs'; import utils from '@/lib/utils'; import CesiumMap from '../Map'; @@ -57,6 +57,7 @@ export default function WayLinePage({ planedevices }) { // ✅ 创建任务弹窗相关状态(已完整整合) // ============================================== const [createTaskModal, setCreateTaskModal] = useState(false); + const [taskDetail, setTaskDetail] = useState(null); const [waylineUuid, setWaylineUuid] = useState(''); const [waylineList, setWaylineList] = useState([]); // 航线列表 const [taskForm, setTaskForm] = useState({ @@ -357,6 +358,8 @@ export default function WayLinePage({ planedevices }) { const handleRowClick = async (record) => { setSelectedTask(record); // 记录当前选中的任务 try { + getTaskDetail(record.uuid); // 获取任务详情 + const res = await getsinglePlanTrack(record); if (res.code === 0 && res.data.track?.points?.length) { const points = res.data.track.points.map(item => ({ @@ -440,6 +443,28 @@ export default function WayLinePage({ planedevices }) { setFlightCommandLoading(false); } }; + const getTaskDetail = async (taskId) => { + console.log('获取任务详情,taskId=', taskId); + if (!taskId) return; + setTaskDetail(null); + setLoading(true); + try { + const res = await getFlightTaskDetail(taskId); + if (res.code === 0) { + setTaskDetail(res.data); + + } else { + setTaskDetail(null); + utils.message.error('暂无详情'); + } + } catch (err) { + setTaskDetail(null); + + utils.message.error('获取详情接口异常'); + } finally { + setLoading(false); + } + }; // 任务状态更新逻辑 const updateTaskStatus = async (taskId: string, status: string) => { @@ -585,7 +610,7 @@ export default function WayLinePage({ planedevices }) { } bordered={false} bodyStyle={{ padding: 0, display: 'flex', flexDirection: 'column', height: "calc(100% - 40px)", overflow: "auto" }} - style={{ ...cardStyle, height: "250px", flex: 1, marginBottom: 0 }} + style={{ ...cardStyle, height: "240px", flex: 1, marginBottom: 0 }} > - + 任务编排与 AI 建议} bordered={false} @@ -657,14 +682,16 @@ export default function WayLinePage({ planedevices }) { >
{[ - { label: '飞行高度', value: '35', unit: 'm' }, + { label: '飞行高度', value: taskDetail.rth_altitude, unit: 'm' }, { label: '速度', value: '6', unit: 'm/s' }, { label: '航向重叠', value: '75', unit: '%' }, { label: '旁向重叠', value: '65', unit: '%' }, - { label: '安全返航电量', value: '25', unit: '%' }, + { + label: '安全返航电量', value: taskDetail.min_battery_capacity, unit: '%' + }, { label: '清洗喷洒量', value: '120', unit: 'ml/㎡' }, { label: '除草宽幅', value: '1.2', unit: 'm' }, - { label: '巡检采样频率', value: '2', unit: 'Hz' }, + { label: '任务类型', value: taskDetail.task_type, unit: '' }, ].map((item, idx) => (
天气窗口与执行约束} bordered={false} bodyStyle={{ padding: '16px' }} - style={cardStyle} + style={{ ...cardStyle, flex: 1 }} > - -
-
-
适宜执行
- -
适宜航行
+ {/* 顶部参数卡片区域,改成和截图一致的横向布局 */} +
+ {/* 适宜性 */} +
+
+
- -
- - {[ - { - label: '风速', - value: `${listDrone?.wind_speed ?? '-'} m/s`, - icon: , - color: '#165DFF', - judge: (val) => { - const speed = parseFloat(val); - if (isNaN(speed)) return { desc: '未知', color: '#86909C' }; - if (speed <= 5) return { desc: '适宜', color: '#52C41A' }; - if (speed <= 8) return { desc: '谨慎', color: '#FF7D00' }; - return { desc: '不适宜', color: '#F53F3F' }; - } - }, - { - label: '温度', - value: `${listDrone?.environment_temperature ?? '-'}℃`, - icon: , - color: '#FF7D00', - judge: (val) => { - const temp = parseFloat(val); - if (isNaN(temp)) return { desc: '未知', color: '#86909C' }; - if (temp >= 0 && temp <= 40) return { desc: '适宜', color: '#52C41A' }; - return { desc: '不适宜', color: '#F53F3F' }; - } - }, - { - label: '降雨', - value: `${listDrone?.rainfall ?? '-'} `, - icon: , - color: '#FF7D00', - judge: (val) => { - if (val?.trim() === "no_rain") { - return { desc: '适宜', color: '#52C41A' }; - } else { - return { desc: '不适宜', color: '#F53F3F' }; - } - } - }, - { - label: '信号质量', - value: (() => { - const q = listDrone?.network_state?.quality; - if (q === 'good') return '优'; - if (q === 'better') return '良'; - if (q === 'moderate') return '中'; - if (q === 'poor') return '差'; - if (q === 'too_pool') return '极差'; - return '正常'; - })(), - icon: , - color: '#00B42A', - judge: (val) => { - if (val === '优' || val === '良' || val === '正常') return { desc: '适宜', color: '#52C41A' }; - if (val === '中') return { desc: '谨慎', color: '#FF7D00' }; - return { desc: '不适宜', color: '#F53F3F' }; - } - }, - ].map((item, idx) => { - const status = item.judge(item.value); - return ( - -
-
- {item.icon} -
-
-
{item.label}
-
- {item.value} -
-
- {status.desc} -
-
-
- - ); - })} - - - -
- 16:30 后风速升高,建议提前完成任务 - 预计 14:00-16:00 为最佳执行窗口 +
+
适宜性
+
适宜执行
+
+
+ + {/* 风速 */} +
+
+ +
+
+
风速
+
{listDrone?.wind_speed ?? '-'} m/s
+
适宜
+
+
+ + {/* 温度 */} +
+
+ +
+
+
温度
+
{listDrone?.environment_temperature ?? '-'}℃
+
适宜
+
+
+ + {/* 降水概率 */} +
+
+ +
+
+
降水概率
+
10%
+
低
+
+
+ + {/* GNSS质量 */} +
+
+ +
+
+
GNSS质量
+
良好
+
适宜
+
+
+ + + {/* 底部提示区域 */} +
+
+ + 16:30 后风速升高,建议提前完成任务 +
+
+ + 预计 14:00-16:00 为最佳执行窗口 +