设备状态界面 无人机布局根据韩 建议优化
This commit is contained in:
@@ -883,229 +883,225 @@ export default function DeviceStatusPage({
|
||||
|
||||
</div>
|
||||
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col xs={24} lg={16}>
|
||||
<Card
|
||||
title={
|
||||
<>
|
||||
<VideoCameraOutlined />
|
||||
实时视频监控
|
||||
</>
|
||||
}
|
||||
//extra={
|
||||
// <Button
|
||||
// size="small"
|
||||
// onClick={() => {
|
||||
// // 取当前选中设备编号,执行设备切换/刷新逻辑
|
||||
// const currentSn = device?.device_sn || device?.serialNumber;
|
||||
// console.log('currentSn', currentSn);
|
||||
// onDeviceChange?.(currentSn);
|
||||
// }}
|
||||
// >
|
||||
// 刷新
|
||||
// </Button>
|
||||
//}
|
||||
bordered={false}
|
||||
style={{ borderRadius: 12, marginBottom: 8 }}
|
||||
bodyStyle={{ padding: 12 }}
|
||||
>
|
||||
{!isUAV && (
|
||||
{/* 无人机专用布局 */}
|
||||
{isUAV ? (
|
||||
<Row gutter={[16, 16]} align="stretch">
|
||||
{/* 左侧:机场视频 + 地图 */}
|
||||
<Col xs={24} lg={8}>
|
||||
{/* 无人机场视频 + 机场状态 */}
|
||||
<Card
|
||||
title={
|
||||
<>
|
||||
<VideoCameraOutlined />
|
||||
无人机场视频
|
||||
</>
|
||||
}
|
||||
bordered={false}
|
||||
style={{ borderRadius: 12, marginBottom: 8 }}
|
||||
bodyStyle={{ padding: 12 }}
|
||||
>
|
||||
<div style={{ borderRadius: 8, overflow: 'hidden', height: 300 }}>
|
||||
<DroneVideoPlayer
|
||||
device={realtimeDevice}
|
||||
height={300}
|
||||
dualVideo={false}
|
||||
showSourceSelect={false}
|
||||
videoSource="station"
|
||||
statusData={{ ...persistentHostData, ...uavState }}
|
||||
displayType="station"
|
||||
/>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
{/* 地图 */}
|
||||
<Card
|
||||
title={
|
||||
<>
|
||||
<GlobalOutlined />
|
||||
位置态势图
|
||||
</>
|
||||
}
|
||||
extra={
|
||||
<Space size={4}>
|
||||
<Button
|
||||
size="small"
|
||||
type="primary"
|
||||
icon={<DeleteOutlined />}
|
||||
onClick={() => setClearNavLine((v) => v + 1)}
|
||||
>
|
||||
清空实时轨迹
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
danger
|
||||
icon={<DeleteOutlined />}
|
||||
onClick={() => {
|
||||
setPoints([]);
|
||||
setClearPlanLine((v) => v + 1);
|
||||
}}
|
||||
>
|
||||
清空规划航线
|
||||
</Button>
|
||||
</Space>
|
||||
}
|
||||
bordered={false}
|
||||
style={{ borderRadius: 12 }}
|
||||
bodyStyle={{ padding: 12, height: 400 }}
|
||||
>
|
||||
<CesiumMap
|
||||
ref={mapRef}
|
||||
devices={[mapDevices]}
|
||||
points={points}
|
||||
markedPoints={markedPoints}
|
||||
realtimePosition={realtimePosition}
|
||||
realtimeType={realtimeType}
|
||||
drawRealTime={true}
|
||||
finishPoint={arrivedPoint}
|
||||
ifClearNavLine={clearNavLine}
|
||||
ifClearPlanLine={clearPlanLine}
|
||||
from="deviceStatus"
|
||||
/>
|
||||
</Card>
|
||||
</Col>
|
||||
|
||||
{/* 右侧:无人机视频 + 无人机状态 */}
|
||||
<Col xs={24} lg={16}>
|
||||
{/* 无人机视频 + 无人机状态 */}
|
||||
<Card
|
||||
title={
|
||||
<>
|
||||
<VideoCameraOutlined />
|
||||
无人机视频
|
||||
</>
|
||||
}
|
||||
bordered={false}
|
||||
style={{ borderRadius: 12, marginBottom: 8 }}
|
||||
bodyStyle={{ padding: 12 }}
|
||||
>
|
||||
<div style={{ borderRadius: 8, overflow: 'hidden', height: "100%" }}>
|
||||
<DroneVideoPlayer
|
||||
device={realtimeDevice}
|
||||
height={760}
|
||||
dualVideo={false}
|
||||
showSourceSelect={false}
|
||||
videoSource="drone"
|
||||
statusData={{ ...persistentDroneData, ...uavState }}
|
||||
displayType="drone"
|
||||
/>
|
||||
</div>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
) : (
|
||||
// 机器人原布局
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col xs={24} lg={16}>
|
||||
<Card
|
||||
title={
|
||||
<>
|
||||
<VideoCameraOutlined />
|
||||
实时视频监控
|
||||
</>
|
||||
}
|
||||
bordered={false}
|
||||
style={{ borderRadius: 12, marginBottom: 8 }}
|
||||
bodyStyle={{ padding: 12 }}
|
||||
>
|
||||
<Space style={{ marginBottom: 8 }}>
|
||||
<Button type={mowerView === 'front' ? 'primary' : 'default'} onClick={() => setMowerView('front')}>前视</Button>
|
||||
<Button type={mowerView === 'back' ? 'primary' : 'default'} onClick={() => setMowerView('back')}>后视</Button>
|
||||
<Button type={mowerView === 'left' ? 'primary' : 'default'} onClick={() => setMowerView('left')}>左视</Button>
|
||||
<Button type={mowerView === 'right' ? 'primary' : 'default'} onClick={() => setMowerView('right')}>右视</Button>
|
||||
{/*<Button type={mowerView === 'top' ? 'primary' : 'default'} onClick={() => setMowerView('top')}>顶视</Button>*/}
|
||||
<Button type={mowerView === 'all' ? 'primary' : 'default'} onClick={() => setMowerView('all')}>全景</Button>
|
||||
</Space>
|
||||
)}
|
||||
|
||||
<div
|
||||
style={{
|
||||
borderRadius: 8,
|
||||
overflow: 'hidden',
|
||||
display: 'flex',
|
||||
// flexWrap: 'wrap', // 左右排布不换行
|
||||
}}
|
||||
>
|
||||
{isUAV ? (
|
||||
<DroneVideoPlayer
|
||||
device={realtimeDevice}
|
||||
|
||||
height={450}
|
||||
|
||||
dualVideo={true}
|
||||
showSourceSelect={false}
|
||||
defaultSource="drone"
|
||||
/>
|
||||
) : robotVideo ? (
|
||||
// 全景模式 = T 型排布
|
||||
mowerView === 'all' ? (
|
||||
<MowerAllView
|
||||
serialNumber={serialNumber}
|
||||
robotVideo={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
<div style={{ borderRadius: 8, overflow: 'hidden', display: 'flex' }}>
|
||||
{robotVideo ? (
|
||||
mowerView === 'all' ? (
|
||||
<MowerAllView
|
||||
serialNumber={serialNumber}
|
||||
robotVideo={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
) : (
|
||||
<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}
|
||||
/>
|
||||
)
|
||||
) : (
|
||||
// 单画面模式
|
||||
<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={{ color: '#ccc', margin: 'auto' }}>
|
||||
视频加载中...
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</Card>
|
||||
<div style={{ color: '#ccc', margin: 'auto' }}>视频加载中...</div>
|
||||
)}
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Card
|
||||
title={
|
||||
<>
|
||||
<GlobalOutlined />
|
||||
位置态势图
|
||||
</>
|
||||
}
|
||||
extra={
|
||||
<Space size={4}>
|
||||
<Button
|
||||
size="small"
|
||||
type="primary"
|
||||
icon={<DeleteOutlined />}
|
||||
onClick={() => {
|
||||
setClearNavLine((v) => v + 1);
|
||||
}}
|
||||
>
|
||||
清空实时轨迹
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
danger
|
||||
icon={<DeleteOutlined />}
|
||||
onClick={() => {
|
||||
setPoints([]);
|
||||
setClearPlanLine((v) => v + 1);
|
||||
}}
|
||||
>
|
||||
清空规划航线
|
||||
</Button>
|
||||
</Space>
|
||||
}
|
||||
bordered={false}
|
||||
style={{ borderRadius: 12 }}
|
||||
bodyStyle={{
|
||||
padding: 12,
|
||||
height: 400,
|
||||
}}
|
||||
>
|
||||
<CesiumMap
|
||||
ref={mapRef}
|
||||
devices={[mapDevices]}
|
||||
points={points}
|
||||
markedPoints={markedPoints}
|
||||
realtimePosition={realtimePosition}
|
||||
realtimeType={realtimeType}
|
||||
drawRealTime={true}
|
||||
finishPoint={arrivedPoint}
|
||||
ifClearNavLine={clearNavLine}
|
||||
ifClearPlanLine={clearPlanLine}
|
||||
from="deviceStatus"
|
||||
/>
|
||||
</Card>
|
||||
</Col>
|
||||
<Card
|
||||
title={
|
||||
<>
|
||||
<GlobalOutlined />
|
||||
位置态势图
|
||||
</>
|
||||
}
|
||||
extra={
|
||||
<Space size={4}>
|
||||
<Button
|
||||
size="small"
|
||||
type="primary"
|
||||
icon={<DeleteOutlined />}
|
||||
onClick={() => setClearNavLine((v) => v + 1)}
|
||||
>
|
||||
清空实时轨迹
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
danger
|
||||
icon={<DeleteOutlined />}
|
||||
onClick={() => {
|
||||
setPoints([]);
|
||||
setClearPlanLine((v) => v + 1);
|
||||
}}
|
||||
>
|
||||
清空规划航线
|
||||
</Button>
|
||||
</Space>
|
||||
}
|
||||
bordered={false}
|
||||
style={{ borderRadius: 12 }}
|
||||
bodyStyle={{ padding: 12, height: 400 }}
|
||||
>
|
||||
<CesiumMap
|
||||
ref={mapRef}
|
||||
devices={[mapDevices]}
|
||||
points={points}
|
||||
markedPoints={markedPoints}
|
||||
realtimePosition={realtimePosition}
|
||||
realtimeType={realtimeType}
|
||||
drawRealTime={true}
|
||||
finishPoint={arrivedPoint}
|
||||
ifClearNavLine={clearNavLine}
|
||||
ifClearPlanLine={clearPlanLine}
|
||||
from="deviceStatus"
|
||||
/>
|
||||
</Card>
|
||||
</Col>
|
||||
|
||||
<Col xs={24} lg={8}>
|
||||
<Card
|
||||
title={<><DashboardOutlined /> {isUAV ? '无人机状态' : '机器人状态'}详情</>}
|
||||
bordered={false}
|
||||
style={{ borderRadius: 12, marginBottom: 8 }}
|
||||
extra={<Tag color={device.onlineStatus === 1 ? 'success' : 'default'}>{device.onlineStatus === 1 ? '在线' : '离线'}</Tag>}
|
||||
>
|
||||
{isUAV ? (
|
||||
<Descriptions column={2} size="small" layout="vertical">
|
||||
<Descriptions.Item label={<><ThunderboltOutlined /> 电池电量</>}>
|
||||
<Progress percent={(currentDroneData || uavState || device).capacity_percent || 0} size="small" status={((currentDroneData || uavState || device).capacity_percent || 0) < 20 ? 'exception' : 'active'} />
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label={<><EnvironmentOutlined /> 飞行高度</>}>
|
||||
<Text strong style={{ fontSize: 16 }}>{fix2((currentDroneData || uavState || device).height)} m</Text>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="水平速度">
|
||||
<Text>{fix2(currentDroneData?.horizontal_speed) || '-'} m/s</Text>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="垂直速度">
|
||||
<Text>{fix2(currentDroneData?.vertical_speed) || '-'} m/s</Text>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="环境风速">
|
||||
<Text>{fix2((currentDroneData || uavState || device).wind_speed)} m/s</Text>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="环境温度">
|
||||
<Text>{fix2((currentDroneData || uavState || device).environment_temperature)} ℃</Text>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="环境湿度">
|
||||
<Text>{(currentDroneData?.humidity) || '-'}{currentDroneData?.humidity ? '%' : ''}</Text>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="机场温度">
|
||||
<Text>{fix2(currentDroneData?.temperature)} ℃</Text>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="降雨状态">
|
||||
<Tag color={(currentDroneData || uavState || device).rainfall === 'no_rain' ? 'green' : 'red'}>{getVal((currentDroneData || uavState || device).rainfall)}</Tag>
|
||||
</Descriptions.Item>
|
||||
|
||||
<Descriptions.Item label="航向角">
|
||||
<Text>{fix2(currentDroneData?.heading)}°</Text>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="飞行模式">
|
||||
<Tag color="blue">
|
||||
{currentDroneData?.mode_code !== undefined ? `模式 ${currentDroneData.mode_code}` : '-'}
|
||||
</Tag>
|
||||
</Descriptions.Item>
|
||||
|
||||
<Descriptions.Item label="无人机位置">
|
||||
<Tag color="blue">
|
||||
{currentDroneData?.drone_in_dock === 1 ? '在库' : '外出'}
|
||||
</Tag>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="机库状态">
|
||||
<Tag color={currentDroneData?.cover_state === 1 ? 'processing' : 'default'}>
|
||||
{currentDroneData?.cover_state === 1 ? '舱门打开' : '舱门关闭'}
|
||||
</Tag>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="机场空调">
|
||||
<Tag color={currentDroneData?.air_conditioner_state === 1 ? 'success' : 'default'}>
|
||||
{currentDroneData?.air_conditioner_state === 1 ? '开启' : '关闭'}
|
||||
</Tag>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="GPS 卫星数">
|
||||
<Badge showZero count={(currentDroneData || uavState || device).position_state?.gps_number || 0} style={{ backgroundColor: '#1890ff' }} />
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="RTK 卫星数">
|
||||
<Badge showZero count={(currentDroneData || uavState || device).position_state?.rtk_number || 0} style={{ backgroundColor: '#52c41a' }} />
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="RTK 状态">
|
||||
<Tag color={(currentDroneData || uavState || device).position_state?.is_fixed === 2 || (currentDroneData || uavState || device).position_state?.is_fixed === 'fixing_successful' ? 'success' : 'warning'}>
|
||||
{(currentDroneData || uavState || device).position_state?.is_fixed === 2 || (currentDroneData || uavState || device).position_state?.is_fixed === 'fixing_successful' ? 'RTK 已固定' : '未固定'}
|
||||
</Tag>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="实时经纬度" span={2}>
|
||||
<Text style={{ fontSize: '12px' }}>
|
||||
{currentDroneData?.latitude && currentDroneData?.longitude ?
|
||||
`${currentDroneData.latitude.toFixed(6)}, ${currentDroneData.longitude.toFixed(6)}` : '-'}
|
||||
</Text>
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
) : (
|
||||
<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'} />
|
||||
@@ -1122,8 +1118,6 @@ export default function DeviceStatusPage({
|
||||
<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
|
||||
@@ -1145,9 +1139,8 @@ export default function DeviceStatusPage({
|
||||
<Descriptions.Item label="偏航角 (Yaw)"><Text>{fix2(runningStatus?.yaw)}°</Text></Descriptions.Item>
|
||||
<Descriptions.Item label="俯仰角 (Pitch)"><Text>{fix2(runningStatus?.pitch)}°</Text></Descriptions.Item>
|
||||
</Descriptions>
|
||||
)}
|
||||
</Card>
|
||||
{!isUAV && (
|
||||
</Card>
|
||||
|
||||
<Card
|
||||
title={
|
||||
<>
|
||||
@@ -1156,10 +1149,7 @@ export default function DeviceStatusPage({
|
||||
</>
|
||||
}
|
||||
bordered={false}
|
||||
style={{
|
||||
borderRadius: 12,
|
||||
background: '#0f172a',
|
||||
}}
|
||||
style={{ borderRadius: 12, background: '#0f172a' }}
|
||||
headStyle={{ color: '#fff' }}
|
||||
bodyStyle={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}
|
||||
>
|
||||
@@ -1171,9 +1161,9 @@ export default function DeviceStatusPage({
|
||||
isConnecting={connecting}
|
||||
/>
|
||||
</Card>
|
||||
)}
|
||||
</Col>
|
||||
</Row>
|
||||
</Col>
|
||||
</Row>
|
||||
)}
|
||||
|
||||
<Modal
|
||||
open={isModalOpen}
|
||||
|
||||
Reference in New Issue
Block a user