中英文切换
This commit is contained in:
@@ -28,7 +28,7 @@ const alarmLevelConfig = {
|
||||
|
||||
const handleStatusMap = {
|
||||
1: t('constants.pending'),
|
||||
2: '处理中',
|
||||
2: t('alerts.processing'),
|
||||
3: t('constants.closed'),
|
||||
4: t('constants.ignored')
|
||||
};
|
||||
@@ -79,7 +79,7 @@ const AlarmHistory = () => {
|
||||
setTotal(res.total || 0);
|
||||
}
|
||||
} catch (err) {
|
||||
message.error('加载失败');
|
||||
message.error(t('common.loadFailed'));
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -94,10 +94,10 @@ const AlarmHistory = () => {
|
||||
setCurrentAlarm(res.data);
|
||||
setDrawerVisible(true);
|
||||
} else {
|
||||
message.error('获取详情失败');
|
||||
message.error(t('common.loadDetailFailed'));
|
||||
}
|
||||
} catch (err) {
|
||||
message.error('请求异常');
|
||||
message.error(t('common.requestError'));
|
||||
} finally {
|
||||
setDetailLoading(false);
|
||||
}
|
||||
@@ -129,14 +129,14 @@ const AlarmHistory = () => {
|
||||
|
||||
// 表格列
|
||||
const columns = [
|
||||
{ title: '告警编号', dataIndex: 'alarmNo', width: 180 },
|
||||
{ title: t('alerts.alarmNo'), dataIndex: 'alarmNo', width: 180 },
|
||||
{
|
||||
title: t('alerts.alertTime'),
|
||||
dataIndex: 'alarmTime',
|
||||
width: 190,
|
||||
render: (t) => t ? dayjs(t).format('YYYY-MM-DD HH:mm:ss') : '-'
|
||||
},
|
||||
{ title: '设备ID', dataIndex: 'deviceId', width: 160 },
|
||||
{ title: t('common.deviceId'), dataIndex: 'deviceId', width: 160 },
|
||||
{ title: t('devices.deviceName'), dataIndex: 'deviceName', ellipsis: true },
|
||||
{
|
||||
title: t('alerts.alertType'),
|
||||
@@ -153,8 +153,8 @@ const AlarmHistory = () => {
|
||||
</Tag>
|
||||
)
|
||||
},
|
||||
{ title: '告警标题', dataIndex: 'alarmTitle', ellipsis: true, width: 180 },
|
||||
{ title: '告警内容', dataIndex: 'alarmContent', ellipsis: true },
|
||||
{ title: t('alerts.alarmTitle'), dataIndex: 'alarmTitle', ellipsis: true, width: 180 },
|
||||
{ title: t('alerts.alarmContent'), dataIndex: 'alarmContent', ellipsis: true },
|
||||
{
|
||||
title: t('alerts.handleStatus'),
|
||||
width: 110,
|
||||
@@ -174,7 +174,7 @@ const AlarmHistory = () => {
|
||||
fixed: 'right',
|
||||
render: (_, r) => (
|
||||
<Button type="link" icon={<EyeOutlined />} onClick={() => showDetail(r.id)}>
|
||||
查看详情
|
||||
{t('common.viewDetail')}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
@@ -182,7 +182,7 @@ const AlarmHistory = () => {
|
||||
|
||||
return (
|
||||
<div style={{ padding: 24, background: '#f5f7fa', minHeight: '100vh' }}>
|
||||
<Card title="告警历史" style={{ borderRadius: 8 }}>
|
||||
<Card title={t('alerts.alarmHistory')} style={{ borderRadius: 8 }}>
|
||||
<Form
|
||||
form={form}
|
||||
layout="inline"
|
||||
@@ -190,9 +190,9 @@ const AlarmHistory = () => {
|
||||
style={{ marginBottom: 16, flexWrap: 'wrap', gap: 16 }}
|
||||
>
|
||||
{/* 设备ID */}
|
||||
<Form.Item name="deviceId" label="设备ID">
|
||||
<Input placeholder="请输入设备ID" style={{ width: 160 }} allowClear />
|
||||
</Form.Item>
|
||||
<Form.Item name="deviceId" label={t('common.deviceId')}>
|
||||
<Input placeholder={t('common.pleaseInputDeviceId')} style={{ width: 160 }} allowClear />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name="alarmLevel" label={t('alerts.alertLevel')}>
|
||||
<Select placeholder={t('common.all')} style={{ width: 130 }} allowClear>
|
||||
@@ -221,7 +221,7 @@ const AlarmHistory = () => {
|
||||
</Form.Item>
|
||||
|
||||
{/* 时间范围 */}
|
||||
<Form.Item name="timeRange" label="时间范围">
|
||||
<Form.Item name="timeRange" label={t('common.timeRange')}>
|
||||
<RangePicker
|
||||
showTime
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
@@ -254,24 +254,24 @@ const AlarmHistory = () => {
|
||||
onChange={(p, s) => { setPageNum(p); setPageSize(s); }}
|
||||
showSizeChanger
|
||||
showQuickJumper
|
||||
showTotal={(total) => `共 ${total} 条`}
|
||||
showTotal={(total) => `${t('common.total')} ${total} ${t('common.items')}`}
|
||||
/>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
{/* 右侧详情抽屉 */}
|
||||
<Drawer
|
||||
title="告警详情"
|
||||
title={t('alerts.alertDetail')}
|
||||
open={drawerVisible}
|
||||
onClose={() => setDrawerVisible(false)}
|
||||
width={650}
|
||||
destroyOnClose
|
||||
>
|
||||
<Descriptions column={1} bordered size="small" loading={detailLoading}>
|
||||
<Descriptions.Item label="告警编号">{currentAlarm?.alarmNo || '-'}</Descriptions.Item>
|
||||
<Descriptions.Item label="告警标题">{currentAlarm?.alarmTitle || '-'}</Descriptions.Item>
|
||||
<Descriptions.Item label="告警内容">{currentAlarm?.alarmContent || '-'}</Descriptions.Item>
|
||||
<Descriptions.Item label="设备ID">{currentAlarm?.deviceId || '-'}</Descriptions.Item>
|
||||
<Descriptions.Item label={t('alerts.alarmNo')}>{currentAlarm?.alarmNo || '-'}</Descriptions.Item>
|
||||
<Descriptions.Item label={t('alerts.alarmTitle')}>{currentAlarm?.alarmTitle || '-'}</Descriptions.Item>
|
||||
<Descriptions.Item label={t('alerts.alarmContent')}>{currentAlarm?.alarmContent || '-'}</Descriptions.Item>
|
||||
<Descriptions.Item label={t('common.deviceId')}>{currentAlarm?.deviceId || '-'}</Descriptions.Item>
|
||||
<Descriptions.Item label={t('devices.deviceName')}>{currentAlarm?.deviceName || '-'}</Descriptions.Item>
|
||||
<Descriptions.Item label={t('alerts.alertTime')}>
|
||||
{currentAlarm?.alarmTime ? dayjs(currentAlarm.alarmTime).format('YYYY-MM-DD HH:mm:ss') : '-'}
|
||||
@@ -298,36 +298,36 @@ const AlarmHistory = () => {
|
||||
{currentAlarm?.handleTime ? dayjs(currentAlarm.handleTime).format('YYYY-MM-DD HH:mm:ss') : '-'}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label={t('alerts.handleRemark')}>{currentAlarm?.handleRemark || '-'}</Descriptions.Item>
|
||||
<Descriptions.Item label="根因分析">{currentAlarm?.rootCause || '-'}</Descriptions.Item>
|
||||
<Descriptions.Item label="推荐处理措施">
|
||||
<Descriptions.Item label={t('alerts.rootCause')}>{currentAlarm?.rootCause || '-'}</Descriptions.Item>
|
||||
<Descriptions.Item label={t('alerts.recommendedAction')}>
|
||||
{currentAlarm?.handleSuggestion || '-'}
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
|
||||
{/* 通知订阅模块 */}
|
||||
{currentAlarm && (
|
||||
<Card size="small" title="通知订阅" style={{ marginTop: 16 }}>
|
||||
<Space style={{ width: '100%' }}>
|
||||
<Space>
|
||||
<span>短信:</span>
|
||||
<Tag color={currentAlarm.notifySms === 1 ? 'green' : 'default'}>
|
||||
{currentAlarm.notifySms === 1 ? '已开启' : t('constants.closed')}
|
||||
</Tag>
|
||||
</Space>
|
||||
<Space>
|
||||
<span>钉钉:</span>
|
||||
<Tag color={currentAlarm.notifyTelegram === 1 ? 'green' : 'default'}>
|
||||
{currentAlarm.notifyTelegram === 1 ? '已开启' : t('constants.closed')}
|
||||
</Tag>
|
||||
</Space>
|
||||
<Space>
|
||||
<span>邮件:</span>
|
||||
<Tag color={currentAlarm.notifyEmail === 1 ? 'green' : 'default'}>
|
||||
{currentAlarm.notifyEmail === 1 ? '已开启' : t('constants.closed')}
|
||||
</Tag>
|
||||
</Space>
|
||||
<Card size="small" title={t('alerts.notifySubscription')} style={{ marginTop: 16 }}>
|
||||
<Space style={{ width: '100%' }}>
|
||||
<Space>
|
||||
<span>{t('alerts.sms')}:</span>
|
||||
<Tag color={currentAlarm.notifySms === 1 ? 'green' : 'default'}>
|
||||
{currentAlarm.notifySms === 1 ? t('common.enabled') : t('constants.closed')}
|
||||
</Tag>
|
||||
</Space>
|
||||
</Card>
|
||||
<Space>
|
||||
<span>{t('alerts.dingTalk')}:</span>
|
||||
<Tag color={currentAlarm.notifyTelegram === 1 ? 'green' : 'default'}>
|
||||
{currentAlarm.notifyTelegram === 1 ? t('common.enabled') : t('constants.closed')}
|
||||
</Tag>
|
||||
</Space>
|
||||
<Space>
|
||||
<span>{t('alerts.email')}:</span>
|
||||
<Tag color={currentAlarm.notifyEmail === 1 ? 'green' : 'default'}>
|
||||
{currentAlarm.notifyEmail === 1 ? t('common.enabled') : t('constants.closed')}
|
||||
</Tag>
|
||||
</Space>
|
||||
</Space>
|
||||
</Card>
|
||||
)}
|
||||
</Drawer>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user