紧凑样式

This commit is contained in:
mmc
2026-05-14 17:23:12 +08:00
parent 6cadb14a9c
commit 995c8c482b
16 changed files with 248 additions and 268 deletions

View File

@@ -170,31 +170,31 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll,
return (
<Content style={{ maxWidth: 1800, margin: '0 auto', }}>
{/*<AgoraTextTest />*/}
<Row gutter={[16, 16]} style={{ marginBottom: 20, flexWrap: 'wrap' }}>
<Row gutter={[8, 8]} style={{ marginBottom: 12, flexWrap: 'wrap' }}>
{dynamicTopCards.map((card, idx) => (
<Col key={idx} style={{ minWidth: '200px', flex: '1 0 auto' }}>
<Col key={idx} style={{ minWidth: '160px', flex: '1 0 auto' }}>
<Card
bordered={false}
style={{
borderRadius: 12,
borderRadius: 8,
boxShadow: '0 2px 8px rgba(0,0,0,0.05)',
height: 110,
height: 90,
}}
bodyStyle={{ padding: '16px', height: '100%' }}
bodyStyle={{ padding: '12px', height: '100%' }}
>
<div style={{ display: 'flex', alignItems: 'center', gap: 12, height: '100%' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 10, height: '100%' }}>
{/* 左侧图标 */}
<div
style={{
width: 48,
height: 48,
borderRadius: 10,
width: 40,
height: 40,
borderRadius: 8,
background: `${card.color}15`,
color: card.color,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
fontSize: 'clamp(16px, 1.5vw, 20px)',
fontSize: 'clamp(14px, 1.2vw, 18px)',
flexShrink: 0,
}}
>
@@ -219,13 +219,13 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll,
))}
</Row>
<Row gutter={16}>
<Row gutter={[8, 8]}>
<Col xs={24} lg={14}>
<Card title={<><EnvironmentOutlined /> 装备协同态势图</>} extra={<Button type="text" icon={<SettingOutlined />} />} bordered={false} style={{ borderRadius: 12, marginBottom: 16 }} bodyStyle={{ padding: 0 }}>
<div style={{ width: '100%', height: 400, background: '#e6f7ff url(https://picsum.photos/seed/solarfarm/1600/800) center/cover', borderRadius: 12, position: 'relative', overflow: 'hidden' }}>
<div style={{ position: 'absolute', top: 16, left: 16, background: 'rgba(255,255,255,0.95)', borderRadius: 8, padding: 12 }}>
<div style={{ fontSize: 12, fontWeight: 60, marginBottom: 8 }}>图例说明</div>
<div style={{ display: 'flex', flexDirection: 'column', gap: 6, fontSize: 11 }}>
<Card title={<><EnvironmentOutlined /> 装备协同态势图</>} extra={<Button type="text" icon={<SettingOutlined />} />} bordered={false} style={{ borderRadius: 8, marginBottom: 8 }} bodyStyle={{ padding: 0 }}>
<div style={{ width: '100%', height: 350, background: '#e6f7ff url(https://picsum.photos/seed/solarfarm/1600/800) center/cover', borderRadius: 8, position: 'relative', overflow: 'hidden' }}>
<div style={{ position: 'absolute', top: 12, left: 12, background: 'rgba(255,255,255,0.95)', borderRadius: 6, padding: 8 }}>
<div style={{ fontSize: 11, fontWeight: 60, marginBottom: 4 }}>图例说明</div>
<div style={{ display: 'flex', flexDirection: 'column', gap: 4, fontSize: 10 }}>
<div><span style={{ color: '#1890ff' }}>———</span> 巡检航线</div>
<div><span style={{ color: '#fa8c16' }}>———</span> 机器人路径</div>
<div><span style={{ color: '#52c41a' }}>———</span> 清洗路径</div>
@@ -237,35 +237,35 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll,
</div>
</Card>
<Card title={<><SettingOutlined /> 装备调度列表</>} bordered={false} style={{ borderRadius: 12, marginBottom: 16 }}>
<Card title={<><SettingOutlined /> 装备调度列表</>} bordered={false} style={{ borderRadius: 8, marginBottom: 8 }}>
<Table rowKey={(record) => record.id || record.serialNumber || record.device_sn} size="small" pagination={false}
columns={[
{ title: '装备名称', dataIndex: 'name', width: 160 },
{ title: '类型', dataIndex: 'type', width: 100 },
{ title: '当前状态', dataIndex: 'status', width: 80, render: s => <Tag color={s === '作业中' || s === '在线' ? 'success' : 'default'}>{s}</Tag> },
{ title: '模式', dataIndex: 'mode', width: 80 },
{ title: '电量', dataIndex: 'battery', width: 80, render: v => <Progress percent={v} size="small" status={v < 40 ? 'exception' : 'active'} /> },
{ title: '位置', dataIndex: 'position', width: 100 },
{ title: '当前任务', dataIndex: 'task', width: 120 },
{ title: '通讯状态', dataIndex: 'comm', width: 80, render: v => <Badge status={v.includes('-') ? 'warning' : 'success'} text={v} /> },
{ title: '操作', key: 'action', width: 100, render: () => <Space><Button size="small" type="text" icon={<EditOutlined />} /><Button size="small" type="text" icon={<SettingOutlined />} /></Space> }
{ title: '装备名称', dataIndex: 'name', width: 140 },
{ title: '类型', dataIndex: 'type', width: 90 },
{ title: '当前状态', dataIndex: 'status', width: 70, render: s => <Tag color={s === '作业中' || s === '在线' ? 'success' : 'default'} style={{ margin: 0 }}>{s}</Tag> },
{ title: '模式', dataIndex: 'mode', width: 70 },
{ title: '电量', dataIndex: 'battery', width: 70, render: v => <Progress percent={v} size="small" status={v < 40 ? 'exception' : 'active'} /> },
{ title: '位置', dataIndex: 'position', width: 90 },
{ title: '当前任务', dataIndex: 'task', width: 100 },
{ title: '通讯状态', dataIndex: 'comm', width: 70, render: v => <Badge status={v.includes('-') ? 'warning' : 'success'} text={v} /> },
{ title: '操作', key: 'action', width: 80, render: () => <Space size={4}><Button size="small" type="text" icon={<EditOutlined />} /><Button size="small" type="text" icon={<SettingOutlined />} /></Space> }
]}
dataSource={dynamicScheduleList}
scroll={{ x: 'max-content', y: 320 }}
scroll={{ x: 'max-content', y: 280 }}
/>
</Card>
<Card title={<><SettingOutlined /> <span >控制日志 / 告警记录</span></>} bordered={false} style={{ borderRadius: 12 }} extra={<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><Button size="small" style={{ borderRadius: 8, border: '1px solid #d9d9d9' }}>全部级别 ▼</Button></div>}>
<Card title={<><SettingOutlined /> <span >控制日志 / 告警记录</span></>} bordered={false} style={{ borderRadius: 8 }} extra={<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><Button size="small" style={{ borderRadius: 4, border: '1px solid #d9d9d9' }}>全部级别 ▼</Button></div>}>
<Table rowKey="time" size="small" pagination={false} dataSource={logs} scroll={{ x: 'max-content' }}
columns={[
{ title: '时间', dataIndex: 'time', width: 100, render: t => <span style={{ fontSize: 14 }}>{t}</span> },
{ title: '设备', dataIndex: 'device', width: 120, render: t => <span style={{ fontSize: 14 }}>{t}</span> },
{ title: '类型', dataIndex: 'type', width: 80, render: t => { let c = '#52c41a'; if (t === '告警') c = '#fa8c16'; if (t === 'events') c = '#1890ff'; return <div style={{ display: 'flex', alignItems: 'center', gap: 4 }}><span style={{ width: 12, height: 12, borderRadius: 2, background: c }} /><span style={{ fontSize: 14 }}>{t}</span></div> } },
{ title: '描述', dataIndex: 'desc', render: t => <span style={{ fontSize: 14 }}>{t}</span> },
{ title: '', width: 80, render: (_, r) => r.level ? <Tag color="red" style={{ fontSize: 12 }}>{r.level}</Tag> : null }
{ title: '时间', dataIndex: 'time', width: 90, render: t => <span style={{ fontSize: 13 }}>{t}</span> },
{ title: '设备', dataIndex: 'device', width: 100, render: t => <span style={{ fontSize: 13 }}>{t}</span> },
{ title: '类型', dataIndex: 'type', width: 70, render: t => { let c = '#52c41a'; if (t === '告警') c = '#fa8c16'; if (t === 'events') c = '#1890ff'; return <div style={{ display: 'flex', alignItems: 'center', gap: 4 }}><span style={{ width: 10, height: 10, borderRadius: 2, background: c }} /><span style={{ fontSize: 13 }}>{t}</span></div> } },
{ title: '描述', dataIndex: 'desc', render: t => <span style={{ fontSize: 13 }}>{t}</span> },
{ title: '', width: 70, render: (_, r) => r.level ? <Tag color="red" style={{ fontSize: 11, margin: 0 }}>{r.level}</Tag> : null }
]}
/>
<div style={{ textAlign: 'center', marginTop: 12 }}><Button type="link" style={{ fontSize: 16, color: '#1890ff' }}>查看更多日志</Button></div>
<div style={{ textAlign: 'center', marginTop: 8 }}><Button type="link" size="small" style={{ fontSize: 13, color: '#1890ff' }}>查看更多日志</Button></div>
</Card>
</Col>
@@ -273,13 +273,14 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll,
<Card
title={<><SettingOutlined style={{ marginRight: 6, }} /> 设备控制面板</>}
bordered={false}
style={{ borderRadius: 12, marginBottom: 16 }}
bodyStyle={{ padding: 16, paddingBottom: 0 }}
style={{ borderRadius: 8, marginBottom: 8 }}
bodyStyle={{ padding: 12, paddingBottom: 0 }}
> <Select
style={{ width: 220, marginBottom: 10 }}
style={{ width: 200, marginBottom: 8 }}
placeholder="请选择设备"
value={selectedDevice?.device_sn || selectedDevice?.serialNumber}
onChange={handleDeviceChange}
size="small"
showSearch // 👈 开启搜索
allowClear // 允许删除/清空
optionFilterProp="label" // 👈 按设备名称搜索
@@ -293,13 +294,13 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll,
/>
{selectedDevice && (
<Row gutter={16}>
<Row gutter={8}>
<Col span={12}>
<div style={{ marginBottom: 24 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 16, flexWrap: "wrap" }}>
<span style={{ fontSize: 24, color: '#1890ff' }}><RocketOutlined /></span>
<span style={{ fontSize: 16, fontWeight: 600 }}>{selectedDevice.deviceAlias || selectedDevice.drone_callsign || selectedDevice.callsign || selectedDevice.deviceName}</span>
<Tag color={selectedDevice.onlineStatus === 1 ? "success" : "default"} size="small">
<div style={{ marginBottom: 12 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 6, marginBottom: 12, flexWrap: "wrap" }}>
<span style={{ fontSize: 20, color: '#1890ff' }}><RocketOutlined /></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 }}>
{selectedDevice.onlineStatus == 1 ? "在线" : "离线"}
</Tag>
<Button
@@ -307,15 +308,15 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll,
ghost
size="small"
icon={<InfoCircleOutlined />}
style={{ borderRadius: 4, fontSize: 12, marginLeft: 'auto' }}
style={{ borderRadius: 4, fontSize: 11, marginLeft: 'auto' }}
onClick={() => onViewStatus && onViewStatus(selectedDevice.device_sn || selectedDevice.serialNumber)}
>
详情
</Button>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 6 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
<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 }}>电量 {fix2(selectedDevice.capacity_percent || 100)}%</span>
</div>