中英文切换 初始化
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
Modal, Form, Input, Select
|
||||
} from 'antd';
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const AntdCard = Card as any;
|
||||
const { Option } = Select;
|
||||
@@ -17,6 +18,7 @@ const mockSub = [
|
||||
];
|
||||
|
||||
const AlarmSubscription = () => {
|
||||
const { t } = useTranslation();
|
||||
const [list, setList] = useState(mockSub);
|
||||
const [filteredList, setFilteredList] = useState(mockSub);
|
||||
const [modalVisible, setModalVisible] = useState(false);
|
||||
@@ -77,19 +79,19 @@ const AlarmSubscription = () => {
|
||||
|
||||
const columns = [
|
||||
{ title: '订阅名称', dataIndex: 'name' },
|
||||
{ title: '设备类型', dataIndex: 'deviceType' },
|
||||
{ title: '告警级别', dataIndex: 'level' },
|
||||
{ title: t('devices.deviceType'), dataIndex: 'deviceType' },
|
||||
{ title: t('alerts.alertLevel'), dataIndex: 'level' },
|
||||
{
|
||||
title: '通知渠道',
|
||||
render: (r) => r.channels.map(i => <Tag key={i}>{i}</Tag>)
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
title: t('roles.actions'),
|
||||
render: (r) => (
|
||||
<Space>
|
||||
<Button type="link" icon={<EditOutlined />} onClick={() => openEdit(r)}>编辑</Button>
|
||||
<Popconfirm title="确定删除?" onConfirm={() => handleDelete(r.id)}>
|
||||
<Button type="link" danger icon={<DeleteOutlined />}>删除</Button>
|
||||
<Button type="link" icon={<EditOutlined />} onClick={() => openEdit(r)}>{t('roles.edit')}</Button>
|
||||
<Popconfirm title={t('common.confirmDelete')} onConfirm={() => handleDelete(r.id)}>
|
||||
<Button type="link" danger icon={<DeleteOutlined />}>{t('roles.delete')}</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
)
|
||||
@@ -99,7 +101,7 @@ const AlarmSubscription = () => {
|
||||
return (
|
||||
<div style={{ padding: 24 }}>
|
||||
<AntdCard
|
||||
title="告警订阅"
|
||||
title={t('alerts.alarmSubscription')}
|
||||
extra={
|
||||
<Space>
|
||||
<Search
|
||||
@@ -134,21 +136,21 @@ const AlarmSubscription = () => {
|
||||
<Input placeholder="请输入订阅名称" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="设备类型" name="deviceType" rules={[{ required: true }]}>
|
||||
<Form.Item label={t('devices.deviceType')} name="deviceType" rules={[{ required: true }]}>
|
||||
<Select>
|
||||
<Option value="all">全部设备</Option>
|
||||
<Option value="sensor">传感器</Option>
|
||||
<Option value="camera">摄像头</Option>
|
||||
<Option value="camera">{t('devices.camera')}</Option>
|
||||
<Option value="battery">电池设备</Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="告警级别" name="level" rules={[{ required: true }]}>
|
||||
<Form.Item label={t('alerts.alertLevel')} name="level" rules={[{ required: true }]}>
|
||||
<Select>
|
||||
<Option value="all">全部级别</Option>
|
||||
<Option value="error">严重</Option>
|
||||
<Option value="warn">警告</Option>
|
||||
<Option value="info">提示</Option>
|
||||
<Option value="error">{t('constants.critical')}</Option>
|
||||
<Option value="warn">{t('constants.warning')}</Option>
|
||||
<Option value="info">{t('constants.info')}</Option>
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user