优化代码消除 控制台的报错信息

This commit is contained in:
mmc
2026-08-31 10:30:21 +08:00
parent 674721504d
commit a1922cdeaf
23 changed files with 259 additions and 214 deletions

View File

@@ -586,8 +586,8 @@ export default function DeviceOverviewPage() {
{dynamicTopCards.map((card, idx) => (
<Col key={idx} style={{ minWidth: '200px', flex: '1 0 auto', maxWidth: "260px" }}>
<Card
bordered={false}
bodyStyle={{ padding: '20px 20px', display: 'flex', alignItems: 'flex-start', justifyContent: 'space-between' }}
variant="borderless"
styles={{ body: { padding: '20px 20px', display: 'flex', alignItems: 'flex-start', justifyContent: 'space-between' } }}
style={{ borderRadius: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)', height: 101 }}
>
{/* 左侧文字区域 */}
@@ -627,7 +627,7 @@ export default function DeviceOverviewPage() {
<Row gutter={[8, 8]}>
<Col xs={24} lg={14}>
<Card title={<><EnvironmentOutlined />{t('devices.fixed2Equipment')}</>} extra={<Button type="text" icon={<SettingOutlined />} />} bordered={false} style={{ borderRadius: 8, marginBottom: 8 }} bodyStyle={{ padding: 0 }}>
<Card title={<><EnvironmentOutlined />{t('devices.fixed2Equipment')}</>} extra={<Button type="text" icon={<SettingOutlined />} />} variant="borderless" style={{ borderRadius: 8, marginBottom: 8 }} styles={{ body: { padding: 0 } }}>
<div style={{ width: '100%', height: 350, borderRadius: 8, position: 'relative', overflow: 'hidden' }}>
<div style={{ position: 'absolute', zIndex: 9999, top: 12, left: 12, background: 'rgba(255,255,255,0.95)', borderRadius: 6, padding: 8 }}>
<div style={{ fontSize: 11, fontWeight: 60, marginBottom: 4 }}>{t('devices.s22')}</div>
@@ -645,7 +645,7 @@ export default function DeviceOverviewPage() {
</div>
</Card>
<Card title={<><SettingOutlined />{t('devices.fixed2EquipmentListFixed2')}</>} bordered={false} style={{ borderRadius: 8, marginBottom: 8 }}>
<Card title={<><SettingOutlined />{t('devices.fixed2EquipmentListFixed2')}</>} variant="borderless" style={{ borderRadius: 8, marginBottom: 8 }}>
<Table rowKey={(record) => record.id || record.serialNumber || record.device_sn} size="small" pagination={false}
columns={[
{ title: t('devices.fixed2EquipmentFixed2NameFixed2'), dataIndex: 'name', width: 140 },
@@ -720,7 +720,7 @@ export default function DeviceOverviewPage() {
/>
</Card>
<Card title={<><SettingOutlined /> <span >{t('devices.fixed2ControlFixed2LogDesc6Alert')}</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' }}>{t('devices.fixed2AllLevels')}</Button></div>}>
<Card title={<><SettingOutlined /> <span >{t('devices.fixed2ControlFixed2LogDesc6Alert')}</span></>} variant="borderless" style={{ borderRadius: 8 }} extra={<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}><Button size="small" style={{ borderRadius: 4, border: '1px solid #d9d9d9' }}>{t('devices.fixed2AllLevels')}</Button></div>}>
<Table rowKey="time" size="small" pagination={false} dataSource={logs} scroll={{ x: 'max-content' }}
columns={[
{ title: t('common.time'), dataIndex: 'time', width: 90, render: t => <span style={{ fontSize: 13 }}>{t}</span> },
@@ -736,7 +736,7 @@ export default function DeviceOverviewPage() {
<Col xs={24} lg={10}>
<Card title={<><SettingOutlined style={{ marginRight: 6, }} />{t('devices.deviceControlPanel')}</>} bordered={false} style={{ borderRadius: 8, marginBottom: 8 }} bodyStyle={{ padding: 12, paddingBottom: 0 }}>
<Card title={<><SettingOutlined style={{ marginRight: 6, }} />{t('devices.deviceControlPanel')}</>} variant="borderless" style={{ borderRadius: 8, marginBottom: 8 }} styles={{ body: { padding: 12, paddingBottom: 0 } }}>
<Select
style={{ width: "80%", marginBottom: 8 }}
placeholder={t('workOrder.selectDeviceFixed2')}
@@ -946,7 +946,7 @@ export default function DeviceOverviewPage() {
)}
</Card>
<Card title={<><ApiOutlined />{t('devices.fixed2AiActions')}</>} bordered={false} style={{ borderRadius: 12, marginBottom: 8 }}>
<Card title={<><ApiOutlined />{t('devices.fixed2AiActions')}</>} variant="borderless" style={{ borderRadius: 12, marginBottom: 8 }}>
<Row gutter={16} style={{ marginBottom: 8 }}>
<Col span={6}><div style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '6px 12px 4px', borderRadius: 12, border: '1px solid #e8e8e8' }}><div style={{ width: 30, height: 30, borderRadius: '50%', background: 'rgba(255,77,79,0.15)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#ff4d4f', fontSize: 20 }}><span role="img" aria-label="hotspot">🔥</span></div><div><div style={{ fontSize: 11, color: '#666' }}>{t('devices.hotspotSuspect')}</div><div style={{ fontSize: 22, fontWeight: 700, color: '#222' }}>2 <span style={{ fontSize: 12 }}>{t('devices.s32')}</span></div></div></div></Col>
<Col span={6}><div style={{ display: 'flex', alignItems: 'center', gap: 10, padding: '6px 12px 4px', borderRadius: 12, border: '1px solid #e8e8e8' }}><div style={{ width: 30, height: 30, borderRadius: '50%', background: 'rgba(82,196,26,0.15)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#52c41a', fontSize: 16 }}><BranchesOutlined /></div><div><div style={{ fontSize: 11, color: '#666' }}>{t('devices.s33')}</div><div style={{ fontSize: 22, fontWeight: 700, color: '#222' }}>3 <span style={{ fontSize: 12 }}>{t('devices.s34')}</span></div></div></div></Col>
@@ -977,7 +977,7 @@ export default function DeviceOverviewPage() {
</Card>
{(selectedDevice?.productName?.includes(t('constants.uav')) || selectedDevice?.device_sn) && (
<Card title={t('devices.s60')} bordered={false} style={{ borderRadius: 12, marginBottom: 8 }}>
<Card title={t('devices.s60')} variant="borderless" style={{ borderRadius: 12, marginBottom: 8 }}>
<div style={{ display: "flex", justifyContent: "space-between", gap: 12, alignItems: "center" }}>
<div style={{ display: "flex", border: "1px solid #e8e8e8", borderRadius: 12, overflow: "hidden", flex: 1 }}>
<div style={{ flex: 1, textAlign: 'center', whiteSpace: "nowrap", padding: "12px 4px", borderRight: "1px solid #e8e8e8" }}><div style={{ fontSize: 11, color: '#666', fontWeight: 600 }}>{t('devices.s44')}</div><div style={{ fontSize: 14, fontWeight: 700, color: '#222', marginTop: 2 }}>{fix2(realtimeDevice?.wind_speed)} m/s</div></div>
@@ -997,7 +997,7 @@ export default function DeviceOverviewPage() {
)}
{(!selectedDevice?.productName?.includes(t('constants.uav')) && !selectedDevice?.device_sn) && (
<Card title={<div style={{ display: 'flex', alignItems: 'center', gap: 8, fontSize: 14, fontWeight: 600 }}><RobotOutlined style={{ color: '#165DFF' }} />{t('devices.fixed2RobotStatusFixed2')}</div>} bordered={false} style={{ borderRadius: 12, marginBottom: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)', border: '1px solid #f0f0f0' }}>
<Card title={<div style={{ display: 'flex', alignItems: 'center', gap: 8, fontSize: 14, fontWeight: 600 }}><RobotOutlined style={{ color: '#165DFF' }} />{t('devices.fixed2RobotStatusFixed2')}</div>} variant="borderless" style={{ borderRadius: 12, marginBottom: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)', border: '1px solid #f0f0f0' }}>
<Row gutter={16} style={{ alignItems: 'center' }}>
<Col span={8}>
<div style={{ padding: '12px 16px', borderRadius: 10, background: '#F7F8FA', textAlign: 'center', border: '1px solid transparent', transition: 'all 0.2s' }}
@@ -1060,7 +1060,7 @@ export default function DeviceOverviewPage() {
</Card>
)}
<Card title={<><ClockCircleOutlined />{t('devices.fixed2TaskSuspended2Fixed2ExecutionTime')}</>} bordered={false} style={{ borderRadius: 12 }} extra={<div style={{ fontSize: 12, color: '#666' }}></div>}>
<Card title={<><ClockCircleOutlined />{t('devices.fixed2TaskSuspended2Fixed2ExecutionTime')}</>} variant="borderless" style={{ borderRadius: 12 }} extra={<div style={{ fontSize: 12, color: '#666' }}></div>}>
<Timeline mode="left">
{taskTimeline.map((item, idx) => (
<Timeline.Item key={idx} color={item.color} label={<div style={{ fontSize: 11, color: '#999' }}>{item.time}</div>}>

View File

@@ -997,9 +997,9 @@ export default function DeviceStatusPage() {
{t('devices.stationVideo')}
</>
}
bordered={false}
variant="borderless"
style={{ borderRadius: 12, marginBottom: 8 }}
bodyStyle={{ padding: 12 }}
styles={{ body: { padding: 12 } }}
>
<div style={{ borderRadius: 8, overflow: 'hidden', height: 300 }}>
<DroneVideoPlayer
@@ -1041,13 +1041,13 @@ export default function DeviceStatusPage() {
setClearPlanLine((v) => v + 1);
}}
>
{t('devices.clearPlannedRoute')}
{t('devices.clearPlanRoute')}
</Button>
</Space>
}
bordered={false}
variant="borderless"
style={{ borderRadius: 12 }}
bodyStyle={{ padding: 12, height: 400 }}
styles={{ body: { padding: 12, height: 400 } }}
>
<CesiumMap
ref={mapRef}
@@ -1077,9 +1077,9 @@ export default function DeviceStatusPage() {
{t('devices.droneVideo')}
</>
}
bordered={false}
variant="borderless"
style={{ borderRadius: 12, marginBottom: 8 }}
bodyStyle={{ padding: 12 }}
styles={{ body: { padding: 12 } }}
>
<div style={{ borderRadius: 8, overflow: 'hidden', height: "100%" }}>
<DroneVideoPlayer
@@ -1106,9 +1106,9 @@ export default function DeviceStatusPage() {
{t('devices.realtimeVideoMonitor')}
</>
}
bordered={false}
variant="borderless"
style={{ borderRadius: 12, marginBottom: 8 }}
bodyStyle={{ padding: 12, height: 'calc(100vh - 220px)', minHeight: 500 }}
styles={{ body: { padding: 12, height: 'calc(100vh - 220px)', minHeight: 500 } }}
extra={
<Button
@@ -1329,13 +1329,13 @@ export default function DeviceStatusPage() {
setClearPlanLine((v) => v + 1);
}}
>
{t('devices.clearPlannedRoute')}
{t('devices.clearPlanRoute')}
</Button>
</Space>
}
bordered={false}
variant="borderless"
style={{ borderRadius: 12, marginBottom: 8, flex: 1, minHeight: 280 }}
bodyStyle={{ padding: 12, height: 'calc((100vh - 260px) / 2)', minHeight: 280 }}
styles={{ body: { padding: 12, height: 'calc((100vh - 260px) / 2)', minHeight: 280 } }}
>
<CesiumMap
ref={mapRef}
@@ -1360,10 +1360,12 @@ export default function DeviceStatusPage() {
{t('devices.remoteControl')}
</>
}
bordered={false}
variant="borderless"
style={{ borderRadius: 12, background: '#0f172a', flex: 1, minHeight: 280, }}
headStyle={{ color: '#fff' }}
bodyStyle={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: 'calc(100% - 57px)' }}
styles={{
header: { color: '#fff', },
body: { display: 'flex', justifyContent: 'center', alignItems: 'center', height: 'calc(100% - 57px)' },
}}
>
<XboxController
onGamepadUpdate={handleGamepadUpdate}

View File

@@ -1110,12 +1110,14 @@ export default function RobotTaskPage() {
{topCards.map((item, index) => (
<Col xs={12} sm={8} md={4} key={index}>
<Card
bordered={false}
bodyStyle={{
padding: '12px 14px',
height: '100%',
display: 'flex',
alignItems: 'center'
variant="borderless"
styles={{
body: {
padding: '12px 14px',
height: '100%',
display: 'flex',
alignItems: 'center'
}
}}
style={{
...cardStyle,
@@ -1211,8 +1213,8 @@ export default function RobotTaskPage() {
{/*<Button size="small" icon={<Maximize2 size={12} />} />*/}
</Space>
}
bordered={false}
bodyStyle={{ padding: 0, position: 'relative' }}
variant="borderless"
styles={{ body: { padding: 0, position: 'relative' } }}
style={{ ...cardStyle, marginBottom: 10 }}
>
<div style={{ width: '100%', height: 420, background: '#e8f3ff center/cover', position: 'relative' }}>
@@ -1305,8 +1307,8 @@ export default function RobotTaskPage() {
{/* 机器人任务模块,带Tab切换 */}
<Card
size="small"
bordered={false}
bodyStyle={{ padding: 0, display: 'flex', flexDirection: 'column', height: "calc(100%)", overflow: "auto" }}
variant="borderless"
styles={{ body: { padding: 0, display: 'flex', flexDirection: 'column', height: "calc(100%)", overflow: "auto" } }}
style={{ ...cardStyle, maxHeight: "300px", flex: 1, marginBottom: 0 }}
>
@@ -1537,31 +1539,52 @@ export default function RobotTaskPage() {
<Col xs={24} xl={10} style={{ display: "flex", flexDirection: "column" }} >
<Card
title={<span style={{ fontSize: fontTitle, fontWeight: 700 }}>{t('devices.operationSuggestion')}</span>}
bordered={false}
bodyStyle={{ padding: '12px 16px' }}
variant="borderless"
styles={{ body: { padding: '12px 16px' } }}
style={{ ...cardStyle, marginBottom: 8 }}
>
<Timeline mode="left">
<Timeline.Item label="09:30" color="green">
<Text strong>{t('devices.timelineMow', { robot: 'RBT-01' })}</Text>
<div style={{ fontSize: 12, color: '#86909C' }}>{t('devices.timelineMowDetail')}</div>
</Timeline.Item>
<Timeline.Item label="11:00" color="blue">
<Text strong>{t('devices.timelineInspect', { robot: 'RBT-02' })}</Text>
<div style={{ fontSize: 12, color: '#86909C' }}>{t('devices.timelineInspectDetail')}</div>
</Timeline.Item>
<Timeline.Item label="14:00" color="gray">
<Text strong>{t('devices.timelineMaintenance')}</Text>
<div style={{ fontSize: 12, color: '#86909C' }}>{t('devices.timelineMaintenanceDetail')}</div>
</Timeline.Item>
</Timeline>
<Timeline
mode="left"
items={[
{
color: 'green',
label: '09:30',
children: (
<>
<Text strong>{t('devices.timelineMow', { robot: 'RBT-01' })}</Text>
<div style={{ fontSize: 12, color: '#86909C' }}>{t('devices.timelineMowDetail')}</div>
</>
)
},
{
color: 'blue',
label: '11:00',
children: (
<>
<Text strong>{t('devices.timelineInspect', { robot: 'RBT-02' })}</Text>
<div style={{ fontSize: 12, color: '#86909C' }}>{t('devices.timelineInspectDetail')}</div>
</>
)
},
{
color: 'gray',
label: '14:00',
children: (
<>
<Text strong>{t('devices.timelineMaintenance')}</Text>
<div style={{ fontSize: 12, color: '#86909C' }}>{t('devices.timelineMaintenanceDetail')}</div>
</>
)
}
]}
/>
<Button type="primary" block style={{ marginTop: 16, borderRadius: 18 }}>{t('devices.autoGenerateTodayPlan')}</Button>
</Card>
<Card
title={<span style={{ fontSize: fontTitle, fontWeight: 700 }}>{t('devices.deviceEnvironment')}</span>}
bordered={false}
bodyStyle={{ padding: '16px' }}
variant="borderless"
styles={{ body: { padding: '16px' } }}
style={{ ...cardStyle, flex: 1 }}
>
<Row gutter={[8, 8]}>
@@ -1613,8 +1636,8 @@ export default function RobotTaskPage() {
/>
</div>
}
bordered={false}
bodyStyle={{ padding: '12px', height: 400, overflow: 'auto' }}
variant="borderless"
styles={{ body: { padding: '12px', height: 400, overflow: 'auto' } }}
style={cardStyle}
>
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
@@ -1745,8 +1768,8 @@ export default function RobotTaskPage() {
<Col xs={24} xl={18}>
<Card
title={<span style={{ fontSize: fontTitle, fontWeight: 700 }}>{t('devices.taskBoard')}</span>}
bordered={false}
bodyStyle={{ padding: '12px' }}
variant="borderless"
styles={{ body: { padding: '12px' } }}
style={{ ...cardStyle, height: '100%' }}
>
<Row gutter={16}>

View File

@@ -831,7 +831,7 @@ export default function WayLinePage({ onRefresh }) {
<Row gutter={[16, 16]} style={{ marginBottom: 8 }}>
{topCards.map((item, index) => (
<Col xs={12} sm={8} md={4} key={index}>
<Card bordered={false} bodyStyle={{ padding: '12px 14px' }} style={cardStyle}>
<Card variant="borderless" styles={{ body: { padding: '12px 14px' } }} style={cardStyle}>
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
<div style={{ width: 36, height: 36, background: item.bg, borderRadius: 10, display: 'flex', justifyContent: 'center', alignItems: 'center', color: item.color }}>
{React.cloneElement(item.icon, { size: 18 })}
@@ -890,8 +890,8 @@ export default function WayLinePage({ onRefresh }) {
<Button size="small" icon={<Maximize2 size={12} />} />
</Space>
}
bordered={false}
bodyStyle={{ padding: 0, position: 'relative' }}
variant="borderless"
styles={{ body: { padding: 0, position: 'relative' } }}
style={{ ...cardStyle, marginBottom: 10 }}
>
<div style={{ width: '100%', height: 420, background: '#e8f3ff url(https://picsum.photos/seed/solar_map_v2/1600/1000) center/cover', position: 'relative' }}>
@@ -957,8 +957,8 @@ export default function WayLinePage({ onRefresh }) {
/>
</Tooltip>
}
bordered={false}
bodyStyle={{ padding: 0, display: 'flex', flexDirection: 'column', height: "calc(100% - 40px)", overflow: "auto" }}
variant="borderless"
styles={{ body: { padding: 0, display: 'flex', flexDirection: 'column', height: "calc(100% - 40px)", overflow: "auto" } }}
style={{ ...cardStyle, maxHeight: "250px", flex: 1, marginBottom: 0 }}
>
<Table
@@ -982,8 +982,8 @@ export default function WayLinePage({ onRefresh }) {
<Col xs={24} xl={10} style={{ display: "flex", flexDirection: "column" }} >
<Card
title={<span style={{ fontSize: fontTitle, fontWeight: 700 }}>{t('devices.taskOrchestrationAI')}</span>}
bordered={false}
bodyStyle={{ padding: '12px 16px' }}
variant="borderless"
styles={{ body: { padding: '12px 16px' } }}
style={{ ...cardStyle, marginBottom: 8 }}
>
<Table
@@ -1025,8 +1025,8 @@ export default function WayLinePage({ onRefresh }) {
<Card
title={<span style={{ fontSize: fontTitle, fontWeight: 700 }}>{t('devices.waylineParamsTitle')}</span>}
extra={<Text type="secondary" style={{ fontSize: 12 }}>{t('devices.currentWayline')}{selectedTask?.name || '-'}</Text>}
bordered={false}
bodyStyle={{ padding: '16px' }}
variant="borderless"
styles={{ body: { padding: '16px' } }}
style={{ ...cardStyle, marginBottom: 8 }}
>
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: '8px', marginBottom: 8 }}>
@@ -1141,8 +1141,8 @@ export default function WayLinePage({ onRefresh }) {
<Card
title={<span style={{ fontSize: fontTitle, fontWeight: 700 }}>{t('devices.weatherWindowTitle')}</span>}
bordered={false}
bodyStyle={{ padding: '16px' }}
variant="borderless"
styles={{ body: { padding: '16px' } }}
style={{ ...cardStyle, flex: 1, }}
>
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(5, 1fr)', gap: '8px', marginBottom: 16 }}>
@@ -1248,8 +1248,8 @@ export default function WayLinePage({ onRefresh }) {
/>
</div>
}
bordered={false}
bodyStyle={{ padding: '12px', display: 'flex', flexDirection: 'column', height: 480 }}
variant="borderless"
styles={{ body: { padding: '12px', display: 'flex', flexDirection: 'column', height: 480 } }}
style={{ ...cardStyle, height: '100%' }}
>
<Input
@@ -1313,8 +1313,8 @@ export default function WayLinePage({ onRefresh }) {
<Card
title={<span style={{ fontSize: fontTitle, fontWeight: 700 }}>{t('devices.ganttViewTitle')} <Text type="secondary" style={{ fontSize: 11, fontWeight: 400, marginLeft: 12 }}></Text></span>}
extra={<MoreOutlined style={{ cursor: 'pointer', fontSize: 18 }} />}
bordered={false}
bodyStyle={{ padding: 16 }}
variant="borderless"
styles={{ body: { padding: 16 } }}
style={{ ...cardStyle, height: '100%' }}
>
<div style={{ position: 'relative', border: '1px solid #F2F3F5', borderRadius: 8, padding: '16px 12px' }}>
@@ -1393,8 +1393,8 @@ export default function WayLinePage({ onRefresh }) {
</Space>
</div>
}
bordered={false}
bodyStyle={{ padding: 16 }}
variant="borderless"
styles={{ body: { padding: 16 } }}
style={{ ...cardStyle, height: '100%', maxHeight: 480, overflow: "auto" }}
>
<Row gutter={10}>