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

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>}>