中英文切换

This commit is contained in:
mmc
2026-08-14 09:02:52 +08:00
parent a8af55a856
commit 62b03bba03
94 changed files with 19723 additions and 2766 deletions

View File

@@ -358,14 +358,14 @@ export default function WayLinePage({ onRefresh }) {
const _list = res?.data?.list.map(item => {
return {
...item,
label: item.name || `航线_${item.id || t('constants.locationUnknown')}`,
label: item.name || t('devices.waylineFallback', { id: item.id || t('constants.locationUnknown') }),
value: item.id
}
})
setWaylineList(_list || []);
}
} catch (err) {
message.error('获取航线列表失败');
message.error(t('devices.waylineListFetchFail'));
}
};
@@ -396,7 +396,7 @@ export default function WayLinePage({ onRefresh }) {
// 创建任务提交
const createFlightTask = async () => {
if (!taskForm.name || !waylineUuid || !taskForm.sn) {
utils.message.warning('请完善必填项');
utils.message.warning(t('devices.fillRequiredFields'));
return;
}
setLoading(true);
@@ -411,15 +411,15 @@ export default function WayLinePage({ onRefresh }) {
const res: any = await createWaylineTask(payload);
if (res.code === 200 || res.code === 0) {
utils.message.success('创建任务成功');
utils.message.success(t('devices.createTaskSuccess'));
resetModals();
getListTask();
if (onRefresh) onRefresh();
} else {
utils.message.error(res.msg || '创建失败');
utils.message.error(res.msg || t('devices.createTaskFail'));
}
} catch (err) {
utils.message.error('创建异常');
utils.message.error(t('devices.createTaskException'));
} finally {
setLoading(false);
}
@@ -465,13 +465,13 @@ export default function WayLinePage({ onRefresh }) {
let color = '#00B42A';
if (diff > 0) {
trendText = `较昨日 +${diff}`;
trendText = t('devices.trendYesterday', { diff: `+${diff}` });
color = '#00B42A';
} else if (diff < 0) {
trendText = `较昨日 ${diff}`;
trendText = t('devices.trendYesterday', { diff });
color = '#F53F3F';
} else {
trendText = '较昨日 持平';
trendText = t('devices.trendFlat');
color = '#86909C';
}
@@ -509,7 +509,7 @@ export default function WayLinePage({ onRefresh }) {
setTaskList(combinedList);
}
} catch (err) {
message.error('任务列表数据获取失败');
message.error(t('devices.taskListFetchFail'));
}
};
@@ -537,7 +537,7 @@ export default function WayLinePage({ onRefresh }) {
setBoardTaskList(combinedList);
}
} catch (err) {
message.error('任务看板数据获取失败');
message.error(t('devices.boardTaskFetchFail'));
}
};
@@ -576,17 +576,17 @@ export default function WayLinePage({ onRefresh }) {
// 任务状态标签
const getStatusTag = (status) => {
const statusMap = {
success: { color: 'success', text: '执行成功' },
preparing: { color: 'blue', text: '准备中' },
success: { color: 'success', text: t('devices.statusExecSuccess') },
preparing: { color: 'blue', text: t('devices.statusPreparing') },
running: { color: 'processing', text: t('workOrder.inProgress') },
failed: { color: 'error', text: '执行失败' },
waiting: { color: 'default', text: '待开始' },
starting_failure: { color: 'error', text: '启动失败' },
failed: { color: 'error', text: t('devices.statusExecFailed') },
waiting: { color: 'default', text: t('devices.statusWaitingStart') },
starting_failure: { color: 'error', text: t('devices.statusStartFailed') },
executing: { color: 'processing', text: t('workOrder.inProgress') },
suspended: { color: 'warning', text: t('workOrder.suspended') },
restored: { color: 'processing', text: '恢复执行' },
terminated: { color: 'default', text: '已终止' },
timeout: { color: 'error', text: '执行超时' },
restored: { color: 'processing', text: t('devices.statusRestored') },
terminated: { color: 'default', text: t('devices.statusTerminated') },
timeout: { color: 'error', text: t('devices.statusTimeout') },
};
const item = statusMap[status] || { color: 'default', text: status };
return <Tag color={item.color}>{item.text}</Tag>;
@@ -595,7 +595,7 @@ export default function WayLinePage({ onRefresh }) {
// 列表表格列
const taskColumns = [
{ title: t('devices.taskName'), dataIndex: 'name', width: 260, ellipsis: true, fixed: "left" },
{ title: '设备SN', dataIndex: 'sn', width: 140 },
{ title: t('devices.deviceSn'), dataIndex: 'sn', width: 140 },
{ title: t('roles.status'), dataIndex: 'status', width: 80, render: getStatusTag },
{
title: t('devices.startTime'), dataIndex: 'begin_at', width: 170,
@@ -615,7 +615,7 @@ export default function WayLinePage({ onRefresh }) {
}));
setPoints(points);
} else {
utils.message.warning("暂无航线数据");
utils.message.warning(t('devices.noWaylineData'));
setPoints([]);
}
}
@@ -628,7 +628,7 @@ export default function WayLinePage({ onRefresh }) {
await getTrackFn(record);
} catch (err) {
message.error('请求失败');
message.error(t('devices.requestFail'));
}
};
@@ -656,7 +656,7 @@ export default function WayLinePage({ onRefresh }) {
e.stopPropagation();
// ✅ 使用航线列表自己的无人机
if (!waylineDrone?.gateway_sn) {
utils.message.warning('请先在航线列表上方选择执行无人机');
utils.message.warning(t('devices.selectExecuteDroneFirst'));
return;
}
setSelectedWayline(wayline);
@@ -689,7 +689,7 @@ export default function WayLinePage({ onRefresh }) {
const res: any = await createWaylineTask(payload);
if (res.code === 200 || res.code === 0) {
utils.message.success('航线执行任务创建成功');
utils.message.success(t('devices.waylineTaskCreated'));
setRthModalVisible(false);
getListTask();
//if (onRefresh) {
@@ -703,10 +703,10 @@ export default function WayLinePage({ onRefresh }) {
//});
} else {
utils.message.error(res.msg || '执行失败');
utils.message.error(res.msg || t('devices.waylineExecFail'));
}
} catch (err) {
utils.message.error('创建任务异常');
utils.message.error(t('devices.createTaskException'));
} finally {
setLoading(false);
}
@@ -729,20 +729,20 @@ export default function WayLinePage({ onRefresh }) {
const topCards = [
{
title: '今日航线计划', value: todayCount, unit: '条', desc: '进行中', trend: trend, trendColor: trendColor,
title: t('devices.todayWaylinePlan'), value: todayCount, unit: t('devices.unitTiao'), desc: t('devices.inProgressDesc'), trend: trend, trendColor: trendColor,
icon: <LayoutGrid size={22} />, color: '#165DFF'
},
{ title: '执行中任务', value: runList.length, unit: '个', desc: '进行中', icon: <Plane size={22} />, color: '#165DFF' },
{ title: '待审批任务', value: '4', unit: '个', trend: '较昨日 -1', trendColor: '#F53F3F', icon: <Calendar size={22} />, color: '#FF7D00' },
{ title: '任务完成率', value: finishList.length ? Math.round((finishList.length / taskList.length) * 100) : 0, unit: '%', trend: '较昨日 +6%', trendColor: '#00B42A', icon: <CheckCircle2 size={22} />, color: '#00B42A' },
{ title: 'AI 优化收益', value: '+7.8', unit: '%', trend: '较昨日 +1.2%', trendColor: '#00B42A', icon: <TrendingUp size={22} />, color: '#722ED1' },
{ title: '覆盖装备', value: '4 类 / 9 台', unit: '', desc: '全部在线', icon: <Satellite size={22} />, color: '#165DFF' },
{ title: t('devices.executingTasks'), value: runList.length, unit: t('devices.unitGe'), desc: t('devices.inProgressDesc'), icon: <Plane size={22} />, color: '#165DFF' },
{ title: t('devices.pendingApprovalTasks'), value: '4', unit: t('devices.unitGe'), trend: t('devices.trendYesterday', { diff: '-1' }), trendColor: '#F53F3F', icon: <Calendar size={22} />, color: '#FF7D00' },
{ title: t('devices.taskCompletionRate'), value: finishList.length ? Math.round((finishList.length / taskList.length) * 100) : 0, unit: '%', trend: t('devices.trendYesterday', { diff: '+6%' }), trendColor: '#00B42A', icon: <CheckCircle2 size={22} />, color: '#00B42A' },
{ title: t('devices.aiOptimizeGain'), value: '+7.8', unit: '%', trend: t('devices.trendYesterday', { diff: '+1.2%' }), trendColor: '#00B42A', icon: <TrendingUp size={22} />, color: '#722ED1' },
{ title: t('devices.coverageEquipment'), value: t('devices.coverageValue', { types: '4', units: '9' }), unit: '', desc: t('devices.allOnline'), icon: <Satellite size={22} />, color: '#165DFF' },
];
// 指令下发逻辑
const sendFlightCommand = async (command: 'return_home' | 'return_home_cancel' | 'flighttask_pause' | 'flighttask_recovery') => {
if (!listDrone?.device_sn) {
utils.message.warning('未选中无人机或无人机SN不存在');
utils.message.warning(t('devices.noDroneSelected'));
return;
}
@@ -754,16 +754,16 @@ export default function WayLinePage({ onRefresh }) {
try {
const res: any = await postFlightCommmand(data);
if (res.code === 200 || res.code === 0) {
utils.message.success('指令下发成功');
utils.message.success(t('devices.commandSent'));
if (command === 'return_home') setIsReturningHome(true);
if (command === 'return_home_cancel') setIsReturningHome(false);
if (command === 'flighttask_pause') setIsTaskPaused(true);
if (command === 'flighttask_recovery') setIsTaskPaused(false);
} else {
utils.message.error(res.msg || '指令下发失败');
utils.message.error(res.msg || t('devices.commandSendFail'));
}
} catch (err) {
utils.message.error('接口请求异常');
utils.message.error(t('devices.apiRequestException'));
} finally {
setFlightCommandLoading(false);
}
@@ -779,11 +779,11 @@ export default function WayLinePage({ onRefresh }) {
setTaskDetail(res.data);
} else {
setTaskDetail(null);
utils.message.error('暂无详情');
utils.message.error(t('devices.noDetail'));
}
} catch (err) {
setTaskDetail(null);
utils.message.error('获取详情接口异常');
utils.message.error(t('devices.fetchDetailException'));
} finally {
setLoading(false);
}
@@ -792,7 +792,7 @@ export default function WayLinePage({ onRefresh }) {
// 任务状态更新逻辑
const updateTaskStatus = async (taskId: string, status: string) => {
if (!taskId) {
utils.message.warning('请先选择任务');
utils.message.warning(t('devices.selectTaskFirst'));
return;
}
setLoading(true);
@@ -800,11 +800,11 @@ export default function WayLinePage({ onRefresh }) {
const res: any = await updateFlightTaskStatus(taskId, status);
if (res.code === 200 || res.code === 0) {
const statusText = {
executing: '任务执行成功',
suspended: '任务已挂起',
restored: '任务已继续',
return_home: '任务已返航'
}[status] || '状态更新成功';
executing: t('devices.taskExecSuccess'),
suspended: t('devices.taskSuspended2'),
restored: t('devices.taskRestored2'),
return_home: t('devices.taskReturnedHome2')
}[status] || t('devices.statusUpdateSuccess');
if (status === "suspended") {
setTaskStatus('suspended');
@@ -814,10 +814,10 @@ export default function WayLinePage({ onRefresh }) {
utils.message.success(statusText);
getListTask();
} else {
utils.message.error(res.msg || '操作失败');
utils.message.error(res.msg || t('devices.operationFail'));
}
} catch (err) {
utils.message.error('操作接口异常');
utils.message.error(t('devices.operationApiException'));
} finally {
setLoading(false);
}
@@ -856,7 +856,7 @@ export default function WayLinePage({ onRefresh }) {
<Col xs={24} xl={14} style={{ display: "flex", flexDirection: "column" }}>
{/* 地图卡片 */}
<Card
title={<span style={{ fontSize: fontNormal, fontWeight: 700 }}>航线编辑与路径规划</span>}
title={<span style={{ fontSize: fontNormal, fontWeight: 700 }}>{t('devices.waylineEditPlan')}</span>}
size="small"
extra={
<Space size={4}>
@@ -869,7 +869,7 @@ export default function WayLinePage({ onRefresh }) {
setClearNavLine((v) => v + 1);
}}
>
清空实时轨迹
{t('devices.clearRealtimeTrack')}
</Button>
<Button
size="small"
@@ -881,11 +881,11 @@ export default function WayLinePage({ onRefresh }) {
setClearPlanLine((v) => v + 1);
}}
>
清空规划航线
{t('devices.clearPlanRoute')}
</Button>
<Button size="small" icon={<PlusOutlined />} style={{ borderRadius: 4 }}>{t('common.addNew')}</Button>
<Button size="small" icon={<ImportOutlined />} style={{ borderRadius: 4 }}>{t('common.import')}</Button>
<Button size="small" icon={<NodeIndexOutlined />} style={{ borderRadius: 4 }}>优化</Button>
<Button size="small" icon={<NodeIndexOutlined />} style={{ borderRadius: 4 }}>{t('devices.optimize')}</Button>
<Button size="small" icon={<SaveOutlined />} style={{ borderRadius: 4 }}>{t('common.save')}</Button>
<Button size="small" icon={<Maximize2 size={12} />} />
</Space>
@@ -899,13 +899,13 @@ export default function WayLinePage({ onRefresh }) {
points={points} focusLocation={focusLocation} from="device-control" realtimeType='plane' ifClearNavLine={clearNavLine} ifClearPlanLine={clearPlanLine} />
<div style={{ position: 'absolute', top: 16, left: 16, background: 'rgba(255,255,255,0.92)', backdropFilter: 'blur(8px)', padding: '14px 16px', borderRadius: 10, width: 150, boxShadow: '0 4px 12px rgba(0,0,0,0.1)' }}>
<div style={{ fontSize: fontSmall, display: 'flex', flexDirection: 'column', gap: 10 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ width: 14, height: 2, background: '#165DFF' }}></span> 无人机航线</div>
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ width: 14, height: 2, background: '#FF7D00' }}></span> 巡检路线</div>
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ width: 14, height: 2, background: '#00B42A' }}></span> 除草路线</div>
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ width: 14, height: 2, background: '#165DFF' }}></span> {t('devices.droneWayline')}</div>
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ width: 14, height: 2, background: '#FF7D00' }}></span> {t('devices.inspectRoute')}</div>
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ width: 14, height: 2, background: '#00B42A' }}></span> {t('devices.mowRoute')}</div>
<Divider style={{ margin: '6px 0' }} />
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }}><div style={{ width: 18, height: 18, background: '#165DFF', borderRadius: '50%', display: 'flex', justifyContent: 'center', alignItems: 'center', color: '#fff', fontSize: 10 }}>H</div> <span>无人机机场</span></div>
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }}><Zap size={14} color="#00B42A" /> <span>充电点</span></div>
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }}><AlertCircle size={14} color="#F53F3F" /> <span>禁飞区</span></div>
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }}><div style={{ width: 18, height: 18, background: '#165DFF', borderRadius: '50%', display: 'flex', justifyContent: 'center', alignItems: 'center', color: '#fff', fontSize: 10 }}>H</div> <span>{t('devices.droneAirport')}</span></div>
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }}><Zap size={14} color="#00B42A" /> <span>{t('devices.chargePoint')}</span></div>
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }}><AlertCircle size={14} color="#F53F3F" /> <span>{t('devices.noFlyZone')}</span></div>
</div>
</div>
</div>
@@ -915,7 +915,7 @@ export default function WayLinePage({ onRefresh }) {
<Card
title={
<div className="flex justify-between w-full items-center">
<span style={{ fontSize: 14, fontWeight: 700 }}>设备任务列表</span>
<span style={{ fontSize: 14, fontWeight: 700 }}>{t('devices.deviceTaskList')}</span>
<Space size={12}>
<RangePicker
size="small"
@@ -928,7 +928,7 @@ export default function WayLinePage({ onRefresh }) {
<Select
style={{ width: 180 }}
size="small"
placeholder="全部无人机"
placeholder={t('devices.allDrones')}
showSearch
allowClear
options={planedevices?.map(item => ({
@@ -947,7 +947,7 @@ export default function WayLinePage({ onRefresh }) {
}
size="small"
extra={
<Tooltip title="创建任务">
<Tooltip title={t('devices.createTask')}>
<PlusOutlined
style={{ cursor: 'pointer', color: '#165DFF', fontSize: 12, marginLeft: 10 }}
onClick={() => {
@@ -981,7 +981,7 @@ export default function WayLinePage({ onRefresh }) {
<Col xs={24} xl={10} style={{ display: "flex", flexDirection: "column" }} >
<Card
title={<span style={{ fontSize: fontTitle, fontWeight: 700 }}>任务编排与 AI 建议</span>}
title={<span style={{ fontSize: fontTitle, fontWeight: 700 }}>{t('devices.taskOrchestrationAI')}</span>}
bordered={false}
bodyStyle={{ padding: '12px 16px' }}
style={{ ...cardStyle, marginBottom: 8 }}
@@ -990,70 +990,70 @@ export default function WayLinePage({ onRefresh }) {
size="small"
pagination={false}
dataSource={[
{ key: '1', id: 'FL-03', device: 'UAV-A01', type: '无人机热斑巡检', level: '高', time: '10:00 - 11:20', duration: '1h20m', status: '建议执行' },
{ key: '2', id: 'RB-02', device: 'RBT-01', type: '围栏巡检', level: '高', time: '11:30 - 12:30', duration: '1h00m', status: '建议执行' },
{ key: '3', id: 'CL-05', device: 'UAV-C01', type: '组件清洗', level: '中', time: '14:00 - 16:00', duration: '2h00m', status: '等待执行' },
{ key: '4', id: 'GR-04', device: 'GR-01', type: '阵列除草', level: '中', time: '09:30 - 11:30', duration: '2h00m', status: '建议执行' },
{ key: '5', id: 'FL-07', device: 'UAV-A01', type: 'AI 复检航线', level: '低', time: '16:30 - 17:10', duration: '0h40m', status: '待审批' },
{ key: '1', id: 'FL-03', device: 'UAV-A01', type: t('devices.typeDroneHotspot'), level: t('devices.levelHigh'), time: '10:00 - 11:20', duration: '1h20m', status: t('devices.statusSuggestExec') },
{ key: '2', id: 'RB-02', device: 'RBT-01', type: t('devices.typeFenceInspect'), level: t('devices.levelHigh'), time: '11:30 - 12:30', duration: '1h00m', status: t('devices.statusSuggestExec') },
{ key: '3', id: 'CL-05', device: 'UAV-C01', type: t('devices.typeComponentClean'), level: t('devices.levelMid'), time: '14:00 - 16:00', duration: '2h00m', status: t('devices.statusWaitExec') },
{ key: '4', id: 'GR-04', device: 'GR-01', type: t('devices.typeArrayMow'), level: t('devices.levelMid'), time: '09:30 - 11:30', duration: '2h00m', status: t('devices.statusSuggestExec') },
{ key: '5', id: 'FL-07', device: 'UAV-A01', type: t('devices.typeAIRecheck'), level: t('devices.levelLow'), time: '16:30 - 17:10', duration: '0h40m', status: t('devices.statusPendingApproval') },
]}
columns={[
{ title: '编号', dataIndex: 'id', width: 70, render: (t) => <Text style={{ color: '#165DFF', fontWeight: 600 }}>{t}</Text> },
{ title: t('devices.colNo'), dataIndex: 'id', width: 70, render: (t) => <Text style={{ color: '#165DFF', fontWeight: 600 }}>{t}</Text> },
{ title: t('constants.sourceEquipment'), dataIndex: 'device', width: 80 },
{ title: t('common.type'), dataIndex: 'type', ellipsis: true },
{ title: t('workOrder.priority'), dataIndex: 'level', width: 80, render: (l) => <span style={{ color: l === '高' ? '#F53F3F' : l === '中' ? '#FF7D00' : '#86909C', fontSize: 11, fontWeight: 600 }}>▲ {l}</span> },
{ title: '建议时间', dataIndex: 'time', width: 110 },
{ title: t('roles.status'), dataIndex: 'status', width: 90, render: (s) => <Text style={{ color: s.includes('建议') ? '#165DFF' : '#86909C', fontSize: 11, fontWeight: 500 }}>{s}</Text> },
{ title: t('workOrder.priority'), dataIndex: 'level', width: 80, render: (l) => <span style={{ color: l === t('devices.levelHigh') ? '#F53F3F' : l === t('devices.levelMid') ? '#FF7D00' : '#86909C', fontSize: 11, fontWeight: 600 }}>▲ {l}</span> },
{ title: t('devices.suggestTime'), dataIndex: 'time', width: 110 },
{ title: t('roles.status'), dataIndex: 'status', width: 90, render: (s) => <Text style={{ color: s.includes(t('devices.statusSuggestExec')) ? '#165DFF' : '#86909C', fontSize: 11, fontWeight: 500 }}>{s}</Text> },
]}
/>
<div style={{ background: '#F8F9FB', padding: '2px 14px', borderRadius: 8, marginTop: 8, border: '1px solid #F1F2F5' }}>
<div style={{ display: 'flex', gap: 12, fontSize: fontSmall, alignItems: 'center' }}>
<span style={{ fontWeight: 700, color: '#1D2129' }}>AI 建议:</span>
<span style={{ fontWeight: 700, color: '#1D2129' }}>{t('devices.aiSuggestionColon')}</span>
<Space split={<Divider type="vertical" style={{ margin: 0 }} />}>
<Space size={4}><CheckCircle2 size={13} color="#165DFF" /> <span>推荐优先执行 FL-03 航线</span></Space>
<Space size={4}><Clock size={13} color="#165DFF" /> <span>14:00-16:00 风速最佳</span></Space>
<Space size={4}><AlertCircle size={13} color="#FF7D00" /> <span>区块 B-12 存在高温风险</span></Space>
<Space size={4}><CheckCircle2 size={13} color="#165DFF" /> <span>{t('devices.aiAdvice1')}</span></Space>
<Space size={4}><Clock size={13} color="#165DFF" /> <span>{t('devices.aiAdvice2')}</span></Space>
<Space size={4}><AlertCircle size={13} color="#FF7D00" /> <span>{t('devices.aiAdvice3')}</span></Space>
</Space>
</div>
</div>
<Row gutter={12} style={{ marginTop: 8 }}>
<Col span={8}><Button type="primary" block style={{ background: '#165DFF', height: 28, borderRadius: 18, fontWeight: 600 }}>一键排程</Button></Col>
<Col span={8}><Button type="primary" block style={{ background: '#165DFF', height: 28, borderRadius: 18, fontWeight: 600 }}>智能分配</Button></Col>
<Col span={8}><Button type="primary" block style={{ background: '#165DFF', height: 28, borderRadius: 18, fontWeight: 600 }}>{t('devices.oneClickSchedule')}</Button></Col>
<Col span={8}><Button type="primary" block style={{ background: '#165DFF', height: 28, borderRadius: 18, fontWeight: 600 }}>{t('devices.smartAssign')}</Button></Col>
<Col span={8}><Button type="primary" block style={{ background: '#165DFF', height: 28, borderRadius: 18, fontWeight: 600 }}>{t('clean.generateOrder')}</Button></Col>
</Row>
</Card>
<Card
title={<span style={{ fontSize: fontTitle, fontWeight: 700 }}>航线参数 / 作业参数</span>}
extra={<Text type="secondary" style={{ fontSize: 12 }}>当前航线:{selectedTask?.name || '-'}</Text>}
title={<span style={{ fontSize: fontTitle, fontWeight: 700 }}>{t('devices.waylineParamsTitle')}</span>}
extra={<Text type="secondary" style={{ fontSize: 12 }}>{t('devices.currentWayline')}{selectedTask?.name || '-'}</Text>}
bordered={false}
bodyStyle={{ padding: '16px' }}
style={{ ...cardStyle, marginBottom: 8 }}
>
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: '8px', marginBottom: 8 }}>
{[
{ label: '飞行高度', value: taskDetail?.rth_altitude ?? '-', unit: 'm' },
{ label: '返航模式', value: taskDetail?.rth_mode === 'preset' ? '预设' : taskDetail?.rth_mode === 'optimal' ? '智能' : '-', unit: '' },
{ label: '航线精度', value: taskDetail?.wayline_precision_type === 'gps' ? 'GPS' : taskDetail?.wayline_precision_type === 'rtk' ? 'RTK' : '-', unit: '' },
{ label: '断点续飞', value: taskDetail?.resumable_status === 'auto' ? '自动' : taskDetail?.resumable_status === 'manual' ? '手动' : '-', unit: '' },
{ label: '安全返航电量', value: taskDetail?.min_battery_capacity ?? '-', unit: '%' },
{ label: t('devices.flightAltitude'), value: taskDetail?.rth_altitude ?? '-', unit: 'm' },
{ label: t('devices.rthMode'), value: taskDetail?.rth_mode === 'preset' ? t('devices.rthPreset') : taskDetail?.rth_mode === 'optimal' ? t('devices.rthOptimal') : '-', unit: '' },
{ label: t('devices.waylinePrecision'), value: taskDetail?.wayline_precision_type === 'gps' ? 'GPS' : taskDetail?.wayline_precision_type === 'rtk' ? 'RTK' : '-', unit: '' },
{ label: t('devices.resumeBreakpoint'), value: taskDetail?.resumable_status === 'auto' ? t('devices.resumeAuto') : taskDetail?.resumable_status === 'manual' ? t('devices.resumeManual') : '-', unit: '' },
{ label: t('devices.safeRthBattery'), value: taskDetail?.min_battery_capacity ?? '-', unit: '%' },
{
label: '任务类型', value:
taskDetail?.task_type === 'immediate' ? '立即任务' :
taskDetail?.task_type === 'timed' ? '定时任务' :
taskDetail?.task_type === 'recurring' ? '重复任务' :
taskDetail?.task_type === 'continuous' ? '连续任务' : '-',
label: t('devices.taskTypeLabel'), value:
taskDetail?.task_type === 'immediate' ? t('devices.taskImmediate') :
taskDetail?.task_type === 'timed' ? t('devices.taskTimed') :
taskDetail?.task_type === 'recurring' ? t('devices.taskRecurring') :
taskDetail?.task_type === 'continuous' ? t('devices.taskContinuous') : '-',
unit: ''
},
{
label: '重复类型', value:
taskDetail?.repeat_type === 'nonrepeating' ? '不重复' :
taskDetail?.repeat_type === 'daily' ? '每天' :
taskDetail?.repeat_type === 'weekly' ? '每周' :
taskDetail?.repeat_type === 'absolute_monthly' ? '按月(日期)' :
taskDetail?.repeat_type === 'relative_monthly' ? '按月(星期)' : '-',
label: t('devices.repeatTypeLabel'), value:
taskDetail?.repeat_type === 'nonrepeating' ? t('devices.repeatNone') :
taskDetail?.repeat_type === 'daily' ? t('devices.repeatDaily') :
taskDetail?.repeat_type === 'weekly' ? t('devices.repeatWeekly') :
taskDetail?.repeat_type === 'absolute_monthly' ? t('devices.repeatMonthlyByDate') :
taskDetail?.repeat_type === 'relative_monthly' ? t('devices.repeatMonthlyByWeek') : '-',
unit: ''
},
{ label: '失控动作', value: taskDetail?.out_of_control_action_in_flight === 'return_home' ? t('devices.returnHome') : '-', unit: '' },
{ label: t('devices.lostControlAction'), value: taskDetail?.out_of_control_action_in_flight === 'return_home' ? t('devices.returnHome') : '-', unit: '' },
].map((item, idx) => (
<div
key={idx}
@@ -1077,11 +1077,11 @@ export default function WayLinePage({ onRefresh }) {
<div style={{ display: 'flex', gap: 32, marginBottom: 8 }}>
<Space size={8}>
<span style={{ fontSize: fontNormal, color: '#4E5969' }}>避障开关</span>
<span style={{ fontSize: fontNormal, color: '#4E5969' }}>{t('devices.obstacleAvoidSwitch')}</span>
<Switch size="small" defaultChecked />
</Space>
<Space size={8}>
<span style={{ fontSize: fontNormal, color: '#4E5969' }}>夜航限制</span>
<span style={{ fontSize: fontNormal, color: '#4E5969' }}>{t('devices.nightFlightLimit')}</span>
<Switch size="small" />
</Space>
</div>
@@ -1095,7 +1095,7 @@ export default function WayLinePage({ onRefresh }) {
loading={loading}
style={{ height: 28, borderRadius: 18, fontWeight: 600, display: 'inline-flex', alignItems: 'center', gap: 4 }}
>
挂起任务
{t('devices.suspendTask')}
</Button>
) : (
<Button
@@ -1112,7 +1112,7 @@ export default function WayLinePage({ onRefresh }) {
loading={loading}
style={{ background: '#165DFF', height: 28, borderRadius: 18, fontWeight: 600, display: 'inline-flex', alignItems: 'center', gap: 4 }}
>
恢复任务
{t('devices.resumeTask')}
{/*{selectedTask?.status === 'suspended' ? '继续任务' : t('devices.executeTask')}*/}
</Button>
)}
@@ -1124,7 +1124,7 @@ export default function WayLinePage({ onRefresh }) {
loading={flightCommandLoading}
style={{ background: '#165DFF', height: 28, borderRadius: 18, fontWeight: 600, display: 'inline-flex', alignItems: 'center', gap: 4 }}
>
{isReturningHome ? '取消返航' : t('devices.returnHome')}
{isReturningHome ? t('devices.cancelReturnHome') : t('devices.returnHome')}
</Button>
<Button
@@ -1134,13 +1134,13 @@ export default function WayLinePage({ onRefresh }) {
loading={flightCommandLoading}
style={{ height: 28, borderRadius: 18, fontWeight: 600, display: 'inline-flex', alignItems: 'center', gap: 4 }}
>
{isTaskPaused ? '恢复任务' : '暂停任务'}
{isTaskPaused ? t('devices.resumeTask') : t('devices.pauseTask')}
</Button>
</div>
</Card>
<Card
title={<span style={{ fontSize: fontTitle, fontWeight: 700 }}>天气窗口与执行约束</span>}
title={<span style={{ fontSize: fontTitle, fontWeight: 700 }}>{t('devices.weatherWindowTitle')}</span>}
bordered={false}
bodyStyle={{ padding: '16px' }}
style={{ ...cardStyle, flex: 1, }}
@@ -1151,8 +1151,8 @@ export default function WayLinePage({ onRefresh }) {
<CloudOutlined size={20} style={{ color: '#165DFF' }} />
</div>
<div>
<div style={{ fontSize: 12, color: '#86909C' }}>适宜性</div>
<div style={{ fontSize: 14, fontWeight: 700, color: '#00B42A' }}>适宜执行</div>
<div style={{ fontSize: 12, color: '#86909C' }}>{t('devices.suitability')}</div>
<div style={{ fontSize: 14, fontWeight: 700, color: '#00B42A' }}>{t('devices.suitableExec2')}</div>
</div>
</div>
@@ -1161,9 +1161,9 @@ export default function WayLinePage({ onRefresh }) {
<Wind size={20} style={{ color: '#165DFF' }} />
</div>
<div>
<div style={{ fontSize: 12, color: '#86909C' }}>风速</div>
<div style={{ fontSize: 12, color: '#86909C' }}>{t('devices.windSpeed')}</div>
<div style={{ fontSize: 14, fontWeight: 700, color: '#1D2129' }}>{fix2((mqttDerivedData || listDroneRealtime || listDrone)?.wind_speed)} m/s</div>
<div style={{ fontSize: 12, color: '#00B42A' }}>适宜</div>
<div style={{ fontSize: 12, color: '#00B42A' }}>{t('devices.suitable')}</div>
</div>
</div>
@@ -1174,7 +1174,7 @@ export default function WayLinePage({ onRefresh }) {
<div>
<div style={{ fontSize: 12, color: '#86909C' }}>{t('home.temperature')}</div>
<div style={{ fontSize: 14, fontWeight: 700, color: '#1D2129' }}>{fix2((mqttDerivedData || listDroneRealtime || listDrone)?.environment_temperature)}℃</div>
<div style={{ fontSize: 12, color: '#00B42A' }}>适宜</div>
<div style={{ fontSize: 12, color: '#00B42A' }}>{t('devices.suitable')}</div>
</div>
</div>
@@ -1183,10 +1183,10 @@ export default function WayLinePage({ onRefresh }) {
<Droplets size={20} style={{ color: '#FF7D00' }} />
</div>
<div>
<div style={{ fontSize: 12, color: '#86909C' }}>降水状态</div>
<div style={{ fontSize: 12, color: '#86909C' }}>{t('devices.precipStatus')}</div>
<div style={{ fontSize: 14, fontWeight: 700, color: '#1D2129' }}>{getVal((mqttDerivedData || listDroneRealtime || listDrone)?.rainfall)}</div>
<div style={{ fontSize: 12, color: (mqttDerivedData || listDroneRealtime || listDrone)?.rainfall === 'no_rain' ? '#00B42A' : '#F53F3F' }}>
{(mqttDerivedData || listDroneRealtime || listDrone)?.rainfall === 'no_rain' ? t('aiAnalysis.lowRisk') : '有雨'}
{(mqttDerivedData || listDroneRealtime || listDrone)?.rainfall === 'no_rain' ? t('aiAnalysis.lowRisk') : t('devices.hasRain')}
</div>
</div>
</div>
@@ -1196,12 +1196,12 @@ export default function WayLinePage({ onRefresh }) {
<Satellite size={20} style={{ color: '#00B42A' }} />
</div>
<div>
<div style={{ fontSize: 12, color: '#86909C' }}>GNSS质量</div>
<div style={{ fontSize: 12, color: '#86909C' }}>{t('devices.gnssQuality')}</div>
<div style={{ fontSize: 14, fontWeight: 700, color: '#1D2129' }}>
{(mqttDerivedData || listDroneRealtime || listDrone)?.position_state?.rtk_number ?? 0} RTK
</div>
<div style={{ fontSize: 12, color: (mqttDerivedData || listDroneRealtime || listDrone)?.position_state?.is_fixed === 'fixing_successful' ? '#00B42A' : '#FF7D00' }}>
{(mqttDerivedData || listDroneRealtime || listDrone)?.position_state?.is_fixed === 'fixing_successful' ? '已固定' : '未固定'}
{(mqttDerivedData || listDroneRealtime || listDrone)?.position_state?.is_fixed === 'fixing_successful' ? t('devices.fixed2') : t('devices.notFixed2')}
</div>
</div>
</div>
@@ -1210,11 +1210,11 @@ export default function WayLinePage({ onRefresh }) {
<div style={{ display: 'flex', gap: '12px' }}>
<div style={{ flex: 1, background: 'rgba(255, 125, 0, 0.1)', borderRadius: 8, padding: '10px 12px', display: 'flex', alignItems: 'center', gap: 8 }}>
<AlertCircle size={16} style={{ color: '#FF7D00' }} />
<span style={{ fontSize: 13, color: '#FF7D00', fontWeight: 500 }}>16:30 后风速升高,建议提前完成任务</span>
<span style={{ fontSize: 13, color: '#FF7D00', fontWeight: 500 }}>{t('devices.weatherAdvice1')}</span>
</div>
<div style={{ flex: 1, background: 'rgba(22, 93, 255, 0.1)', borderRadius: 8, padding: '10px 12px', display: 'flex', alignItems: 'center', gap: 8 }}>
<InfoCircleOutlined size={16} style={{ color: '#165DFF' }} />
<span style={{ fontSize: 13, color: '#165DFF', fontWeight: 500 }}>预计 14:00-16:00 为最佳执行窗口</span>
<span style={{ fontSize: 13, color: '#165DFF', fontWeight: 500 }}>{t('devices.weatherAdvice2')}</span>
</div>
</div>
</Card>
@@ -1227,12 +1227,12 @@ export default function WayLinePage({ onRefresh }) {
<Card
title={
<div className="flex justify-between items-center w-full">
<span style={{ fontSize: fontTitle, fontWeight: 700 }}>航线列表</span>
<span style={{ fontSize: fontTitle, fontWeight: 700 }}>{t('devices.waylineList')}</span>
{/* ✅ 航线列表独立无人机筛选 */}
<Select
size="small"
style={{ width: 120 }}
placeholder="选择无人机"
placeholder={t('devices.selectDrone')}
showSearch
allowClear
options={planedevices?.map(item => ({
@@ -1253,7 +1253,7 @@ export default function WayLinePage({ onRefresh }) {
style={{ ...cardStyle, height: '100%' }}
>
<Input
placeholder="搜索航线..."
placeholder={t('devices.searchWaylinePlaceholder')}
prefix={<SearchOutlined style={{ color: '#86909C' }} />}
style={{ marginBottom: 12, borderRadius: 6 }}
size="small"
@@ -1282,10 +1282,10 @@ export default function WayLinePage({ onRefresh }) {
{item.name}
</div>
<div style={{ fontSize: 11, color: '#86909C', display: 'flex', alignItems: 'center', gap: 4 }}>
<Clock size={12} /> {item.update_time ? dayjs(item.update_time).format('MM-DD HH:mm') : '未知时间'}
<Clock size={12} /> {item.update_time ? dayjs(item.update_time).format('MM-DD HH:mm') : t('devices.unknownTime')}
</div>
{/* ✅ 执行按钮改为图标 */}
<Tooltip title="执行航线">
<Tooltip title={t('devices.executeWayline')}>
<Button
type="text"
icon={<PlayCircleOutlined style={{ color: '#165DFF', fontSize: 18 }} />}
@@ -1302,7 +1302,7 @@ export default function WayLinePage({ onRefresh }) {
))}
{waylineList.length === 0 && (
<div style={{ textAlign: 'center', padding: '20px 0', color: '#86909C', fontSize: 12 }}>
暂无航线数据
{t('devices.noWaylineData')}
</div>
)}
</div>
@@ -1311,7 +1311,7 @@ export default function WayLinePage({ onRefresh }) {
<Col xs={24} xl={12}>
<Card
title={<span style={{ fontSize: fontTitle, fontWeight: 700 }}>任务甘特视图 / 排班视图 <Text type="secondary" style={{ fontSize: 11, fontWeight: 400, marginLeft: 12 }}></Text></span>}
title={<span style={{ fontSize: fontTitle, fontWeight: 700 }}>{t('devices.ganttViewTitle')} <Text type="secondary" style={{ fontSize: 11, fontWeight: 400, marginLeft: 12 }}></Text></span>}
extra={<MoreOutlined style={{ cursor: 'pointer', fontSize: 18 }} />}
bordered={false}
bodyStyle={{ padding: 16 }}
@@ -1326,10 +1326,10 @@ export default function WayLinePage({ onRefresh }) {
</div>
<div style={{ display: 'flex', flexDirection: 'column', gap: 16, marginTop: 16 }}>
{[
{ label: '无人机机场 A01', sub: '(UAV-A01)', tasks: [{ start: '25%', width: '18%', title: 'FL-03 热斑巡检', time: '10:00-11:20', color: '#165DFF' }, { start: '75%', width: '12%', title: 'FL-07 复检', time: '16:30-17:10', color: '#165DFF' }] },
{ label: '巡检机器人 RBT-01', sub: '', tasks: [{ start: '45%', width: '15%', title: 'RB-02 围栏巡检', time: '11:30-12:30', color: '#FF7D00' }] },
{ label: '除草机器人 GR-01', sub: '', tasks: [{ start: '10%', width: '22%', title: 'GR-04 阵列除草', time: '09:30-11:30', color: '#00B42A' }] },
{ label: '清洗无人机 UAV-C01', sub: '', tasks: [{ start: '65%', width: '20%', title: 'CL-05 组件清洗', time: '14:00-16:00', color: '#13C2C2' }] },
{ label: t('devices.dronePortA01'), sub: '(UAV-A01)', tasks: [{ start: '25%', width: '18%', title: 'FL-03 ' + t('devices.typeHotspotInspect'), time: '10:00-11:20', color: '#165DFF' }, { start: '75%', width: '12%', title: 'FL-07 ' + t('devices.typeRecheck'), time: '16:30-17:10', color: '#165DFF' }] },
{ label: t('devices.inspectRobotRbt'), sub: '', tasks: [{ start: '45%', width: '15%', title: 'RB-02 ' + t('devices.typeFenceInspect'), time: '11:30-12:30', color: '#FF7D00' }] },
{ label: t('devices.mowRobotGr'), sub: '', tasks: [{ start: '10%', width: '22%', title: 'GR-04 ' + t('devices.typeArrayMow'), time: '09:30-11:30', color: '#00B42A' }] },
{ label: t('devices.washDroneUav'), sub: '', tasks: [{ start: '65%', width: '20%', title: 'CL-05 ' + t('devices.typeComponentClean'), time: '14:00-16:00', color: '#13C2C2' }] },
].map((row, idx) => (
<div key={idx} style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ width: 140, paddingRight: 12 }}>
@@ -1363,7 +1363,7 @@ export default function WayLinePage({ onRefresh }) {
<Card
title={
<div className="flex justify-between items-center w-full">
<span style={{ fontSize: fontTitle, fontWeight: 700 }}>工作任务看板</span>
<span style={{ fontSize: fontTitle, fontWeight: 700 }}>{t('devices.workTaskBoard')}</span>
<Space size={8}>
<RangePicker
size="small"
@@ -1371,12 +1371,12 @@ export default function WayLinePage({ onRefresh }) {
format="YYYY-MM-DD HH:mm:ss"
value={boardDateRange}
onChange={(val) => setBoardDateRange(val)}
placeholder={['开始', '结束']}
placeholder={[t('devices.startLabel'), t('devices.endLabel')]}
/>
<Select
style={{ width: 140 }}
size="small"
placeholder="全部无人机"
placeholder={t('devices.allDrones')}
showSearch
allowClear
options={planedevices?.map(item => ({
@@ -1400,7 +1400,7 @@ export default function WayLinePage({ onRefresh }) {
<Row gutter={10}>
{[
{
title: '待执行', count: waitList.length, color: '#4E5969', bg: '#F7F8FA',
title: t('devices.pendingExec'), count: waitList.length, color: '#4E5969', bg: '#F7F8FA',
list: waitList.map(item => ({
id: item.sn?.slice(-5) || '',
name: item.name,
@@ -1444,16 +1444,16 @@ export default function WayLinePage({ onRefresh }) {
{/* 设备 & 时间:自动换行 */}
<div style={{ fontSize: 10, color: '#86909C', lineHeight: '1.4' }}>
<div style={{ marginBottom: 2, wordBreak: 'break-all', whiteSpace: 'normal' }}>
装备: {task.device || 'UAV-A01'}
{t('devices.equipmentColon')} {task.device || 'UAV-A01'}
</div>
{task.begin_at && (
<div style={{ marginTop: 2, wordBreak: 'break-all', whiteSpace: 'normal' }}>
开始时间: {task.begin_at}
{t('devices.startTimeColon')} {task.begin_at}
</div>
)}
{task.completed_at && (
<div style={{ marginTop: 2, wordBreak: 'break-all', whiteSpace: 'normal' }}>
完成时间: {task.completed_at}
{t('devices.completedTimeColon')} {task.completed_at}
</div>
)}
</div>
@@ -1471,7 +1471,7 @@ export default function WayLinePage({ onRefresh }) {
{/* 创建任务弹窗 */}
<Modal
open={createTaskModal}
title="创建航线任务"
title={t('devices.createWaylineTaskTitle')}
onCancel={resetModals}
footer={null}
maskClosable={false}
@@ -1480,7 +1480,7 @@ export default function WayLinePage({ onRefresh }) {
<div className="py-4 space-y-4">
<div className="grid grid-cols-2 gap-4">
<div>
<label className="text-sm block mb-1">航线名称 <span className="text-red-500">*</span></label>
<label className="text-sm block mb-1">{t('devices.waylineName')} <span className="text-red-500">*</span></label>
<Input
value={taskForm.name}
onChange={(e) => setTaskForm({ ...taskForm, name: e.target.value })}
@@ -1488,7 +1488,7 @@ export default function WayLinePage({ onRefresh }) {
/>
</div>
<div>
<label className="text-sm block mb-1">选择航线 <span className="text-red-500">*</span></label>
<label className="text-sm block mb-1">{t('devices.selectWayline')} <span className="text-red-500">*</span></label>
<Select
showSearch
value={waylineUuid}
@@ -1501,11 +1501,11 @@ export default function WayLinePage({ onRefresh }) {
<div className="grid grid-cols-2 gap-4">
<div>
<label className="text-sm block mb-1">机场SN <span className="text-red-500">*</span></label>
<label className="text-sm block mb-1">{t('devices.airportSn')} <span className="text-red-500">*</span></label>
<Input value={taskForm.sn} disabled />
</div>
<div>
<label className="text-sm block mb-1">降落地场SN</label>
<label className="text-sm block mb-1">{t('devices.landingDockSn')}</label>
<Input
value={taskForm.landing_dock_sn}
onChange={(e) => setTaskForm({ ...taskForm, landing_dock_sn: e.target.value })}
@@ -1515,7 +1515,7 @@ export default function WayLinePage({ onRefresh }) {
<div className="grid grid-cols-2 gap-4">
<div>
<label className="text-sm block mb-1">返航高度(m)</label>
<label className="text-sm block mb-1">{t('devices.returnHomeAltitude')}</label>
<InputNumber
min={0}
value={taskForm.rth_altitude}
@@ -1524,11 +1524,11 @@ export default function WayLinePage({ onRefresh }) {
/>
</div>
<div>
<label className="text-sm block mb-1">返航模式</label>
<label className="text-sm block mb-1">{t('devices.returnHomeMode')}</label>
<Select
value={taskForm.rth_mode}
onChange={(v) => setTaskForm({ ...taskForm, rth_mode: v })}
options={[{ label: '智能', value: 'optimal' }, { label: '预设', value: 'preset' }]}
options={[{ label: t('devices.rthOptimal'), value: 'optimal' }, { label: t('devices.rthPreset'), value: 'preset' }]}
style={{ width: '100%' }}
/>
</div>
@@ -1536,7 +1536,7 @@ export default function WayLinePage({ onRefresh }) {
<div className="grid grid-cols-2 gap-4">
<div>
<label className="text-sm block mb-1">航线精度</label>
<label className="text-sm block mb-1">{t('devices.waylinePrecision')}</label>
<Select
value={taskForm.wayline_precision_type}
onChange={(v) => setTaskForm({ ...taskForm, wayline_precision_type: v })}
@@ -1545,11 +1545,11 @@ export default function WayLinePage({ onRefresh }) {
/>
</div>
<div>
<label className="text-sm block mb-1">断点续飞</label>
<label className="text-sm block mb-1">{t('devices.resumeBreakpoint')}</label>
<Select
value={taskForm.resumable_status}
onChange={(v) => setTaskForm({ ...taskForm, resumable_status: v })}
options={[{ label: '自动', value: 'auto' }, { label: '手动', value: 'manual' }]}
options={[{ label: t('devices.resumeAuto'), value: 'auto' }, { label: t('devices.resumeManual'), value: 'manual' }]}
style={{ width: '100%' }}
/>
</div>
@@ -1557,7 +1557,7 @@ export default function WayLinePage({ onRefresh }) {
<div className="grid grid-cols-2 gap-4">
<div>
<label className="text-sm block mb-1">最低电量(%)</label>
<label className="text-sm block mb-1">{t('devices.minBattery')}</label>
<InputNumber
min={50}
max={100}
@@ -1567,12 +1567,12 @@ export default function WayLinePage({ onRefresh }) {
/>
</div>
<div>
<label className="text-sm block mb-1">任务类型</label>
<label className="text-sm block mb-1">{t('devices.taskTypeLabel')}</label>
<Select
value={taskForm.task_type}
onChange={(v) => setTaskForm({ ...taskForm, task_type: v })}
options={[
{ label: '立即', value: 'immediate' },
{ label: t('devices.taskImmediate'), value: 'immediate' },
]}
style={{ width: '100%' }}
/>
@@ -1610,22 +1610,22 @@ export default function WayLinePage({ onRefresh }) {
<>
<div className="grid grid-cols-2 gap-4">
<div>
<label className="text-sm block mb-1">重复模式</label>
<label className="text-sm block mb-1">{t('devices.repeatMode')}</label>
<Select
value={taskForm.repeat_type}
onChange={(v) => setTaskForm({ ...taskForm, repeat_type: v })}
options={[
{ label: '不重复', value: 'nonrepeating' },
{ label: '每天', value: 'daily' },
{ label: '每周', value: 'weekly' },
{ label: '每月(日期)', value: 'absolute_monthly' },
{ label: '每月(星期)', value: 'relative_monthly' },
{ label: t('devices.repeatNone'), value: 'nonrepeating' },
{ label: t('devices.repeatDaily'), value: 'daily' },
{ label: t('devices.repeatWeekly'), value: 'weekly' },
{ label: t('devices.repeatMonthlyByDate'), value: 'absolute_monthly' },
{ label: t('devices.repeatMonthlyByWeek'), value: 'relative_monthly' },
]}
style={{ width: '100%' }}
/>
</div>
<div>
<label className="text-sm block mb-1">重复间隔</label>
<label className="text-sm block mb-1">{t('devices.repeatInterval')}</label>
<InputNumber
min={1}
value={taskForm.repeat_option.interval}
@@ -1641,7 +1641,7 @@ export default function WayLinePage({ onRefresh }) {
{/* 每周 */}
{taskForm.repeat_type === 'weekly' && (
<div>
<label className="text-sm block mb-1">周几执行</label>
<label className="text-sm block mb-1">{t('devices.weekdayExec')}</label>
<Select
mode="multiple"
value={taskForm.repeat_option.days_of_week}
@@ -1650,13 +1650,13 @@ export default function WayLinePage({ onRefresh }) {
repeat_option: { ...taskForm.repeat_option, days_of_week: v }
})}
options={[
{ label: '周日', value: 0 },
{ label: '周一', value: 1 },
{ label: '周二', value: 2 },
{ label: '周三', value: 3 },
{ label: '周四', value: 4 },
{ label: '周五', value: 5 },
{ label: '周六', value: 6 }
{ label: t('devices.weekSun'), value: 0 },
{ label: t('devices.weekMon'), value: 1 },
{ label: t('devices.weekTue'), value: 2 },
{ label: t('devices.weekWed'), value: 3 },
{ label: t('devices.weekThu'), value: 4 },
{ label: t('devices.weekFri'), value: 5 },
{ label: t('devices.weekSat'), value: 6 }
]}
style={{ width: '100%' }}
/>
@@ -1666,7 +1666,7 @@ export default function WayLinePage({ onRefresh }) {
{/* 按月日期 */}
{taskForm.repeat_type === 'absolute_monthly' && (
<div>
<label className="text-sm block mb-1">每月几日</label>
<label className="text-sm block mb-1">{t('devices.monthDays')}</label>
<Select
mode="multiple"
value={taskForm.repeat_option.days_of_month}
@@ -1684,19 +1684,19 @@ export default function WayLinePage({ onRefresh }) {
{taskForm.repeat_type === 'relative_monthly' && (
<div className="grid grid-cols-2 gap-4">
<div>
<label className="text-sm block mb-1">第几周</label>
<label className="text-sm block mb-1">{t('devices.whichWeek')}</label>
<Select
value={taskForm.repeat_option.week_of_month}
onChange={(v) => setTaskForm({
...taskForm,
repeat_option: { ...taskForm.repeat_option, week_of_month: v }
})}
options={[1, 2, 3, 4].map(w => ({ label: `第${w}周`, value: w }))}
options={[1, 2, 3, 4].map(w => ({ label: t('devices.weekNo', { w }), value: w }))}
style={{ width: '100%' }}
/>
</div>
<div>
<label className="text-sm block mb-1">周几</label>
<label className="text-sm block mb-1">{t('devices.weekday')}</label>
<Select
mode="multiple"
value={taskForm.repeat_option.days_of_week}
@@ -1705,13 +1705,13 @@ export default function WayLinePage({ onRefresh }) {
repeat_option: { ...taskForm.repeat_option, days_of_week: v }
})}
options={[
{ label: '周日', value: 0 },
{ label: '周一', value: 1 },
{ label: '周二', value: 2 },
{ label: '周三', value: 3 },
{ label: '周四', value: 4 },
{ label: '周五', value: 5 },
{ label: '周六', value: 6 }
{ label: t('devices.weekSun'), value: 0 },
{ label: t('devices.weekMon'), value: 1 },
{ label: t('devices.weekTue'), value: 2 },
{ label: t('devices.weekWed'), value: 3 },
{ label: t('devices.weekThu'), value: 4 },
{ label: t('devices.weekFri'), value: 5 },
{ label: t('devices.weekSat'), value: 6 }
]}
style={{ width: '100%' }}
/>
@@ -1720,7 +1720,7 @@ export default function WayLinePage({ onRefresh }) {
)}
<div>
<label className="text-sm block mb-1">执行时间点</label>
<label className="text-sm block mb-1">{t('devices.execTimePoint')}</label>
<Select
mode="tags"
value={taskForm.recurring_task_start_time_list}
@@ -1728,7 +1728,7 @@ export default function WayLinePage({ onRefresh }) {
...taskForm,
recurring_task_start_time_list: v
})}
placeholder="输入时间戳"
placeholder={t('devices.inputTimestamp')}
style={{ width: '100%' }}
/>
</div>
@@ -1738,34 +1738,34 @@ export default function WayLinePage({ onRefresh }) {
{/* 按钮 */}
<div className="flex justify-end gap-2 mt-4">
<Button onClick={resetModals}>{t('common.cancel')}</Button>
<Button type="primary" loading={loading} onClick={createFlightTask}>确认创建</Button>
<Button type="primary" loading={loading} onClick={createFlightTask}>{t('devices.confirmCreate')}</Button>
</div>
</div>
</Modal>
{/* 执行航线设置返航高度 Modal */}
<Modal
title="执行航线任务"
title={t('devices.executeWaylineTask')}
open={rthModalVisible}
onOk={confirmExecuteWayline}
onCancel={() => setRthModalVisible(false)}
confirmLoading={loading}
okText="立即执行"
okText={t('devices.executeNow')}
cancelText={t('common.cancel')}
centered
width={400}
>
<div style={{ padding: '10px 0' }}>
<div style={{ marginBottom: 16 }}>
<Text strong>所选航线:</Text>
<Text strong>{t('devices.selectedWaylineColon')}</Text>
<Text>{selectedWayline?.name}</Text>
</div>
<div style={{ marginBottom: 16 }}>
<Text strong>执行设备:</Text>
<Text>{waylineDrone?.drone_callsign || waylineDrone?.device_sn || '未选择设备'}</Text>
<Text strong>{t('devices.executeDeviceColon')}</Text>
<Text>{waylineDrone?.drone_callsign || waylineDrone?.device_sn || t('devices.noDeviceSelected')}</Text>
</div>
<div>
<div style={{ marginBottom: 8 }}><Text strong>返航高度 (m):</Text></div>
<div style={{ marginBottom: 8 }}><Text strong>{t('devices.returnHomeAltitudeColon')}</Text></div>
<InputNumber
min={10}
max={500}