紧凑样式

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

@@ -103,10 +103,31 @@ export default function AppLayout() {
locale={zhCN}
theme={{
algorithm: theme.defaultAlgorithm,
token: { colorPrimary: '#1890ff', borderRadius: 2 },
token: {
colorPrimary: '#1890ff',
borderRadius: 2,
// 全局紧凑设置
padding: 12,
paddingLG: 16,
margin: 12,
marginLG: 16,
},
components: {
Layout: { headerBg: '#fff', siderBg: '#fff' },
Menu: { itemBg: '#fff', itemSelectedBg: '#e6f4ff' }
Menu: { itemBg: '#fff', itemSelectedBg: '#e6f4ff' },
Card: {
paddingLG: 12, // 减小 Card 默认内边距
},
Table: {
padding: 8, // 减小 Table 单元格边距
paddingXS: 4,
},
Form: {
itemMarginBottom: 12, // 减小表单项间距
},
Space: {
gap: 8, // 减小 Space 间距
}
}
}}
>
@@ -114,14 +135,14 @@ export default function AppLayout() {
<Header style={{
background: '#0837a8',
color: '#fff',
minHeight: "50px",
minHeight: "40px", // 减小 Header 高度
height: "auto",
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
padding: '4px 16px',
padding: '2px 12px', // 减小 Header 边距
flexWrap: 'wrap',
gap: '8px'
gap: '4px'
}}>
<Space size="large" style={{ display: 'flex', alignItems: 'center', flexWrap: 'wrap' }}>
@@ -200,7 +221,7 @@ export default function AppLayout() {
/>
</Sider>
<Content style={{ background: '#f4f7f9', overflowY: 'auto', padding: '0px 16px' }}>
<Content style={{ background: '#f4f7f9', overflowY: 'auto', padding: '4px 8px' }}>
<Outlet />
</Content>
</Layout>

View File

@@ -167,23 +167,13 @@ const BasicSettings = () => {
];
return (
<div style={{ padding: 'clamp(10px, 1.2vw, 20px)', background: '#f5f7fa', minHeight: '100vh' }}>
<div style={{ marginBottom: 12, display: 'flex', alignItems: 'center', gap: 12 }}>
<Title level={4} style={{ margin: 0, fontSize: fontLarge }}>系统设置</Title>
<Space split={<Divider type="vertical" />}>
<Button type="text" size="small" icon={<SettingOutlined />} style={{ color: '#1677ff', fontWeight: 600 }}>基础设置</Button>
<Button type="text" size="small" icon={<UserOutlined />}>用户与角色</Button>
<Button type="text" size="small" icon={<NotificationOutlined />}>通知策略</Button>
<Button type="text" size="small" icon={<ApiOutlined />}>设备接入</Button>
<Button type="text" size="small" icon={<SafetyCertificateOutlined />}>数据与安全</Button>
<Button type="text" size="small" icon={<ToolOutlined />}>系统维护</Button>
</Space>
</div>
<div className="normal-spacing" style={{ padding: '8px', background: '#f5f7fa', minHeight: '100vh' }}>
{/* 顶部统计卡片 */}
<Row gutter={[10, 10]} style={{ marginBottom: 12 }}>
<Row gutter={[8, 8]} style={{ marginBottom: 8 }}>
{topCards.map((item, idx) => (
<Col key={idx} xs={12} sm={8} md={4} style={{ flex: 1 }}>
<Col key={idx} style={{ minWidth: '168px', flex: '1 0 auto', maxWidth: "250px" }}>
<AntdCard bordered={false} bodyStyle={{ padding: '12px 16px' }} style={{ borderRadius: 10, boxShadow: '0 2px 8px rgba(0,0,0,0.04)' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
<div style={{ width: 40, height: 40, borderRadius: 10, background: item.bg, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
@@ -203,14 +193,14 @@ const BasicSettings = () => {
))}
</Row>
<Row gutter={12}>
<Row gutter={[8, 8]}>
{/* 左侧 */}
<Col xs={24} xl={17}>
{/* 基础配置 */}
<AntdCard
title={<Space><SettingOutlined style={{ color: '#1677ff' }} /><b>基础配置</b></Space>}
bordered={false}
style={{ borderRadius: 10, marginBottom: 12, boxShadow: '0 2px 8px rgba(0,0,0,0.04)' }}
style={{ borderRadius: 10, marginBottom: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.04)' }}
bodyStyle={{ padding: '16px' }}
>
<Form form={form} layout="vertical">
@@ -291,10 +281,10 @@ const BasicSettings = () => {
<AntdCard
title={<Space><BellOutlined style={{ color: '#1677ff' }} /><b>通知与告警策略</b></Space>}
bordered={false}
style={{ borderRadius: 10, marginBottom: 12, boxShadow: '0 2px 8px rgba(0,0,0,0.04)' }}
style={{ borderRadius: 10, marginBottom: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.04)' }}
bodyStyle={{ padding: '16px' }}
>
<Row gutter={[12, 12]} style={{ marginBottom: 16 }}>
<Row gutter={[12, 12]} style={{ marginBottom: 8 }}>
{[
{ label: '短信', icon: <Smartphone size={16} />, color: '#52c41a', status: '已启用' },
{ label: '邮件', icon: <Mail size={16} />, color: '#1677ff', status: '已启用' },
@@ -340,6 +330,10 @@ const BasicSettings = () => {
<Table
size="small"
scroll={{ x: 'max-content' }}
rowStyle={{ height: '32px', padding: 0 }}
empty={false}
pagination={{ size: 'small', total: 4, pageSize: 4, showTotal: (total) => `共 ${total} 条` }}
columns={[
{ title: '用户名', dataIndex: 'name', key: 'name', fixed: 'left', width: 80 },
@@ -391,7 +385,7 @@ const BasicSettings = () => {
<AntdCard
title={<Space><Users size={16} style={{ color: '#1677ff' }} /><b>角色权限概览</b></Space>}
bordered={false}
style={{ borderRadius: 10, marginBottom: 12, boxShadow: '0 2px 8px rgba(0,0,0,0.04)' }}
style={{ borderRadius: 10, marginBottom: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.04)' }}
bodyStyle={{ padding: '10px' }}
>
<Row gutter={[8, 8]}>
@@ -422,7 +416,7 @@ const BasicSettings = () => {
title={<Space><ApiOutlined style={{ color: '#1677ff' }} /><b>设备接入状态</b></Space>}
extra={<Button type="link" size="small" style={{ fontSize: 11, padding: 0 }}>详情 <RightOutlined style={{ fontSize: 9 }} /></Button>}
bordered={false}
style={{ borderRadius: 10, marginBottom: 12, boxShadow: '0 2px 8px rgba(0,0,0,0.04)' }}
style={{ borderRadius: 10, marginBottom: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.04)' }}
bodyStyle={{ padding: '12px' }}
>
<div style={{ display: 'flex', gap: 12 }}>
@@ -481,7 +475,7 @@ const BasicSettings = () => {
<AntdCard
title={<Space><Shield size={16} style={{ color: '#1677ff' }} /><b>数据与安全</b></Space>}
bordered={false}
style={{ borderRadius: 10, marginBottom: 12, boxShadow: '0 2px 8px rgba(0,0,0,0.04)' }}
style={{ borderRadius: 10, marginBottom: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.04)' }}
bodyStyle={{ padding: '12px' }}
>
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(120px, 1fr))', gap: '10px 16px' }}>

View File

@@ -278,7 +278,7 @@ export default function AlarmCenterPage() {
<div style={{ background: '#f5f7fa', minHeight: '100vh', padding: '16px 24px' }}>
{/* 查询栏 */}
<Row gutter={16} style={{ marginBottom: 16 }}>
<Row gutter={8} style={{ marginBottom: 8 }}>
<Col span={24}>
<Card bordered={false} bodyStyle={{ padding: '16px 24px' }} style={{ borderRadius: 8 }}>
<Row gutter={[24, 16]} align="middle">
@@ -357,7 +357,7 @@ export default function AlarmCenterPage() {
</Row>
{/* 统计卡片 */}
<Row gutter={[16, 16]} style={{ marginBottom: 16, flexWrap: 'wrap' }}>
<Row gutter={[8, 8]} style={{ marginBottom: 8, flexWrap: 'wrap' }}>
{[
{
title: '今日告警总数',
@@ -446,7 +446,7 @@ export default function AlarmCenterPage() {
</Row>
{/* 表格 */}
<Row gutter={16} style={{ marginBottom: 16 }}>
<Row gutter={16} style={{ marginBottom: 8 }}>
<Col flex="auto" style={{ minWidth: 0 }}>
<Card bordered={false} bodyStyle={{ padding: '16px 24px' }} style={{ borderRadius: 8 }}>
<Spin spinning={loading}>

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>

View File

@@ -106,10 +106,10 @@ export default function WayLinePage() {
];
return (
<div style={{ background: '#f5f7fa', minHeight: '100vh', padding: '0' }}>
<div className="normal-spacing" style={{ background: '#f5f7fa', minHeight: '100vh', padding: '16px' }}>
<Row gutter={[8, 8]} style={{ marginBottom: 10 }}>
<Row gutter={[16, 16]} style={{ marginBottom: 16 }}>
{topCards.map((item, index) => (
<Col xs={12} sm={8} md={4} key={index}>
<Card bordered={false} bodyStyle={{ padding: '12px 14px' }} style={cardStyle}>