机器人设备状态布局修改
This commit is contained in:
@@ -994,7 +994,7 @@ export default function DeviceStatusPage({
|
||||
</Row>
|
||||
) : (
|
||||
// 机器人原布局
|
||||
<Row gutter={[16, 16]}>
|
||||
<Row gutter={[16, 16]} align="stretch">
|
||||
<Col xs={24} lg={16}>
|
||||
<Card
|
||||
title={
|
||||
@@ -1005,7 +1005,7 @@ export default function DeviceStatusPage({
|
||||
}
|
||||
bordered={false}
|
||||
style={{ borderRadius: 12, marginBottom: 8 }}
|
||||
bodyStyle={{ padding: 12 }}
|
||||
bodyStyle={{ padding: 12, height: 'calc(100vh - 220px)', minHeight: 500 }}
|
||||
>
|
||||
<Space style={{ marginBottom: 8 }}>
|
||||
<Button type={mowerView === 'front' ? 'primary' : 'default'} onClick={() => setMowerView('front')}>前视</Button>
|
||||
@@ -1015,7 +1015,13 @@ export default function DeviceStatusPage({
|
||||
<Button type={mowerView === 'all' ? 'primary' : 'default'} onClick={() => setMowerView('all')}>全景</Button>
|
||||
</Space>
|
||||
|
||||
<div style={{ borderRadius: 8, overflow: 'hidden', display: 'flex' }}>
|
||||
<div style={{
|
||||
borderRadius: 8,
|
||||
overflow: 'hidden',
|
||||
display: 'flex',
|
||||
height: 'calc(100% - 48px)',
|
||||
position: 'relative'
|
||||
}}>
|
||||
{robotVideo ? (
|
||||
mowerView === 'all' ? (
|
||||
<MowerAllView
|
||||
@@ -1023,28 +1029,92 @@ export default function DeviceStatusPage({
|
||||
robotVideo={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
statusData={runningStatus}
|
||||
/>
|
||||
) : (
|
||||
<VideoPlayer
|
||||
deviceId={serialNumber}
|
||||
idx={
|
||||
mowerView === 'front' ? 1
|
||||
: mowerView === 'back' ? 2
|
||||
: mowerView === 'left' ? 3
|
||||
: 4
|
||||
}
|
||||
className="w-full h-full object-contain"
|
||||
video={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
<div style={{ position: 'relative', width: '100%', height: '100%' }}>
|
||||
<VideoPlayer
|
||||
deviceId={serialNumber}
|
||||
idx={
|
||||
mowerView === 'front' ? 1
|
||||
: mowerView === 'back' ? 2
|
||||
: mowerView === 'left' ? 3
|
||||
: 4
|
||||
}
|
||||
className="w-full h-full object-contain"
|
||||
video={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
{/* 单视频模式状态叠加层 */}
|
||||
<div style={{
|
||||
position: 'absolute',
|
||||
top: 8,
|
||||
left: 8,
|
||||
background: 'rgba(0,0,0,0.7)',
|
||||
color: '#fff',
|
||||
padding: '10px 12px',
|
||||
borderRadius: 8,
|
||||
fontSize: 11,
|
||||
zIndex: 10,
|
||||
backdropFilter: 'blur(4px)'
|
||||
}}>
|
||||
<div style={{ marginBottom: 6, fontWeight: 600, color: '#1890ff' }}>机器人状态</div>
|
||||
<div style={{ display: 'grid', gridTemplateColumns: 'auto auto', gap: '3px 10px' }}>
|
||||
<span>电量:</span>
|
||||
<span style={{ color: (runningStatus.battery || 0) < 20 ? '#ff4d4f' : '#52c41a' }}>
|
||||
{runningStatus.battery !== undefined ? `${runningStatus.battery}%` : '-'}
|
||||
</span>
|
||||
<span>电压:</span>
|
||||
<span>{runningStatus.voltage !== undefined ? `${Number(runningStatus.voltage).toFixed(2)}V` : '-'}</span>
|
||||
<span>左电机:</span>
|
||||
<span>{runningStatus.leftCurrent !== undefined ? `${Number(runningStatus.leftCurrent).toFixed(2)}A` : '-'}</span>
|
||||
<span>右电机:</span>
|
||||
<span>{runningStatus.rightCurrent !== undefined ? `${Number(runningStatus.rightCurrent).toFixed(2)}A` : '-'}</span>
|
||||
<span>左速度:</span>
|
||||
<span>{runningStatus.leftMeasureSpeed !== undefined ? `${Number(runningStatus.leftMeasureSpeed).toFixed(1)}rpm` : '-'}</span>
|
||||
<span>右速度:</span>
|
||||
<span>{runningStatus.rightMeasureSpeed !== undefined ? `${Number(runningStatus.rightMeasureSpeed).toFixed(1)}rpm` : '-'}</span>
|
||||
<span>左温度:</span>
|
||||
<span>{runningStatus.leftMotorTemp !== undefined ? `${Number(runningStatus.leftMotorTemp).toFixed(1)}℃` : '-'}</span>
|
||||
<span>右温度:</span>
|
||||
<span>{runningStatus.rightMotorTemp !== undefined ? `${Number(runningStatus.rightMotorTemp).toFixed(1)}℃` : '-'}</span>
|
||||
<span>主控温度:</span>
|
||||
<span>{runningStatus.chipTemp !== undefined ? `${Number(runningStatus.chipTemp).toFixed(1)}℃` : '-'}</span>
|
||||
<span>航向角:</span>
|
||||
<span>{runningStatus.yaw !== undefined ? `${Number(runningStatus.yaw).toFixed(1)}°` : '-'}</span>
|
||||
<span>俯仰角:</span>
|
||||
<span>{runningStatus.pitch !== undefined ? `${Number(runningStatus.pitch).toFixed(1)}°` : '-'}</span>
|
||||
<span>定位:</span>
|
||||
<span>
|
||||
{runningStatus.qual == 0 ? '无效' :
|
||||
runningStatus.qual == 1 ? 'GPS单点' :
|
||||
runningStatus.qual == 2 ? 'DGPS差分' :
|
||||
runningStatus.qual == 4 ? 'RTK固定' :
|
||||
runningStatus.qual == 5 ? 'RTK浮点' : '未知'}
|
||||
</span>
|
||||
<span>卫星:</span>
|
||||
<span>{runningStatus.satelliteCnt || 0}颗</span>
|
||||
<span>模式:</span>
|
||||
<span>
|
||||
{runningStatus.controlMode == 1 ? '本地' :
|
||||
runningStatus.controlMode == 3 ? '远程' : '未知'}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
)
|
||||
) : (
|
||||
<div style={{ color: '#ccc', margin: 'auto' }}>视频加载中...</div>
|
||||
)}
|
||||
</div>
|
||||
</Card>
|
||||
</Col>
|
||||
|
||||
{/* 右边 - 占1格,上部地图,下部远程控制 */}
|
||||
<Col xs={24} lg={8} style={{ display: 'flex', flexDirection: 'column', }}>
|
||||
{/* 地图 */}
|
||||
<Card
|
||||
title={
|
||||
<>
|
||||
@@ -1076,8 +1146,8 @@ export default function DeviceStatusPage({
|
||||
</Space>
|
||||
}
|
||||
bordered={false}
|
||||
style={{ borderRadius: 12 }}
|
||||
bodyStyle={{ padding: 12, height: 400 }}
|
||||
style={{ borderRadius: 12, marginBottom: 8, flex: 1, minHeight: 280 }}
|
||||
bodyStyle={{ padding: 12, height: 'calc((100vh - 260px) / 2)', minHeight: 280 }}
|
||||
>
|
||||
<CesiumMap
|
||||
ref={mapRef}
|
||||
@@ -1093,54 +1163,8 @@ export default function DeviceStatusPage({
|
||||
from="deviceStatus"
|
||||
/>
|
||||
</Card>
|
||||
</Col>
|
||||
|
||||
<Col xs={24} lg={8}>
|
||||
<Card
|
||||
title={<><DashboardOutlined /> 机器人状态详情</>}
|
||||
bordered={false}
|
||||
style={{ borderRadius: 12, marginBottom: 8 }}
|
||||
extra={<Tag color={device.onlineStatus === 1 ? 'success' : 'default'}>{device.onlineStatus === 1 ? '在线' : '离线'}</Tag>}
|
||||
>
|
||||
<Descriptions column={2} size="small" layout="vertical">
|
||||
<Descriptions.Item label={<><ThunderboltOutlined /> 电池电量</>}>
|
||||
<Progress percent={runningStatus.battery || 0} size="small" status={(runningStatus.battery || 0) < 20 ? 'exception' : 'active'} />
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label={<><DashboardOutlined /> 系统电压</>}>
|
||||
<Text strong style={{ fontSize: 16 }}>{fix2(runningStatus.voltage)} V</Text>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="左电机电流"><Text>{fix2(runningStatus?.leftCurrent)} A</Text></Descriptions.Item>
|
||||
<Descriptions.Item label="右电机电流"><Text>{fix2(runningStatus?.rightCurrent)} A</Text></Descriptions.Item>
|
||||
<Descriptions.Item label="左轮速度"><Text>{fix2(runningStatus?.leftMeasureSpeed)} rpm</Text></Descriptions.Item>
|
||||
<Descriptions.Item label="右轮速度"><Text>{fix2(runningStatus?.rightMeasureSpeed)} rpm</Text></Descriptions.Item>
|
||||
<Descriptions.Item label="左电机温度"><Text>{fix2(runningStatus?.leftMotorTemp)} ℃</Text></Descriptions.Item>
|
||||
<Descriptions.Item label="右电机温度"><Text>{fix2(runningStatus?.rightMotorTemp)} ℃</Text></Descriptions.Item>
|
||||
<Descriptions.Item label="主控温度"><Text>{fix2(runningStatus?.chipTemp)} ℃</Text></Descriptions.Item>
|
||||
<Descriptions.Item label="航向角状态"><Text>{(runningStatus?.headingStatus == 1 ? "已初始化" : "未初始化")}</Text></Descriptions.Item>
|
||||
<Descriptions.Item label="控制模式"><Text>{(runningStatus?.controlMode == 1 ? "本地模式" : runningStatus?.controlMode == 3 ? "远程模式" : "控制模式")}</Text></Descriptions.Item>
|
||||
<Descriptions.Item label="定位质量">
|
||||
<Text>
|
||||
{runningStatus?.qual == 0
|
||||
? '无效'
|
||||
: runningStatus?.qual == 1
|
||||
? 'GPS 单点定位'
|
||||
: runningStatus?.qual == 2
|
||||
? 'DGPS 伪距差分或 SBAS'
|
||||
: runningStatus?.qual == 4
|
||||
? 'RTK 固定解'
|
||||
: runningStatus?.qual == 5
|
||||
? 'RTK 浮点解'
|
||||
: '未知'}
|
||||
</Text>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="卫星数量">
|
||||
<Badge showZero count={runningStatus?.satelliteCnt || 0} style={{ backgroundColor: '#52c41a' }} />
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="偏航角 (Yaw)"><Text>{fix2(runningStatus?.yaw)}°</Text></Descriptions.Item>
|
||||
<Descriptions.Item label="俯仰角 (Pitch)"><Text>{fix2(runningStatus?.pitch)}°</Text></Descriptions.Item>
|
||||
</Descriptions>
|
||||
</Card>
|
||||
|
||||
{/* 远程控制面板 */}
|
||||
<Card
|
||||
title={
|
||||
<>
|
||||
@@ -1149,9 +1173,9 @@ export default function DeviceStatusPage({
|
||||
</>
|
||||
}
|
||||
bordered={false}
|
||||
style={{ borderRadius: 12, background: '#0f172a' }}
|
||||
style={{ borderRadius: 12, background: '#0f172a', flex: 1, minHeight: 280, }}
|
||||
headStyle={{ color: '#fff' }}
|
||||
bodyStyle={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}
|
||||
bodyStyle={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: 'calc(100% - 57px)' }}
|
||||
>
|
||||
<XboxController
|
||||
onGamepadUpdate={handleGamepadUpdate}
|
||||
|
||||
@@ -1,123 +1,169 @@
|
||||
|
||||
import VideoPlayer from '../VideoPlayer.tsx';
|
||||
|
||||
export function MowerAllView({ serialNumber, robotVideo, error, ready }) {
|
||||
export function MowerAllView({ serialNumber, robotVideo, error, ready, statusData }) {
|
||||
return (
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
position: 'relative',
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
gap: 8, // 三列之间间距
|
||||
padding: 8,
|
||||
boxSizing: 'border-box',
|
||||
overflow: 'auto'
|
||||
overflow: 'hidden'
|
||||
}}>
|
||||
{/* ========== 左列:左视 ========== */}
|
||||
{/* 前视 - 铺满整个区域 */}
|
||||
<div style={{
|
||||
flex: 1,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: 8,
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
zIndex: 1
|
||||
}}>
|
||||
<div style={{
|
||||
flex: 1,
|
||||
position: 'relative',
|
||||
border: '1px solid #eae4e4',
|
||||
flexShrink: 0,
|
||||
borderRadius: 8,
|
||||
overflow: "hidden",
|
||||
maxHeight: 240,
|
||||
transform: 'translateY(50%)'
|
||||
|
||||
}}>
|
||||
<VideoPlayer
|
||||
deviceId={serialNumber}
|
||||
idx={3}
|
||||
className="w-full h-full object-contain"
|
||||
video={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
<div style={{ position: 'absolute', top: 4, left: 8, color: '#fff', fontSize: 12, background: '#0006', padding: '2px 6px', borderRadius: 4 }}>左视</div>
|
||||
</div>
|
||||
<VideoPlayer
|
||||
deviceId={serialNumber}
|
||||
idx={1}
|
||||
className="w-full h-full object-contain"
|
||||
video={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* ========== 中列:上-前视 下-后视 ========== */}
|
||||
{/* 左视 - 左上角 */}
|
||||
<div style={{
|
||||
flex: 1,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: 8,
|
||||
position: 'absolute',
|
||||
top: 8,
|
||||
left: 8,
|
||||
width: '25%',
|
||||
height: '30%',
|
||||
minWidth: 120,
|
||||
minHeight: 80,
|
||||
zIndex: 10,
|
||||
border: '1px solid #fff3',
|
||||
borderRadius: 8,
|
||||
overflow: 'hidden'
|
||||
}}>
|
||||
{/* 前视 */}
|
||||
<div style={{
|
||||
position: 'relative',
|
||||
border: '1px solid #eae4e4',
|
||||
flexShrink: 0,
|
||||
borderRadius: 8,
|
||||
overflow: "hidden",
|
||||
height: 240
|
||||
}}>
|
||||
<VideoPlayer
|
||||
deviceId={serialNumber}
|
||||
idx={1}
|
||||
className="w-full h-full object-contain"
|
||||
video={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
<div style={{ position: 'absolute', top: 4, left: 8, color: '#fff', fontSize: 12, background: '#0006', padding: '2px 6px', borderRadius: 4 }}>前视</div>
|
||||
</div>
|
||||
{/* 后视 */}
|
||||
<div style={{
|
||||
height: 240,
|
||||
position: 'relative',
|
||||
border: '1px solid #eae4e4',
|
||||
flexShrink: 0,
|
||||
borderRadius: 8,
|
||||
overflow: "hidden"
|
||||
}}>
|
||||
<VideoPlayer
|
||||
deviceId={serialNumber}
|
||||
idx={2}
|
||||
className="w-full h-full object-contain"
|
||||
video={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
<div style={{ position: 'absolute', top: 4, left: 8, color: '#fff', fontSize: 12, background: '#0006', padding: '2px 6px', borderRadius: 4 }}>后视</div>
|
||||
</div>
|
||||
<VideoPlayer
|
||||
deviceId={serialNumber}
|
||||
idx={3}
|
||||
className="w-full h-full object-contain"
|
||||
video={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
{/* 右视 - 右上角 */}
|
||||
<div style={{
|
||||
position: 'absolute',
|
||||
top: 8,
|
||||
right: 8,
|
||||
width: '25%',
|
||||
height: '30%',
|
||||
minWidth: 120,
|
||||
minHeight: 80,
|
||||
zIndex: 10,
|
||||
border: '1px solid #fff3',
|
||||
borderRadius: 8,
|
||||
overflow: 'hidden'
|
||||
}}>
|
||||
<VideoPlayer
|
||||
deviceId={serialNumber}
|
||||
idx={4}
|
||||
className="w-full h-full object-contain"
|
||||
video={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
{/* 后视 - 底部居中 */}
|
||||
<div style={{
|
||||
position: 'absolute',
|
||||
bottom: 8,
|
||||
left: '50%',
|
||||
transform: 'translateX(-50%)',
|
||||
width: '30%',
|
||||
height: '25%',
|
||||
minWidth: 150,
|
||||
minHeight: 80,
|
||||
zIndex: 10,
|
||||
border: '1px solid #fff3',
|
||||
borderRadius: 8,
|
||||
overflow: 'hidden'
|
||||
}}>
|
||||
<VideoPlayer
|
||||
deviceId={serialNumber}
|
||||
idx={2}
|
||||
className="w-full h-full object-contain"
|
||||
video={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div style={{
|
||||
flex: 1,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
gap: 8,
|
||||
}}>
|
||||
<div style={{
|
||||
flex: 1,
|
||||
position: 'relative',
|
||||
border: '1px solid #eae4e4',
|
||||
flexShrink: 0,
|
||||
borderRadius: 8,
|
||||
overflow: "hidden",
|
||||
maxHeight: 240,
|
||||
transform: 'translateY(50%)'
|
||||
|
||||
{/* 状态详情叠加层 */}
|
||||
{statusData && (
|
||||
<div style={{
|
||||
position: 'absolute',
|
||||
bottom: 8,
|
||||
left: 8,
|
||||
background: 'rgba(0,0,0,0.7)',
|
||||
color: '#fff',
|
||||
padding: '10px 12px',
|
||||
borderRadius: 8,
|
||||
fontSize: 11,
|
||||
zIndex: 20,
|
||||
backdropFilter: 'blur(4px)'
|
||||
}}>
|
||||
<VideoPlayer
|
||||
deviceId={serialNumber}
|
||||
idx={4}
|
||||
className="w-full h-full object-contain"
|
||||
video={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
<div style={{ position: 'absolute', top: 4, left: 8, color: '#fff', fontSize: 12, background: '#0006', padding: '2px 6px', borderRadius: 4 }}>右视</div>
|
||||
<div style={{ marginBottom: 6, fontWeight: 600, color: '#1890ff' }}>机器人状态</div>
|
||||
<div style={{ display: 'grid', gridTemplateColumns: 'auto auto', gap: '3px 10px' }}>
|
||||
<span>电量:</span>
|
||||
<span style={{ color: (statusData.battery || 0) < 20 ? '#ff4d4f' : '#52c41a' }}>
|
||||
{statusData.battery !== undefined ? `${statusData.battery}%` : '-'}
|
||||
</span>
|
||||
<span>电压:</span>
|
||||
<span>{statusData.voltage !== undefined ? `${Number(statusData.voltage).toFixed(2)}V` : '-'}</span>
|
||||
<span>左电机:</span>
|
||||
<span>{statusData.leftCurrent !== undefined ? `${Number(statusData.leftCurrent).toFixed(2)}A` : '-'}</span>
|
||||
<span>右电机:</span>
|
||||
<span>{statusData.rightCurrent !== undefined ? `${Number(statusData.rightCurrent).toFixed(2)}A` : '-'}</span>
|
||||
<span>左速度:</span>
|
||||
<span>{statusData.leftMeasureSpeed !== undefined ? `${Number(statusData.leftMeasureSpeed).toFixed(1)}rpm` : '-'}</span>
|
||||
<span>右速度:</span>
|
||||
<span>{statusData.rightMeasureSpeed !== undefined ? `${Number(statusData.rightMeasureSpeed).toFixed(1)}rpm` : '-'}</span>
|
||||
<span>左温度:</span>
|
||||
<span>{statusData.leftMotorTemp !== undefined ? `${Number(statusData.leftMotorTemp).toFixed(1)}℃` : '-'}</span>
|
||||
<span>右温度:</span>
|
||||
<span>{statusData.rightMotorTemp !== undefined ? `${Number(statusData.rightMotorTemp).toFixed(1)}℃` : '-'}</span>
|
||||
<span>主控温度:</span>
|
||||
<span>{statusData.chipTemp !== undefined ? `${Number(statusData.chipTemp).toFixed(1)}℃` : '-'}</span>
|
||||
<span>航向角:</span>
|
||||
<span>{statusData.yaw !== undefined ? `${Number(statusData.yaw).toFixed(1)}°` : '-'}</span>
|
||||
<span>俯仰角:</span>
|
||||
<span>{statusData.pitch !== undefined ? `${Number(statusData.pitch).toFixed(1)}°` : '-'}</span>
|
||||
<span>定位:</span>
|
||||
<span>
|
||||
{statusData.qual == 0 ? '无效' :
|
||||
statusData.qual == 1 ? 'GPS单点' :
|
||||
statusData.qual == 2 ? 'DGPS差分' :
|
||||
statusData.qual == 4 ? 'RTK固定' :
|
||||
statusData.qual == 5 ? 'RTK浮点' : '未知'}
|
||||
</span>
|
||||
<span>卫星:</span>
|
||||
<span>{statusData.satelliteCnt || 0}颗</span>
|
||||
<span>模式:</span>
|
||||
<span>
|
||||
{statusData.controlMode == 1 ? '本地' :
|
||||
statusData.controlMode == 3 ? '远程' : '未知'}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user