机器人分组筛选

This commit is contained in:
mmc
2026-05-18 17:25:41 +08:00
parent 002371a374
commit 22f9890226

View File

@@ -11,7 +11,8 @@ import {
CloudOutlined, ClockCircleOutlined, ReloadOutlined, CloudOutlined, ClockCircleOutlined, ReloadOutlined,
AimOutlined, ApiOutlined, SettingOutlined, AimOutlined, ApiOutlined, SettingOutlined,
PlusOutlined, ArrowRightOutlined, PlusOutlined, ArrowRightOutlined,
EditOutlined, FullscreenOutlined, InfoCircleOutlined EditOutlined, FullscreenOutlined, InfoCircleOutlined,
CarOutlined
} from '@ant-design/icons'; } from '@ant-design/icons';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
@@ -275,8 +276,9 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll,
bordered={false} bordered={false}
style={{ borderRadius: 8, marginBottom: 8 }} style={{ borderRadius: 8, marginBottom: 8 }}
bodyStyle={{ padding: 12, paddingBottom: 0 }} bodyStyle={{ padding: 12, paddingBottom: 0 }}
> <Select >
style={{ width: 200, marginBottom: 8 }} <Select
style={{ width: "80%", marginBottom: 8 }}
placeholder="请选择设备" placeholder="请选择设备"
value={selectedDevice?.device_sn || selectedDevice?.serialNumber} value={selectedDevice?.device_sn || selectedDevice?.serialNumber}
onChange={handleDeviceChange} onChange={handleDeviceChange}
@@ -287,10 +289,28 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll,
filterOption={(input, option) => filterOption={(input, option) =>
option.label.toLowerCase().includes(input.toLowerCase()) option.label.toLowerCase().includes(input.toLowerCase())
} }
options={devicesAll.map(item => ({ options={[
{
label: <span>机器人</span>,
title: 'manager',
options: devices.map(item => ({
value: item.device_sn || item.serialNumber, value: item.device_sn || item.serialNumber,
label: item.deviceAlias || item.drone_callsign || item.callsign || item.deviceName || '未知设备' label: item.deviceAlias || item.deviceName || '未知设备'
}))} })),
},
{
label: <span>无人机</span>,
title: 'engineer',
options: planedevices.map(item => ({
value: item.device_sn,
label: item.drone_callsign || item.callsign || '未知设备'
})),
},
]}
//options={devicesAll.map(item => ({
// value: item.device_sn || item.serialNumber,
// label: item.deviceAlias || item.drone_callsign || item.callsign || item.deviceName || '未知设备'
//}))}
/> />
{selectedDevice && ( {selectedDevice && (
@@ -298,15 +318,23 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll,
<Col span={12}> <Col span={12}>
<div style={{ marginBottom: 12 }}> <div style={{ marginBottom: 12 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 6, marginBottom: 12, flexWrap: "wrap" }}> <div style={{ display: 'flex', alignItems: 'center', gap: 6, marginBottom: 12, flexWrap: "wrap" }}>
{selectedDevice.deviceType === 'drone' ||
selectedDevice.deviceName?.includes('无人机') ||
selectedDevice.drone_callsign ? (
<span style={{ fontSize: 20, color: '#1890ff' }}><RocketOutlined /></span> <span style={{ fontSize: 20, color: '#1890ff' }}><RocketOutlined /></span>
) : (
<span style={{ fontSize: 20, color: '#1890ff' }}><CarOutlined /></span>
)}
<span style={{ fontSize: 14, fontWeight: 600 }}>{selectedDevice.deviceAlias || selectedDevice.drone_callsign || selectedDevice.callsign || selectedDevice.deviceName}</span> <span style={{ fontSize: 14, fontWeight: 600 }}>{selectedDevice.deviceAlias || selectedDevice.drone_callsign || selectedDevice.callsign || selectedDevice.deviceName}</span>
<Tag color={selectedDevice.onlineStatus === 1 ? "success" : "default"} size="small" style={{ margin: 0 }}> <Tag color={selectedDevice.onlineStatus === 1 ? "success" : "default"} size="small" style={{ margin: 0 }}>
{selectedDevice.onlineStatus == 1 ? "在线" : "离线"} {selectedDevice.onlineStatus == 1 ? "在线" : "离线"}
</Tag> </Tag>
<Button <Button
type="primary" type="primary"
ghost
size="small" size="small"
ghost
icon={<InfoCircleOutlined />} icon={<InfoCircleOutlined />}
style={{ borderRadius: 4, fontSize: 11, marginLeft: 'auto' }} style={{ borderRadius: 4, fontSize: 11, marginLeft: 'auto' }}
onClick={() => onViewStatus && onViewStatus(selectedDevice.device_sn || selectedDevice.serialNumber)} onClick={() => onViewStatus && onViewStatus(selectedDevice.device_sn || selectedDevice.serialNumber)}
@@ -377,23 +405,31 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll,
</div> </div>
<div style={{ display: 'flex', justifyContent: "space-between", flexWrap: 'wrap', gap: 6 }}> <div style={{ display: 'flex', justifyContent: "space-between", flexWrap: 'wrap', gap: 6 }}>
<Button type="primary" size="large" style={{ borderRadius: 8, flex: 1 }} onClick={handleStart}>启动任务</Button> <Button type="primary" size="small" style={{ borderRadius: 8, flex: 1 }} onClick={handleStart}>启动</Button>
<Button style={{ borderRadius: 8, flex: 1 }} size="large" onClick={handlePause}>暂停</Button> <Button style={{ borderRadius: 8, flex: 1 }} size="small" onClick={handlePause}>暂停</Button>
<Button type="primary" style={{ borderRadius: 8, flex: 1 }} size="large" onClick={handleReturn}>返航</Button> <Button type="primary" style={{ borderRadius: 8, flex: 1 }} size="small" onClick={handleReturn}>返航</Button>
<Button style={{ background: '#52c41a', borderColor: '#52c41a', color: "#fff", borderRadius: 8, flex: 1 }} size="large" onClick={handleRecharge}>回充</Button> <Button style={{ flex: 1, background: '#52c41a', borderColor: '#52c41a', color: "#fff", borderRadius: 8, }} size="small" onClick={handleRecharge}>回充</Button>
</div> </div>
</div> </div>
</Col> </Col>
<Col span={12}> <Col span={12}>
<div style={{ marginBottom: 16 }}> <div style={{ marginBottom: 8 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 8 }}> <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 8 }}>
<span style={{ fontSize: 14, fontWeight: 500, color: "#666" }}>实时画面</span> <span style={{ fontSize: 14, fontWeight: 500, color: "#666" }}>实时画面</span>
<span style={{ fontSize: 13, color: '#999' }}>实时监控</span> <span style={{ fontSize: 13, color: '#999' }}>实时监控</span>
</div> </div>
<div style={{ width: '100%', height: 160, borderRadius: 8, position: 'relative', overflow: 'hidden', background: '#000' }}> <div style={{ width: '100%', height: 160, borderRadius: 8, position: 'relative', overflow: 'hidden', background: '#000' }}>
<DroneLivePlayer streamData={planeVideo?.[0] || null} /> {/* 无人机视频 + 时间:有数据才显示,否则空 div */}
{selectedDevice.device_sn && ( {planeVideo?.[0] ? (
<>
<DroneLivePlayer streamData={planeVideo[0]}
/>
</>
) : (
<div></div>
)} {selectedDevice.device_sn && (
<div style={{ position: 'absolute', bottom: 0, left: 0, right: 0, background: 'rgba(0,0,0,0.6)', color: '#fff', display: 'flex', justifyContent: 'space-between', padding: '8px 12px', fontSize: 14 }}> <div style={{ position: 'absolute', bottom: 0, left: 0, right: 0, background: 'rgba(0,0,0,0.6)', color: '#fff', display: 'flex', justifyContent: 'space-between', padding: '8px 12px', fontSize: 14 }}>
<span>高度 {fix2(selectedDevice.height)}m</span> <span>高度 {fix2(selectedDevice.height)}m</span>
<span>风速 {fix2(selectedDevice.wind_speed)}m/s</span> <span>风速 {fix2(selectedDevice.wind_speed)}m/s</span>
@@ -424,7 +460,7 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll,
<Col span={14}> <Col span={14}>
<div style={{ marginBottom: 12 }}> <div style={{ marginBottom: 12 }}>
<div style={{ fontSize: 16, fontWeight: 600, color: '#1890ff', marginBottom: 12 }}>建议操作</div> <div style={{ fontSize: 16, fontWeight: 600, color: '#1890ff', marginBottom: 12 }}>建议操作</div>
<div style={{ display: 'flex', flexDirection: 'column', gap: 2, padding: '16px', borderRadius: 12, border: '1px solid #e8e8e8' }}> <div style={{ display: 'flex', flexDirection: 'column', gap: 2, padding: '4px', borderRadius: 12, border: '1px solid #e8e8e8' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ color: '#1890ff' }}>⦿</span><span style={{ fontSize: 16 }}>优先执行巡检航线 P-03</span></div><ArrowRightOutlined style={{ color: '#666' }} /></div> <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ color: '#1890ff' }}>⦿</span><span style={{ fontSize: 16 }}>优先执行巡检航线 P-03</span></div><ArrowRightOutlined style={{ color: '#666' }} /></div>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ color: '#1890ff' }}>⦿</span><span style={{ fontSize: 16 }}>先行安排除草任务 G-02</span></div><ArrowRightOutlined style={{ color: '#666' }} /></div> <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ color: '#1890ff' }}>⦿</span><span style={{ fontSize: 16 }}>先行安排除草任务 G-02</span></div><ArrowRightOutlined style={{ color: '#666' }} /></div>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ color: '#1890ff' }}>⦿</span><span style={{ fontSize: 16 }}>建议生成清洗工单</span></div><ArrowRightOutlined style={{ color: '#666' }} /></div> <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}><div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ color: '#1890ff' }}>⦿</span><span style={{ fontSize: 16 }}>建议生成清洗工单</span></div><ArrowRightOutlined style={{ color: '#666' }} /></div>
@@ -453,9 +489,15 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll,
<div style={{ flex: 1, textAlign: 'center', whiteSpace: "nowrap", padding: "12px 4px", borderRight: "1px solid #e8e8e8" }}><div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>降雨</div><div style={{ fontSize: 14, fontWeight: 700, color: '#222', marginTop: 2 }}>{getVal(selectedDevice?.rainfall)}</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 }}>降雨</div><div style={{ fontSize: 14, fontWeight: 700, color: '#222', marginTop: 2 }}>{getVal(selectedDevice?.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 }}>{selectedDevice?.position_state?.is_fixed === 'fixing_successful' ? '固定' : '未固定'}</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 }}>{selectedDevice?.position_state?.is_fixed === 'fixing_successful' ? '固定' : '未固定'}</div></div>
</div> </div>
<div style={{ width: 110, padding: '12px 8px', borderRadius: 8, background: '#f6ffed', border: '1px solid #b7eb8f', textAlign: 'center', display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 4 }}> <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 style={{ fontSize: 14, fontWeight: 700, color: '#52c41a' }}>适宜执行</div> <div className="flex items-center gap-1">
<div style={{ fontSize: 12, fontWeight: 700, color: '#52c41a' }}>适宜执行</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 style={{ width: 18, height: 18, borderRadius: '50%', background: '#52c41a', display: 'flex', alignItems: 'center', justifyContent: 'center' }}><CheckCircleOutlined style={{ fontSize: 12, color: '#fff' }} /></div>
</div>
<div style={{ fontSize: 11, color: '#666' }}>可正常作业</div> <div style={{ fontSize: 11, color: '#666' }}>可正常作业</div>
</div> </div>
</div> </div>