优化一些细节

This commit is contained in:
mmc
2026-11-16 14:33:48 +08:00
parent 831e1086d3
commit d9f4b752dd
5 changed files with 71 additions and 53 deletions

View File

@@ -423,7 +423,7 @@ export default function DeviceOverviewPage() {
if (!selectedDevice) return null;
const sn = selectedDevice.device_sn || selectedDevice.serialNumber;
const wsData = realtimeMap[sn] || {};
setDeviceStatistics(wsData || {})
//setDeviceStatistics(wsData || {})
return {
@@ -1181,7 +1181,7 @@ export default function DeviceOverviewPage() {
</div>
<div style={{ display: 'flex', justifyContent: "space-between", flexWrap: 'wrap', gap: 6 }}>
<Button type="primary" style={{ borderRadius: 8, flex: 1 }} onClick={handleStart}>{t('devices.s23')}</Button>
{/*<Button type="primary" style={{ borderRadius: 8, flex: 1 }} onClick={handleStart}>{t('devices.s23')}</Button>*/}
{/*<Button style={{ borderRadius: 8, flex: 1 }} onClick={handlePause}>{t('video.pause')}</Button>*/}
<Button type="primary" style={{ borderRadius: 8, flex: 1 }} onClick={handleAutoBack}>{t('devices.returnHome')}</Button>
{/*<Button style={{ flex: 1, background: '#52c41a', borderColor: '#52c41a', color: "#fff", borderRadius: 8, }} onClick={handleRecharge}>{t('devices.s24')}</Button>*/}
@@ -1359,9 +1359,9 @@ export default function DeviceOverviewPage() {
}}
>
<Statistic
title={<span style={{ fontSize: 11, color: '#666666', fontWeight: 400 }}>{t('devices.statTotalDistance')}</span>}
title={<span style={{ fontSize: 11, color: '#666666', fontWeight: 400 }}>{t('devices.statTotalDistance')}(m)</span>}
value={deviceStatistics?.distance ? Number(deviceStatistics.distance).toFixed(2) : Number(deviceStatistics?.workArea / 0.7 || 0).toFixed(2)}
suffix="m"
suffix=""
valueStyle={{ fontSize: 20, fontWeight: 700, color: '#165DFF', marginTop: 4 }}
/>
</div>
@@ -1378,9 +1378,9 @@ export default function DeviceOverviewPage() {
}}
>
<Statistic
title={<span style={{ fontSize: 11, color: '#666666', fontWeight: 400 }}>{t('devices.s50')}</span>}
title={<span style={{ fontSize: 11, color: '#666666', fontWeight: 400 }}>{t('devices.s50')}(㎡)</span>}
value={Number(deviceStatistics?.workArea || 0).toFixed(2)}
suffix="㎡"
suffix=""
valueStyle={{ fontSize: 20, fontWeight: 700, color: '#165DFF', marginTop: 4 }}
/>
</div>
@@ -1397,9 +1397,9 @@ export default function DeviceOverviewPage() {
}}
>
<Statistic
title={<span style={{ fontSize: 11, color: '#666666', fontWeight: 400 }}>{t('devices.s51')}</span>}
title={<span style={{ fontSize: 11, color: '#666666', fontWeight: 400 }}>{t('devices.s51')}(min)</span>}
value={Number(deviceStatistics?.time || 0).toFixed(2)}
suffix="min"
suffix=""
valueStyle={{ fontSize: 20, fontWeight: 700, color: '#165DFF', marginTop: 4 }}
/>
</div>

View File

