累计作业面积 时长实现 急停全局数据接入 局部内联样式 换为 外联 优化控制模式和系统模式的切换 功能控制面板加入急停 任务界面 加入急停
This commit is contained in:
@@ -44,6 +44,7 @@ import { sendEmergencyStop, subscribeEmergencyStop, syncEmergencyStop } from './
|
||||
import AlarmLevelTag from '../AlarmLevelTag.tsx';
|
||||
import { getDeviceTastPool } from '@/api/device.ts';
|
||||
import { backToRestPointCommand } from '@/api/mapEdit';
|
||||
import './DeviceOverviewPage.css';
|
||||
|
||||
const { Content } = Layout;
|
||||
const { Text, Title } = Typography;
|
||||
@@ -245,6 +246,7 @@ export default function DeviceOverviewPage() {
|
||||
feStatus: rt?.feStatus,
|
||||
taskId: rt?.t,
|
||||
isRealtimeOnly: true,
|
||||
emergencyStop: rt?.emergencyStop,
|
||||
// 同步写入 locationMessage / lastRunningStatus,确保 Map.jsx 设备渲染 useEffect 能读到实时坐标
|
||||
locationMessage: { longitude: rt?.lng, latitude: rt?.lat, heading: rt?.yaw, batteryLevel: rt?.battery },
|
||||
lastRunningStatus: { longitude: rt?.lng, latitude: rt?.lat, heading: rt?.yaw, batteryLevel: rt?.battery },
|
||||
@@ -293,7 +295,15 @@ export default function DeviceOverviewPage() {
|
||||
(d?.longitude && d?.latitude)
|
||||
);
|
||||
}, [devices, realtimeMap]);
|
||||
const formatTime = (seconds) => {
|
||||
const time = Number(seconds || 0);
|
||||
|
||||
if (time >= 86400) {
|
||||
return `${(time / 86400).toFixed(2)} d`;
|
||||
}
|
||||
|
||||
return `${(time / 3600).toFixed(2)} h`;
|
||||
};
|
||||
// 打开编辑弹窗
|
||||
const openEditRobotModal = (record) => {
|
||||
// 仅机器人允许编辑,无人机直接提示
|
||||
@@ -475,8 +485,8 @@ export default function DeviceOverviewPage() {
|
||||
|
||||
// 实时数据里的急停状态同步到共享锁存状态:true=已急停,false=未急停
|
||||
useEffect(() => {
|
||||
syncEmergencyStop(realtimeDevice?.emergency_stop);
|
||||
}, [realtimeDevice?.emergency_stop]);
|
||||
syncEmergencyStop(realtimeDevice?.emergencyStop);
|
||||
}, [realtimeDevice?.emergencyStop]);
|
||||
|
||||
// MQTT消息处理
|
||||
const handleMqttMessage = useCallback((topic, message) => {
|
||||
@@ -700,7 +710,7 @@ export default function DeviceOverviewPage() {
|
||||
return [
|
||||
{
|
||||
title: t('devices.fixed2DroneAirportFixed2StatusFixed2'),
|
||||
icon: <EnvironmentOutlined style={{ color: '#165DFF', fontSize: 24 }} />,
|
||||
icon: <EnvironmentOutlined className="device-overview-top-icon-blue" />,
|
||||
value: `${onlineDrones} / ${totalDrones}`,
|
||||
sub: `${t('devices.distributable')} ${onlineDrones} ${t('devices.UnitsDrone')}`,
|
||||
color: '#165DFF',
|
||||
@@ -708,7 +718,7 @@ export default function DeviceOverviewPage() {
|
||||
},
|
||||
{
|
||||
title: t('home.inspectionRobot'),
|
||||
icon: <RobotOutlined style={{ color: '#13c2c2', fontSize: 24 }} />,
|
||||
icon: <RobotOutlined className="device-overview-top-icon-cyan" />,
|
||||
value: `${onlineRobots} / ${totalRobots}`,
|
||||
sub: `${t('devices.online')} ${onlineRobots}`,
|
||||
color: '#13c2c2',
|
||||
@@ -716,7 +726,7 @@ export default function DeviceOverviewPage() {
|
||||
},
|
||||
{
|
||||
title: t('devices.mowingRobot'),
|
||||
icon: <CarOutlined style={{ color: '#722ED1', fontSize: 24 }} />,
|
||||
icon: <CarOutlined className="device-overview-top-icon-purple" />,
|
||||
value: `${totalRobots} ${t('devices.UnitsRobot')}`,
|
||||
sub: `${t('devices.executing')} ${activeMowers}`,
|
||||
color: '#722ED1',
|
||||
@@ -724,7 +734,7 @@ export default function DeviceOverviewPage() {
|
||||
},
|
||||
{
|
||||
title: t('devices.washDrone'),
|
||||
icon: <CloudOutlined style={{ color: '#eb2f96', fontSize: 24 }} />,
|
||||
icon: <CloudOutlined className="device-overview-top-icon-pink" />,
|
||||
value: `${totalDrones} ${t('devices.UnitsDrone')}`,
|
||||
sub: `${t('devices.waiting')} ${washDroneStandby}`,
|
||||
color: '#eb2f96',
|
||||
@@ -732,7 +742,7 @@ export default function DeviceOverviewPage() {
|
||||
},
|
||||
{
|
||||
title: t('devices.todayTaskExecute'),
|
||||
icon: <CheckCircleOutlined style={{ color: '#2f54eb', fontSize: 24 }} />,
|
||||
icon: <CheckCircleOutlined className="device-overview-top-icon-indigo" />,
|
||||
value: `${completedTasks} / ${totalTasks}`,
|
||||
sub: `${t('devices.completionRate')} ${completionRate}%`,
|
||||
color: '#2f54eb',
|
||||
@@ -833,46 +843,35 @@ export default function DeviceOverviewPage() {
|
||||
}, [selectedDevice]);
|
||||
|
||||
return (
|
||||
<div style={{ background: '#f5f7fa', minHeight: '100%' }}>
|
||||
<div style={{ padding: '4px 0px 8px' }}>
|
||||
<Typography.Title level={4} style={{ margin: 0, fontSize: 'clamp(14px, 1.2vw, 18px)' }}>{t('devices.fixed2Equipment')}</Typography.Title>
|
||||
<div className="device-overview-page">
|
||||
<div className="device-overview-title-wrap">
|
||||
<Typography.Title level={4} className="device-overview-title">{t('devices.fixed2Equipment')}</Typography.Title>
|
||||
</div>
|
||||
<Content style={{ margin: '0 8', }}>
|
||||
<Row gutter={[12, 12]} style={{ marginBottom: 8, flexWrap: 'wrap' }}>
|
||||
<Content className="device-overview-content">
|
||||
<Row gutter={[12, 12]} className="device-overview-top-row">
|
||||
{dynamicTopCards.map((card, idx) => (
|
||||
<Col key={idx} style={{ minWidth: '200px', flex: '1 0 auto', maxWidth: "260px" }}>
|
||||
<Col key={idx} className="device-overview-top-col">
|
||||
<Card
|
||||
variant="borderless"
|
||||
styles={{ body: { padding: '20px 20px', display: 'flex', alignItems: 'flex-start', justifyContent: 'space-between' } }}
|
||||
style={{ borderRadius: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)', height: 101 }}
|
||||
className="device-overview-stat-card"
|
||||
>
|
||||
{/* 左侧文字区域 */}
|
||||
<div style={{ flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'flex-start' }}>
|
||||
<div style={{ fontSize: 14, color: '#86909C', marginBottom: 8, fontWeight: 500 }}>
|
||||
<div className="device-overview-stat-info">
|
||||
<div className="device-overview-stat-title">
|
||||
{card.title}
|
||||
</div>
|
||||
<div style={{ fontSize: 28, fontWeight: 700, color: card.color, lineHeight: 1, marginBottom: 8 }}>
|
||||
<div className="device-overview-stat-value" style={{ '--card-color': card.color } as React.CSSProperties}>
|
||||
{card.value}
|
||||
</div>
|
||||
{/* 底部环比/备注 */}
|
||||
{card.sub && <div style={{ fontSize: 12, color: '#86909C', fontWeight: 500 }}>
|
||||
{card.sub && <div className="device-overview-stat-sub">
|
||||
{card.sub}
|
||||
</div>}
|
||||
</div>
|
||||
|
||||
{/* 右侧圆形图标区域 */}
|
||||
<div
|
||||
style={{
|
||||
width: 48,
|
||||
height: 48,
|
||||
borderRadius: '50%',
|
||||
backgroundColor: card.iconBg || '#f0f7ff',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
flexShrink: 0,
|
||||
marginLeft: 8
|
||||
}}
|
||||
className="device-overview-stat-icon" style={{ '--icon-bg': card.iconBg || '#f0f7ff' } as React.CSSProperties}
|
||||
>
|
||||
{card.icon}
|
||||
</div>
|
||||
@@ -883,8 +882,8 @@ export default function DeviceOverviewPage() {
|
||||
|
||||
<Row gutter={[8, 8]}>
|
||||
<Col xs={24} lg={14}>
|
||||
<Card title={<><EnvironmentOutlined />{t('devices.fixed2Equipment')}</>} extra={<Button type="text" icon={<SettingOutlined />} />} variant="borderless" style={{ borderRadius: 8, marginBottom: 8 }} styles={{ body: { padding: 0 } }}>
|
||||
<div style={{ width: '100%', height: 350, borderRadius: 8, position: 'relative', overflow: 'hidden' }}>
|
||||
<Card title={<><EnvironmentOutlined />{t('devices.fixed2Equipment')}</>} extra={<Button type="text" icon={<SettingOutlined />} />} variant="borderless" className="device-overview-card device-overview-map-card">
|
||||
<div className="device-overview-map-container">
|
||||
{/*<div style={{ position: 'absolute', zIndex: 11, top: 12, left: 12, background: 'rgba(255,255,255,0.95)', borderRadius: 6, padding: 8 }}>
|
||||
<div style={{ fontSize: 11, fontWeight: 60, marginBottom: 4 }}>{t('devices.s22')}</div>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 4, fontSize: 10 }}>
|
||||
@@ -901,7 +900,7 @@ export default function DeviceOverviewPage() {
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Card title={<><SettingOutlined />{t('devices.fixed2EquipmentListFixed2')}</>} extra={<Button type="text" icon={<ReloadOutlined />} onClick={fetchAllData} />} variant="borderless" style={{ borderRadius: 8, marginBottom: 8 }}>
|
||||
<Card title={<><SettingOutlined />{t('devices.fixed2EquipmentListFixed2')}</>} extra={<Button type="text" icon={<ReloadOutlined />} onClick={fetchAllData} />} variant="borderless" className="device-overview-card">
|
||||
<Table rowKey={(record) => record.id || record.serialNumber || record.device_sn} size="small" pagination={false}
|
||||
columns={[
|
||||
{ title: t('devices.fixed2EquipmentFixed2NameFixed2'), dataIndex: 'name', width: 180 },
|
||||
@@ -931,7 +930,7 @@ export default function DeviceOverviewPage() {
|
||||
if (text == '2') color = 'success';
|
||||
if (text == '3') color = 'default'; // default 就是灰色标签
|
||||
|
||||
return <Tag color={color} style={{ margin: 0 }}>
|
||||
return <Tag color={color} className="device-overview-tag-flat">
|
||||
{text == '1' ? "工作中" : text == '2' ? "空闲中" : "离线"}
|
||||
</Tag>;
|
||||
|
||||
@@ -987,14 +986,14 @@ export default function DeviceOverviewPage() {
|
||||
scroll={{ x: 'max-content', y: 280 }}
|
||||
/>
|
||||
</Card>
|
||||
<Row wrap={false} gutter={16} style={{ width: '100%' }}>
|
||||
<Row wrap={false} gutter={16} className="device-overview-panels-row">
|
||||
<Col flex="1 1 0">
|
||||
<Card
|
||||
title={<>
|
||||
<SettingOutlined /> <span>{t('devices.TaskLog')}</span>
|
||||
</>}
|
||||
variant="borderless"
|
||||
style={{ borderRadius: 8, height: '100%' }}
|
||||
className="device-overview-panel-card"
|
||||
|
||||
>
|
||||
<Table
|
||||
@@ -1004,8 +1003,8 @@ export default function DeviceOverviewPage() {
|
||||
dataSource={taskList}
|
||||
scroll={{ x: 'max-content' }}
|
||||
columns={[
|
||||
{ title: t('common.createTime'), dataIndex: 'startTime', width: 90, render: (v) => <span style={{ fontSize: 13 }}>{v}</span> },
|
||||
{ title: t('devices.deviceId'), dataIndex: 'deviceId', width: 100, render: (v) => <span style={{ fontSize: 13 }}>{v}</span> },
|
||||
{ title: t('common.createTime'), dataIndex: 'startTime', width: 90, render: (v) => <span className="device-overview-text-13">{v}</span> },
|
||||
{ title: t('devices.deviceId'), dataIndex: 'deviceId', width: 100, render: (v) => <span className="device-overview-text-13">{v}</span> },
|
||||
|
||||
{
|
||||
title: t('devices.executionPlan'),
|
||||
@@ -1068,8 +1067,8 @@ export default function DeviceOverviewPage() {
|
||||
{ title: t('devices.taskName'), dataIndex: 'planName' },
|
||||
]}
|
||||
/>
|
||||
<div style={{ textAlign: 'center', marginTop: 8 }}>
|
||||
<Button type="link" size="small" style={{ fontSize: 13, color: '#1890ff' }} onClick={() => navigate('/devices/robotTask')}>
|
||||
<div className="device-overview-more">
|
||||
<Button type="link" size="small" className="device-overview-more-btn" onClick={() => navigate('/devices/robotTask')}>
|
||||
{t('devices.viewMoreLogs')}
|
||||
</Button>
|
||||
</div>
|
||||
@@ -1081,7 +1080,7 @@ export default function DeviceOverviewPage() {
|
||||
<SettingOutlined /> <span>{t('devices.AlertRecord')}</span>
|
||||
</>}
|
||||
variant="borderless"
|
||||
style={{ borderRadius: 8, height: '100%' }}
|
||||
className="device-overview-panel-card"
|
||||
|
||||
>
|
||||
<Table
|
||||
@@ -1095,14 +1094,14 @@ export default function DeviceOverviewPage() {
|
||||
title: t('common.time'),
|
||||
dataIndex: 'alarmTime',
|
||||
width: 145,
|
||||
render: (v) => <span style={{ fontSize: 12, whiteSpace: 'nowrap' }}>{formatAlarmTime(v) || '-'}</span>
|
||||
render: (v) => <span className="device-overview-time-nowrap">{formatAlarmTime(v) || '-'}</span>
|
||||
},
|
||||
{
|
||||
title: t('devices.device'),
|
||||
dataIndex: 'deviceName',
|
||||
width: 110,
|
||||
ellipsis: true,
|
||||
render: (v, record) => <span style={{ fontSize: 12 }}>{record?.deviceAlias || record?.deviceId || v || '-'}</span>
|
||||
render: (v, record) => <span className="device-overview-text-12">{record?.deviceAlias || record?.deviceId || v || '-'}</span>
|
||||
},
|
||||
{
|
||||
title: t('alerts.alarmTitle'),
|
||||
@@ -1112,7 +1111,7 @@ export default function DeviceOverviewPage() {
|
||||
const text = getAlarmTitleText(record);
|
||||
return (
|
||||
<Tooltip title={text}>
|
||||
<span style={{ fontSize: 12 }}>{text || '-'}</span>
|
||||
<span className="device-overview-text-12">{text || '-'}</span>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
@@ -1126,17 +1125,17 @@ export default function DeviceOverviewPage() {
|
||||
title: t('alerts.handle'),
|
||||
width: 70,
|
||||
render: (_, record) => record?.handleStatus === 2
|
||||
? <Tag style={{ fontSize: 11, margin: 0 }}>{t('alerts.handled')}</Tag>
|
||||
? <Tag className="device-overview-handled-tag">{t('alerts.handled')}</Tag>
|
||||
: (
|
||||
<Button type="link" size="small" style={{ padding: 0, fontSize: 12 }} onClick={() => handleAlarmItem(record)}>
|
||||
<Button type="link" size="small" className="device-overview-handle-btn" onClick={() => handleAlarmItem(record)}>
|
||||
{t('alerts.handle')}
|
||||
</Button>
|
||||
)
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<div style={{ textAlign: 'center', marginTop: 8 }}>
|
||||
<Button type="link" size="small" style={{ fontSize: 13, color: '#1890ff' }} onClick={() => navigate('/alerts/all')}>
|
||||
<div className="device-overview-more">
|
||||
<Button type="link" size="small" className="device-overview-more-btn" onClick={() => navigate('/alerts/all')}>
|
||||
{t('devices.viewMoreLogs')}
|
||||
</Button>
|
||||
</div>
|
||||
@@ -1149,9 +1148,9 @@ export default function DeviceOverviewPage() {
|
||||
|
||||
<Col xs={24} lg={10}>
|
||||
|
||||
<Card title={<><SettingOutlined style={{ marginRight: 6, }} />{t('devices.deviceControlPanel')}</>} variant="borderless" style={{ borderRadius: 8, marginBottom: 8 }} styles={{ body: { padding: 12, paddingBottom: 0 } }}>
|
||||
<Card title={<><SettingOutlined className="device-overview-control-title-icon" />{t('devices.deviceControlPanel')}</>} variant="borderless" className="device-overview-card device-overview-control-card">
|
||||
<Select
|
||||
style={{ width: "80%", marginBottom: 8 }}
|
||||
className="device-overview-device-select"
|
||||
placeholder={t('workOrder.selectDeviceFixed2')}
|
||||
value={selectedDevice?.device_sn || selectedDevice?.serialNumber}
|
||||
onChange={handleDeviceChange}
|
||||
@@ -1171,85 +1170,85 @@ export default function DeviceOverviewPage() {
|
||||
{selectedDevice && (
|
||||
<Row gutter={8}>
|
||||
<Col span={12}>
|
||||
<div style={{ marginBottom: 12 }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6, marginBottom: 12, flexWrap: "wrap" }}>
|
||||
<div className="device-overview-block-12">
|
||||
<div className="device-overview-device-head">
|
||||
{String(selectedDevice.deviceType || '').toUpperCase() === 'U' || selectedDevice.deviceName?.includes(t('constants.uav')) || selectedDevice.drone_callsign ? (
|
||||
<span style={{ fontSize: 20, color: '#1890ff' }}><RocketOutlined /></span>
|
||||
<span className="device-overview-device-type-icon"><RocketOutlined /></span>
|
||||
) : (
|
||||
<span style={{ fontSize: 20, color: '#1890ff' }}><CarOutlined /></span>
|
||||
<span className="device-overview-device-type-icon"><CarOutlined /></span>
|
||||
)}
|
||||
<span style={{ fontSize: 14, fontWeight: 600 }}>{selectedDevice.deviceAlias || selectedDevice.drone_callsign || selectedDevice.callsign || selectedDevice.deviceName}</span>
|
||||
<Tag color={realtimeDevice.status == 1 || realtimeDevice.status == 2 ? "success" : "default"} size="small" style={{ margin: 0 }}>
|
||||
<span className="device-overview-device-name">{selectedDevice.deviceAlias || selectedDevice.drone_callsign || selectedDevice.callsign || selectedDevice.deviceName}</span>
|
||||
<Tag color={realtimeDevice.status == 1 || realtimeDevice.status == 2 ? "success" : "default"} size="small" className="device-overview-tag-flat">
|
||||
{realtimeDevice.status == 1 || realtimeDevice.status == 2 ? t('devices.online') : t('devices.offline')}
|
||||
</Tag>
|
||||
<Button
|
||||
type="primary" size="small" ghost icon={<InfoCircleOutlined />}
|
||||
style={{ borderRadius: 4, fontSize: 11, marginLeft: 'auto' }}
|
||||
className="device-overview-detail-btn"
|
||||
onClick={() => onViewStatus(selectedDevice.device_sn || selectedDevice.serialNumber)}
|
||||
>{t('common.detail')}</Button>
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 4 }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
|
||||
<span style={{ color: '#52c41a' }}><ThunderboltOutlined /></span>
|
||||
<span style={{ fontSize: 12 }}>{t('devices.batteryLevel')}: {fix2(realtimeDevice?.battery)}%</span>
|
||||
<div className="device-overview-stats-row">
|
||||
<div className="device-overview-stat-cell">
|
||||
<span className="device-overview-battery-icon"><ThunderboltOutlined /></span>
|
||||
<span className="device-overview-text-12">{t('devices.batteryLevel')}: {fix2(realtimeDevice?.battery)}%</span>
|
||||
</div>
|
||||
{realtimeDevice?.environment_temperature && (
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
||||
<span style={{ fontSize: 12 }}>{t('home.temperature')}</span>
|
||||
<span style={{ color: '#faad14' }}>{formatTemperature(Number(realtimeDevice.environment_temperature || 25), 1).label}</span>
|
||||
<div className="device-overview-temp-cell">
|
||||
<span className="device-overview-text-12">{t('home.temperature')}</span>
|
||||
<span className="device-overview-temp-value">{formatTemperature(Number(realtimeDevice.environment_temperature || 25), 1).label}</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 6, marginBottom: 12, maxHeight: "160px", overflow: "auto", scrollbarWidth: 'thin', scrollbarColor: '#ccc transparent' }}>
|
||||
<div className="device-overview-detail-list">
|
||||
{selectedDevice.productName && (
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#666', fontSize: 12 }}>{t('devices.productType')}</span>
|
||||
<span style={{ fontSize: 12 }}>{getVal(selectedDevice.productName)}</span>
|
||||
<div className="device-overview-detail-row">
|
||||
<span className="device-overview-label-12">{t('devices.productType')}</span>
|
||||
<span className="device-overview-text-12">{getVal(selectedDevice.productName)}</span>
|
||||
</div>
|
||||
)}
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', gap: 8 }}>
|
||||
<span style={{ color: '#666', fontSize: 12, whiteSpace: 'nowrap' }}>{t('systemSetting.fixed2DeviceSn')}</span>
|
||||
<span style={{ fontSize: 12, wordBreak: 'break-all', whiteSpace: 'normal', textAlign: 'right', maxWidth: '70%' }}>
|
||||
<div className="device-overview-detail-row-top">
|
||||
<span className="device-overview-label-nowrap">{t('systemSetting.fixed2DeviceSn')}</span>
|
||||
<span className="device-overview-sn-value">
|
||||
{getVal(selectedDevice.device_sn || selectedDevice.serialNumber)}
|
||||
</span>
|
||||
</div>
|
||||
{selectedDevice.activeTime && (
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#666', fontSize: 12 }}>{t('devices.timeFixed2')}</span>
|
||||
<span style={{ fontSize: 12 }}>{selectedDevice.activeTime}</span>
|
||||
<div className="device-overview-detail-row">
|
||||
<span className="device-overview-label-12">{t('devices.timeFixed2')}</span>
|
||||
<span className="device-overview-text-12">{selectedDevice.activeTime}</span>
|
||||
</div>
|
||||
)}
|
||||
{selectedDevice.firmwareVersion && (
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#666', fontSize: 12 }}>{t('devices.firmwareVersion')}</span>
|
||||
<span style={{ fontSize: 12 }}>v{selectedDevice.firmwareVersion}</span>
|
||||
<div className="device-overview-detail-row">
|
||||
<span className="device-overview-label-12">{t('devices.firmwareVersion')}</span>
|
||||
<span className="device-overview-text-12">v{selectedDevice.firmwareVersion}</span>
|
||||
</div>
|
||||
)}
|
||||
{selectedDevice.deviceType && (
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#666', fontSize: 12 }}>{t('devices.deviceType')}</span>
|
||||
<span style={{ fontSize: 12 }}>{selectedDevice.deviceType}</span>
|
||||
<div className="device-overview-detail-row">
|
||||
<span className="device-overview-label-12">{t('devices.deviceType')}</span>
|
||||
<span className="device-overview-text-12">{selectedDevice.deviceType}</span>
|
||||
</div>
|
||||
)}
|
||||
{(selectedDevice.productName?.includes(t('constants.uav')) || selectedDevice.device_sn) && (
|
||||
<>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#666', fontSize: 12 }}>{t('devices.flightAltitude')}</span>
|
||||
<span style={{ fontSize: 12 }}>{fix2(realtimeDevice?.height)} m</span>
|
||||
<div className="device-overview-detail-row">
|
||||
<span className="device-overview-label-12">{t('devices.flightAltitude')}</span>
|
||||
<span className="device-overview-text-12">{fix2(realtimeDevice?.height)} m</span>
|
||||
</div>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#666', fontSize: 12 }}>{t('devices.s21')}</span>
|
||||
<span style={{ fontSize: 12 }}>{fix2(realtimeDevice?.wind_speed)} m/s</span>
|
||||
<div className="device-overview-detail-row">
|
||||
<span className="device-overview-label-12">{t('devices.s21')}</span>
|
||||
<span className="device-overview-text-12">{fix2(realtimeDevice?.wind_speed)} m/s</span>
|
||||
</div>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<span style={{ color: '#666', fontSize: 12 }}>{t('devices.rtkQuantityFixed2')}</span>
|
||||
<span style={{ fontSize: 12 }}>
|
||||
<div className="device-overview-detail-row">
|
||||
<span className="device-overview-label-12">{t('devices.rtkQuantityFixed2')}</span>
|
||||
<span className="device-overview-text-12">
|
||||
<Badge
|
||||
showZero={true}
|
||||
count={realtimeDevice?.position_state?.rtk_number || 0}
|
||||
style={{ backgroundColor: '#52c41a', transform: 'scale(0.8)' }}
|
||||
className="device-overview-rtk-badge"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
@@ -1257,10 +1256,10 @@ export default function DeviceOverviewPage() {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', justifyContent: "space-between", flexWrap: 'wrap', gap: 6 }}>
|
||||
<div className="device-overview-action-row">
|
||||
{/*<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 type="primary" className="device-overview-action-btn" onClick={handleAutoBack}>{t('devices.returnHome')}</Button>
|
||||
{/*<Button style={{ flex: 1, background: '#52c41a', borderColor: '#52c41a', color: "#fff", borderRadius: 8, }} onClick={handleRecharge}>{t('devices.s24')}</Button>*/}
|
||||
<Button danger={!eStopActive} type={eStopActive ? 'primary' : 'default'} style={{ flex: 1, borderRadius: 8, background: eStopActive ? '#cf1322' : undefined, borderColor: eStopActive ? '#cf1322' : undefined, color: eStopActive ? '#fff' : undefined }} onClick={handleEmergencyStop}>{eStopActive ? t('devices.estopTriggered') : t('devices.s29')}</Button>
|
||||
|
||||
@@ -1269,11 +1268,11 @@ export default function DeviceOverviewPage() {
|
||||
</Col>
|
||||
|
||||
<Col span={12}>
|
||||
<div style={{ marginBottom: 8 }}>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 4 }}>
|
||||
<span style={{ fontSize: 14, fontWeight: 500, color: "#666" }}>{t('devices.s25')}</span>
|
||||
<div className="device-overview-block-8">
|
||||
<div className="device-overview-video-head">
|
||||
<span className="device-overview-video-title">{t('devices.s25')}</span>
|
||||
{!isUAV && robotPlayActive && (
|
||||
<div style={{ textAlign: 'right' }}>
|
||||
<div className="device-overview-video-stop">
|
||||
<Button
|
||||
size="small"
|
||||
danger
|
||||
@@ -1287,7 +1286,7 @@ export default function DeviceOverviewPage() {
|
||||
{isUAV && (
|
||||
<Select
|
||||
size="small"
|
||||
style={{ width: 120 }}
|
||||
className="device-overview-video-source-select"
|
||||
value={videoSource}
|
||||
onChange={setVideoSource}
|
||||
options={[
|
||||
@@ -1299,7 +1298,7 @@ export default function DeviceOverviewPage() {
|
||||
</div>
|
||||
|
||||
{/* ✅ 关键:videoDevice 绝不随MQTT更新,视频永不闪烁 */}
|
||||
<div style={{ width: '100%', height: 160, borderRadius: 8, position: 'relative', overflow: 'hidden', background: '#000' }}>
|
||||
<div className="device-overview-video-box">
|
||||
{isUAV ? (
|
||||
<DroneVideoPlayer
|
||||
device={videoDevice}
|
||||
@@ -1311,7 +1310,7 @@ export default function DeviceOverviewPage() {
|
||||
) : (
|
||||
robotPlayActive ? (
|
||||
selectedDevice?.hasHost ? (
|
||||
<div style={{ width: '100%', height: '100%', position: 'relative', overflow: 'hidden', background: '#000', borderRadius: 8 }}>
|
||||
<div className="device-overview-video-inner">
|
||||
<AgrtcRoomRobot CHANNEL={selectedDevice?.serialNumber || ''} />
|
||||
</div>
|
||||
) : robotVideo ? (
|
||||
@@ -1324,34 +1323,16 @@ export default function DeviceOverviewPage() {
|
||||
ready={ready}
|
||||
/>
|
||||
) : (
|
||||
<div style={{ color: '#ccc', display: 'flex', height: '100%', alignItems: 'center', justifyContent: 'center' }}>{t('video.videoLoading')}</div>
|
||||
<div className="device-overview-video-loading">{t('video.videoLoading')}</div>
|
||||
)
|
||||
) : (
|
||||
// ========== 未点击播放时:显示播放大按钮 ==========
|
||||
<div
|
||||
onClick={() => setRobotPlayActive(true)}
|
||||
style={{
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
cursor: 'pointer',
|
||||
background: '#000',
|
||||
}}
|
||||
className="device-overview-play-overlay"
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
width: 48,
|
||||
height: 48,
|
||||
borderRadius: '50%',
|
||||
background: 'rgba(255,255,255,0.25)',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
color: '#fff',
|
||||
fontSize: 22,
|
||||
}}
|
||||
className="device-overview-play-btn"
|
||||
>
|
||||
▶
|
||||
</div>
|
||||
@@ -1363,7 +1344,7 @@ export default function DeviceOverviewPage() {
|
||||
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap' }}>
|
||||
<div className="device-overview-manual-row">
|
||||
{/*<Button size="large" style={{ flex: 1, borderRadius: 8 }}>{t('devices.switchManual')}</Button>*/}
|
||||
</div>
|
||||
</Col>
|
||||
@@ -1402,30 +1383,30 @@ export default function DeviceOverviewPage() {
|
||||
</Card>*/}
|
||||
|
||||
{(selectedDevice?.productName?.includes(t('constants.uav')) || selectedDevice?.device_sn) && (
|
||||
<Card title={t('devices.s60')} variant="borderless" style={{ borderRadius: 12, marginBottom: 8 }}>
|
||||
<div style={{ display: "flex", justifyContent: "space-between", gap: 12, alignItems: "center" }}>
|
||||
<div style={{ display: "flex", border: "1px solid #e8e8e8", borderRadius: 12, overflow: "hidden", flex: 1 }}>
|
||||
<div style={{ flex: 1, textAlign: 'center', whiteSpace: "nowrap", padding: "12px 4px", borderRight: "1px solid #e8e8e8" }}><div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>{t('devices.s44')}</div><div style={{ fontSize: 14, fontWeight: 700, color: '#222', marginTop: 2 }}>{fix2(realtimeDevice?.wind_speed)} m/s</div></div>
|
||||
<div style={{ flex: 1, textAlign: 'center', whiteSpace: "nowrap", padding: "12px 4px", borderRight: "1px solid #e8e8e8" }}><div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>{t('home.temperature')}</div><div style={{ fontSize: 14, fontWeight: 700, color: '#222', marginTop: 2 }}>{formatTemperature(Number(realtimeDevice?.environment_temperature || 0), 1).label}</div></div>
|
||||
<div style={{ flex: 1, textAlign: 'center', whiteSpace: "nowrap", padding: "12px 4px", borderRight: "1px solid #e8e8e8" }}><div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>{t('devices.rainfall')}</div><div style={{ fontSize: 14, fontWeight: 700, color: '#222', marginTop: 2 }}>{getVal(realtimeDevice?.rainfall)}</div></div>
|
||||
<div style={{ flex: 1, textAlign: 'center', whiteSpace: "nowrap", padding: "12px 4px" }}><div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>RTK</div><div style={{ fontSize: 14, fontWeight: 700, color: '#52c41a', marginTop: 2 }}>{realtimeDevice?.position_state?.is_fixed === 'fixing_successful' ? '固定' : '未固定'}</div></div>
|
||||
<Card title={t('devices.s60')} variant="borderless" className="device-overview-weather-card">
|
||||
<div className="device-overview-weather-body">
|
||||
<div className="device-overview-weather-grid">
|
||||
<div className="device-overview-weather-cell"><div className="device-overview-weather-cell-label">{t('devices.s44')}</div><div className="device-overview-weather-cell-value">{fix2(realtimeDevice?.wind_speed)} m/s</div></div>
|
||||
<div className="device-overview-weather-cell"><div className="device-overview-weather-cell-label">{t('home.temperature')}</div><div className="device-overview-weather-cell-value">{formatTemperature(Number(realtimeDevice?.environment_temperature || 0), 1).label}</div></div>
|
||||
<div className="device-overview-weather-cell"><div className="device-overview-weather-cell-label">{t('devices.rainfall')}</div><div className="device-overview-weather-cell-value">{getVal(realtimeDevice?.rainfall)}</div></div>
|
||||
<div className="device-overview-weather-cell-last"><div className="device-overview-weather-cell-label">RTK</div><div className="device-overview-weather-cell-value-good">{realtimeDevice?.position_state?.is_fixed === 'fixing_successful' ? '固定' : '未固定'}</div></div>
|
||||
</div>
|
||||
<div style={{ width: 110, padding: '12px 4px', borderRadius: 8, background: '#f6ffed', border: '1px solid #b7eb8f', textAlign: 'center', display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 4 }}>
|
||||
<div className="device-overview-weather-good">
|
||||
<div className="flex items-center gap-1">
|
||||
<div style={{ fontSize: 12, fontWeight: 700, color: '#52c41a' }}>{t('devices.suitableExec')}</div>
|
||||
<div style={{ width: 18, height: 18, borderRadius: '50%', background: '#52c41a', display: 'flex', alignItems: 'center', justifyContent: 'center' }}><CheckCircleOutlined style={{ fontSize: 12, color: '#fff' }} /></div>
|
||||
<div className="device-overview-weather-good-title">{t('devices.suitableExec')}</div>
|
||||
<div className="device-overview-weather-good-icon"><CheckCircleOutlined className="device-overview-weather-good-icon-mark" /></div>
|
||||
</div>
|
||||
<div style={{ fontSize: 11, color: '#666' }}>{t('devices.normal')}</div>
|
||||
<div className="device-overview-weather-good-sub">{t('devices.normal')}</div>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{(!selectedDevice?.productName?.includes(t('constants.uav')) && !selectedDevice?.device_sn) && (
|
||||
<Card title={<div style={{ display: 'flex', alignItems: 'center', gap: 8, fontSize: 14, fontWeight: 600 }}><RobotOutlined style={{ color: '#165DFF' }} />{t('devices.fixed2RobotStatusFixed2')}</div>} variant="borderless" style={{ borderRadius: 12, marginBottom: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)', border: '1px solid #f0f0f0' }}>
|
||||
<Row gutter={16} style={{ alignItems: 'center' }}>
|
||||
<Card title={<div className="device-overview-robot-title"><RobotOutlined className="device-overview-robot-title-icon" />{t('devices.fixed2RobotStatusFixed2')}</div>} variant="borderless" className="device-overview-robot-card">
|
||||
<Row gutter={16} className="device-overview-robot-stats">
|
||||
<Col span={8}>
|
||||
<div style={{ padding: '12px 16px', borderRadius: 10, background: '#F7F8FA', textAlign: 'center', border: '1px solid transparent', transition: 'all 0.2s' }}
|
||||
<div className="device-overview-robot-stat"
|
||||
onMouseEnter={e => {
|
||||
e.currentTarget.style.background = '#E8F3FF';
|
||||
e.currentTarget.style.borderColor = '#165DFF';
|
||||
@@ -1435,16 +1416,15 @@ export default function DeviceOverviewPage() {
|
||||
e.currentTarget.style.borderColor = 'transparent';
|
||||
}}
|
||||
>
|
||||
<Statistic
|
||||
title={<span style={{ fontSize: 11, color: '#666666', fontWeight: 400 }}>{t('devices.statTotalDistance')}(m)</span>}
|
||||
<Statistic className="device-overview-robot-statistic"
|
||||
title={<span className="device-overview-robot-stat-title">{t('devices.statTotalDistance')}(m)</span>}
|
||||
value={deviceStatistics?.distance ? Number(deviceStatistics.distance).toFixed(2) : Number(deviceStatistics?.workArea / 0.7 || 0).toFixed(2)}
|
||||
suffix=""
|
||||
valueStyle={{ fontSize: 20, fontWeight: 700, color: '#165DFF', marginTop: 4 }}
|
||||
/>
|
||||
</div>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<div style={{ padding: '12px 16px', borderRadius: 10, background: '#F7F8FA', textAlign: 'center', border: '1px solid transparent', transition: 'all 0.2s' }}
|
||||
<div className="device-overview-robot-stat"
|
||||
onMouseEnter={e => {
|
||||
e.currentTarget.style.background = '#E8F3FF';
|
||||
e.currentTarget.style.borderColor = '#165DFF';
|
||||
@@ -1454,16 +1434,15 @@ export default function DeviceOverviewPage() {
|
||||
e.currentTarget.style.borderColor = 'transparent';
|
||||
}}
|
||||
>
|
||||
<Statistic
|
||||
title={<span style={{ fontSize: 11, color: '#666666', fontWeight: 400 }}>{t('devices.s50')}(㎡)</span>}
|
||||
<Statistic className="device-overview-robot-statistic"
|
||||
title={<span className="device-overview-robot-stat-title">{t('devices.s50')}(㎡)</span>}
|
||||
value={Number(deviceStatistics?.workArea || 0).toFixed(2)}
|
||||
suffix=""
|
||||
valueStyle={{ fontSize: 20, fontWeight: 700, color: '#165DFF', marginTop: 4 }}
|
||||
/>
|
||||
</div>
|
||||
</Col>
|
||||
<Col span={8}>
|
||||
<div style={{ padding: '12px 16px', borderRadius: 10, background: '#F7F8FA', textAlign: 'center', border: '1px solid transparent', transition: 'all 0.2s' }}
|
||||
<div className="device-overview-robot-stat"
|
||||
onMouseEnter={e => {
|
||||
e.currentTarget.style.background = '#E8F3FF';
|
||||
e.currentTarget.style.borderColor = '#165DFF';
|
||||
@@ -1474,10 +1453,14 @@ export default function DeviceOverviewPage() {
|
||||
}}
|
||||
>
|
||||
<Statistic
|
||||
title={<span style={{ fontSize: 11, color: '#666666', fontWeight: 400 }}>{t('devices.s51')}(min)</span>}
|
||||
value={Number(deviceStatistics?.time || 0).toFixed(2)}
|
||||
className="device-overview-robot-statistic"
|
||||
title={
|
||||
<span className="device-overview-robot-stat-title">
|
||||
{t('devices.s51')}
|
||||
</span>
|
||||
}
|
||||
value={formatTime(deviceStatistics?.time)}
|
||||
suffix=""
|
||||
valueStyle={{ fontSize: 20, fontWeight: 700, color: '#165DFF', marginTop: 4 }}
|
||||
/>
|
||||
</div>
|
||||
</Col>
|
||||
@@ -1485,21 +1468,21 @@ export default function DeviceOverviewPage() {
|
||||
</Card>
|
||||
)}
|
||||
|
||||
<Card title={<><ClockCircleOutlined />{t('devices.fixed2TaskSuspended2Fixed2ExecutionTime')}</>} variant="borderless" style={{ borderRadius: 12 }} extra={<div style={{ fontSize: 12, color: '#666' }}></div>}>
|
||||
<Card title={<><ClockCircleOutlined />{t('devices.fixed2TaskSuspended2Fixed2ExecutionTime')}</>} variant="borderless" className="device-overview-schedule-card" extra={<div className="device-overview-schedule-extra"></div>}>
|
||||
{taskPoolList.length > 0 ? (
|
||||
<Timeline mode="left">
|
||||
{taskPoolList.map((item, idx) => (
|
||||
<Timeline.Item key={idx} color={item.color} label={<div style={{ fontSize: 11, color: '#999' }}>{item.time}</div>}>
|
||||
<div style={{ fontSize: 13 }}>{item.text}</div>
|
||||
<div style={{ fontSize: 11, color: '#999' }}>{item.status}</div>
|
||||
<Timeline.Item key={idx} color={item.color} label={<div className="device-overview-timeline-label">{item.time}</div>}>
|
||||
<div className="device-overview-text-13">{item.text}</div>
|
||||
<div className="device-overview-timeline-label">{item.status}</div>
|
||||
</Timeline.Item>
|
||||
))}
|
||||
</Timeline>
|
||||
) : (
|
||||
<Empty description={t('common.noData')} style={{ marginTop: 100 }} />
|
||||
<Empty description={t('common.noData')} className="device-overview-empty" />
|
||||
)}
|
||||
|
||||
<div style={{ textAlign: 'center', marginTop: 12 }}><Button type="link" onClick={() => navigate('/devices/robotTask')}>{t('devices.viewMore')}</Button></div>
|
||||
<div className="device-overview-more-12"><Button type="link" onClick={() => navigate('/devices/robotTask')}>{t('devices.viewMore')}</Button></div>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
@@ -1514,19 +1497,19 @@ export default function DeviceOverviewPage() {
|
||||
maskClosable={false}
|
||||
>
|
||||
{currentEditRobot && (
|
||||
<div style={{ padding: '8px 0' }}>
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<div className="device-overview-edit-body">
|
||||
<div className="device-overview-edit-row">
|
||||
<Typography.Text strong>{t('devices.fixed2Fixed2DeviceSn')}</Typography.Text>
|
||||
<Typography.Text copyable>
|
||||
{currentEditRobot.device_sn || currentEditRobot.serialNumber}
|
||||
</Typography.Text>
|
||||
</div>
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<div className="device-overview-edit-row">
|
||||
<Typography.Text strong>{t('devices.fixed2DeviceType')}</Typography.Text>
|
||||
<Typography.Text>{currentEditRobot.productName || t('constants.locationUnknown')}</Typography.Text>
|
||||
</div>
|
||||
<div style={{ marginBottom: 8 }}>
|
||||
<Typography.Text strong>{t('devices.fixed2Device')}<span style={{ color: 'red' }}>*</span></Typography.Text>
|
||||
<div className="device-overview-block-8">
|
||||
<Typography.Text strong>{t('devices.fixed2Device')}<span className="device-overview-required-mark">*</span></Typography.Text>
|
||||
</div>
|
||||
<Input
|
||||
value={editAliasInput}
|
||||
@@ -1535,7 +1518,7 @@ export default function DeviceOverviewPage() {
|
||||
maxLength={30}
|
||||
allowClear
|
||||
/>
|
||||
<div style={{ marginTop: 8, fontSize: 12, color: '#999' }}>{t('devices.deviceListControlDeviceFixed2')}</div>
|
||||
<div className="device-overview-edit-hint">{t('devices.deviceListControlDeviceFixed2')}</div>
|
||||
</div>
|
||||
)}
|
||||
</Modal>
|
||||
|
||||
Reference in New Issue
Block a user