@@ -738,12 +738,12 @@ export default function DeviceStatusPage() {
// hasRequestedControlRef.current = true;
// handleControlModal();
//}
return;
//return;
}
console.log(realtimePosition?.controlMode, "现在的控制controlmode")
if (realtimePosition?.controlMode && (realtimePosition?.controlMode != 3 || realtimePosition?.control_mode != 3)) {
if (realtimePosition?.controlMode && (realtimePosition?.controlMode != 3 || realtimePosition?.controlMode != 0)) {
messageApi.warning(t('devices.noRemoteControl'));
return;
//return;
}
console.log('Gamepad state updated:', state);
// 记录方向盘 xy 坐标,用于倒车影像叠加层
@@ -763,6 +763,7 @@ export default function DeviceStatusPage() {
messageApi.warning(t('devices.disconnectGamepadFirst'));
}
return true;
}, [isGamepadConnected, isControlled, t, messageApi]);
// 方向盘功能按钮:复用与手柄一致的遥控帧(指定位按下后短暂释放)
// 方向盘按键按下/释放帧(长按模式:onDown 每 100ms 调用一次;短按模式:sendSteerButton 一次性发送后 300ms 自动释放)
@@ -1347,9 +1348,9 @@ export default function DeviceStatusPage() {
{/*<ConsoleRow icon={<DashboardOutlined />} label={t('devices.rtRightMeasureRpm')} value={(runningStatus?.right_measured_rpm ?? runningStatus?.rightMeasureSpeed) !== undefined ? Number(runningStatus?.right_measured_rpm ?? runningStatus?.rightMeasureSpeed).toFixed(1) + 'rpm' : '-'} />*/}
<ConsoleRow icon={<DashboardOutlined />} label={t('devices.rtLeftMotorRpm')} value={runningStatus?.left_motor_rpm !== undefined ? Number(runningStatus?.left_motor_rpm).toFixed(1) + 'rpm' : '-'} />
<ConsoleRow icon={<DashboardOutlined />} label={t('devices.rtRightMotorRpm')} value={runningStatus?.right_motor_rpm !== undefined ? Number(runningStatus?.right_motor_rpm).toFixed(1) + 'rpm' : '-'} />
<ConsoleRow icon={<GlobalOutlined />} label={t('devices.totalWorkArea')} value={runningStatus?.total_work_area !== undefined ? Number(runningStatus?.total_work_area).toFixed(2) : '-'} />
{/*<ConsoleRow icon={<GlobalOutlined />} label={t('devices.totalWorkArea')} value={runningStatus?.total_work_area !== undefined ? Number(runningStatus?.total_work_area).toFixed(2) : '-'} />
<ConsoleRow icon={<GlobalOutlined />} label={t('devices.totalWorkDuration')} value={runningStatus?.total_work_duration !== undefined ? Number(runningStatus?.total_work_duration).toFixed(0) : '-'} />
<ConsoleRow icon={<GlobalOutlined />} label={t('devices.totalWorkDistance')} value={runningStatus?.total_work_distance !== undefined ? Number(runningStatus?.total_work_distance).toFixed(2) : '-'} />
<ConsoleRow icon={<GlobalOutlined />} label={t('devices.totalWorkDistance')} value={runningStatus?.total_work_distance !== undefined ? Number(runningStatus?.total_work_distance).toFixed(2) : '-'} />*/}
</div>
</div>
</ConsolePanel>

View File

@@ -1555,21 +1555,37 @@ export const MapEditorView = React.forwardRef(function MapEditorView(
}}
>
<div style={{ flex: 1, minWidth: 0 }}>
<div style={{ fontSize: 13, fontWeight: 500 }}>
{route.workName || route.name || t('devices.mapEditor.unnamed')}
</div>
<div style={{ fontSize: 11, color: '#86909C', marginTop: 2 }}>
{t('devices.mapEditor.mode')}: {route.mode === 'coverage' || route.mode === 'coverage_area'
? t('devices.coverageMode') : route.mode === 'predefined_path' ? t('devices.predefinedPathMode')
: t('devices.singleMode')}
{route.routeType && (
<span style={{ marginLeft: 8 }}>
· {route.routeType === 'MOWING_TASK' ? t('devices.mapEditor.typeMowing')
: route.routeType === 'INSPECTION_TASK' ? t('devices.mapEditor.typeInspection')
: t('devices.mapEditor.typeOther')}
</span>
)}
<div style={{ flex: 1, display: 'flex', alignItems: 'center', gap: 8, marginBottom: 4, flexDirection: 'row' }}>
<div>
{route?.imgUrl && (
<img
src={route.imgUrl}
alt=""
style={{ width: 20, height: 20, objectFit: 'cover' }}
/>
)}
</div>
<div>
<div style={{ fontSize: 13, fontWeight: 500 }}>
{route.workName || route.name || t('devices.mapEditor.unnamed')}
</div>
<div style={{ fontSize: 11, color: '#86909C', marginTop: 2 }}>
{t('devices.mapEditor.mode')}: {route.mode === 'coverage' || route.mode === 'coverage_area'
? t('devices.coverageMode') : route.mode === 'predefined_path' ? t('devices.predefinedPathMode')
: t('devices.singleMode')}
{route.routeType && (
<span style={{ marginLeft: 8 }}>
· {route.routeType === 'MOWING_TASK' ? t('devices.mapEditor.typeMowing')
: route.routeType === 'INSPECTION_TASK' ? t('devices.mapEditor.typeInspection')
: t('devices.mapEditor.typeOther')}
</span>
)}
</div>
</div>
</div>
</div>
<Button
size="small"

View File

@@ -1745,7 +1745,7 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
/>
{/* 机器人操作面板(状态信息改为鼠标悬浮机器时在地图上显示) */}
{execute && executingRobot && (
{targetRobot && (
<div
style={{
position: 'absolute',
@@ -1768,7 +1768,7 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
}}
>
<span style={{ fontWeight: 600 }}>
🤖 {executingRobot.deviceAlias || executingRobot.serialNumber}
🤖 {targetRobot.deviceAlias || targetRobot.serialNumber}
</span>
<span>
@@ -2277,7 +2277,7 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
<div style={{ fontWeight: 600, marginBottom: 8 }}>{t('devices.dispatchSource')}</div>
<Radio.Group value={dispatchSource} onChange={e => { setDispatchSource(e.target.value); setDispatchRouteIds([]); setDispatchRegionIds([]); }} buttonStyle="solid">
<Radio.Button value="route">{t('devices.dispatchByRoute')}</Radio.Button>
<Radio.Button value="region">{t('devices.dispatchByRegion')}</Radio.Button>
{/*<Radio.Button value="region">{t('devices.dispatchByRegion')}</Radio.Button>*/}
</Radio.Group>
</div>
@@ -2334,7 +2334,13 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
}}
>
<span style={{ width: 6, height: 6, borderRadius: '50%', background: group.color, flex: '0 0 auto' }} />
<span style={{ flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{route.workName || route.name}</span>
{route?.imgUrl && (
<img
src={route.imgUrl}
alt=""
style={{ width: 20, height: 20, objectFit: 'cover' }}
/>
)} <span style={{ flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{route.workName || route.name}</span>
{checked && <span style={{ color: '#1677ff', fontWeight: 700 }}>✓</span>}
</div>
);