中英文切换根据已有的功能 已经基本完善

This commit is contained in:
mmc
2026-08-14 13:33:13 +08:00
parent 62b03bba03
commit 027455272b
18 changed files with 561 additions and 481 deletions

View File

@@ -161,11 +161,11 @@ const BasicSettings = () => {
const deviceStatuses = [
{ name: t('home.inverter'), count: '5/5', status: t('roles.normal') },
{ name: t('home.combinerBox'), count: '20/20', status: t('roles.normal') },
{ name: '气象站', count: '1/1', status: t('roles.normal') },
{ name: t('home.WeatherStation'), count: '1/1', status: t('roles.normal') },
{ name: t('devices.camera'), count: '12/12', status: t('roles.normal') },
{ name: t('constants.uav'), count: '2/2', status: t('roles.normal') },
{ name: t('devices.robot'), count: '5/5', status: t('roles.normal') },
{ name: 'API接口', count: t('roles.normal'), status: t('roles.normal') },
{ name: t('systemSetting.api'), count: t('roles.normal'), status: t('roles.normal') },
{ name: 'Modbus', count: t('roles.normal'), status: t('roles.normal') },
];
@@ -204,7 +204,7 @@ const BasicSettings = () => {
<Col xs={24} xl={17}>
{/* 基础配置 */}
<AntdCard
title={<Space><SettingOutlined style={{ color: '#1677ff' }} /><b>{t('systemSetting.s02')}</b></Space>}
title={<Space><SettingOutlined style={{ color: '#1677ff' }} /><b>{t('systemSetting.basicSettings')}</b></Space>}
bordered={false}
style={{ borderRadius: 10, marginBottom: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.04)' }}
bodyStyle={{ padding: '16px' }}
@@ -292,10 +292,10 @@ const BasicSettings = () => {
>
<Row gutter={[12, 12]} style={{ marginBottom: 8 }}>
{[
{ label: t('alerts.sms'), icon: <Smartphone size={16} />, color: '#52c41a', status: '已启用' },
{ label: t('alerts.email'), icon: <Mail size={16} />, color: '#1677ff', status: '已启用' },
{ label: 'Telegram', icon: <Send size={16} />, color: '#13c2c2', status: '已启用' },
{ label: t('report.systemNotification'), icon: <BellOutlined style={{ fontSize: 16 }} />, color: '#fa8c16', status: '已启用' },
{ label: t('alerts.sms'), icon: <Smartphone size={16} />, color: '#52c41a', status: `${t('alerts.enabled')}` },
{ label: t('alerts.email'), icon: <Mail size={16} />, color: '#1677ff', status: `${t('alerts.enabled')}` },
{ label: 'Telegram', icon: <Send size={16} />, color: '#13c2c2', status: `${t('alerts.enabled')}` },
{ label: t('report.systemNotification'), icon: <BellOutlined style={{ fontSize: 16 }} />, color: '#fa8c16', status: `${t('alerts.enabled')}` },
].map((item, idx) => (
<Col xs={24} sm={12} lg={6} key={idx}>
<div style={{ display: 'flex', alignItems: 'center', padding: '10px 12px', background: '#f8fafc', borderRadius: 8, border: '1px solid #f1f5f9' }}>
@@ -315,10 +315,10 @@ const BasicSettings = () => {
<Col xs={24} sm={12} md={8}><Space size={8}><span style={{ fontSize: fontSmall }}>{t('systemSetting.fixed2CriticalAlert')}</span><Switch size="small" defaultChecked /></Space></Col>
<Col xs={24} sm={12} md={8}><Space size={8}><span style={{ fontSize: fontSmall }}>{t('systemSetting.fixed2GenerationFixed2Descend15')}</span><Switch size="small" defaultChecked /></Space></Col>
<Col xs={24} sm={12} md={8}><Space size={8}><span style={{ fontSize: fontSmall }}>{t('systemSetting.fixed2Communicating')}</span><Switch size="small" defaultChecked /></Space></Col>
<Col xs={24} sm={12} md={8}><Space size={8}><span style={{ fontSize: fontSmall }}>{t('systemSetting.s122')}</span><Switch size="small" defaultChecked /></Space></Col>
<Col xs={24} sm={12} md={8}><Space size={8}><span style={{ fontSize: fontSmall }}>{t('systemSetting.everydayPush')}</span><Switch size="small" defaultChecked /></Space></Col>
<Col xs={24} md={16}>
<Space size="middle" style={{ flexWrap: 'wrap' }}>
<span style={{ fontSize: fontSmall }}>{t('systemSetting.s132')}</span>
<span style={{ fontSize: fontSmall }}>{t('systemSetting.Nighttime')}</span>
<TimePicker.RangePicker size="small" defaultValue={[dayjs('23:00', 'HH:mm'), dayjs('07:00', 'HH:mm')]} format="HH:mm" style={{ width: 140 }} />
<Switch size="small" />
</Space>
@@ -328,7 +328,7 @@ const BasicSettings = () => {
{/* 用户与权限预览 */}
<AntdCard
title={<Space><Users size={16} style={{ color: '#1677ff' }} /><b>{t('systemSetting.s142')}</b></Space>}
title={<Space><Users size={16} style={{ color: '#1677ff' }} /><b>{t('systemSetting.fixed2RolePermissionFixed2OverviewFixed2')}</b></Space>}
bordered={false}
style={{ borderRadius: 10, boxShadow: '0 2px 8px rgba(0,0,0,0.04)', marginBottom: 0 }}
bodyStyle={{ padding: '12px' }}
@@ -466,7 +466,7 @@ const BasicSettings = () => {
{[
{ x: 60, y: 40, icon: <Cpu size={10} />, label: t('home.inverter') },
{ x: 140, y: 40, icon: <Box size={10} />, label: t('home.combinerBox') },
{ x: 160, y: 80, icon: <Wind size={10} />, label: t('video.s0') },
{ x: 160, y: 80, icon: <Wind size={10} />, label: t('video.WeatherStation') },
{ x: 140, y: 120, icon: <Camera size={10} />, label: t('devices.camera') },
{ x: 60, y: 120, icon: <Activity size={10} />, label: t('devices.robot') },
{ x: 40, y: 80, icon: <Zap size={10} />, label: t('systemSetting.s38') },

View File

@@ -356,7 +356,7 @@ export default function DroneManagement({
pageSize: droneParams.pageSize,
total: droneTotal,
showSizeChanger: true,
showTotal: t => `${t('common.total')} ${t} ${t('common.items')}`,
showTotal: r => `${t('common.total')} ${r} ${t('common.items')}`,
onChange: (page, pageSize) => {
setDroneParams({ ...droneParams, pageNum: page, pageSize });
},

View File

@@ -171,7 +171,7 @@ export default function MenuList() {
)}
<Button type="text" icon={<EditOutlined />} onClick={() => handleEdit(record)}>{t('roles.edit')}</Button>
<Popconfirm title={t('common.confirmDelete')} onConfirm={() => handleDelete(record.menuId)}>
<Button type="text" danger>roles.delete</Button>
<Button type="text" danger>{t('roles.delete')}</Button>
</Popconfirm>
</Space>
),
@@ -212,7 +212,7 @@ export default function MenuList() {
{/* 菜单弹窗 */}
<Modal
title={editMenu ? '编辑菜单' : '新增菜单'}
title={editMenu ? t('systemSetting.editMenu') : t('systemSetting.addMenu')}
open={menuModal}
width={600}
onCancel={() => setMenuModal(false)}

View File

@@ -115,7 +115,7 @@ const OnlineUserPage = () => {
/>
</div>
<div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
<span>profile.username</span>
<span>{t('profile.username')}</span>
<Input
placeholder={t('systemSetting.fixed2PleaseEnterFixed2UsernameFixed2')}
value={searchParams.userName}

View File

@@ -404,7 +404,7 @@ export default function SmartDeviceManagement({
pageSize: smartParams.pageSize,
total: smartTotal,
showSizeChanger: true,
showTotal: (t) => `${t('common.total')} ${t} ${t('common.items')}`,
showTotal: (r) => `${t('common.total')} ${r} ${t('common.items')}`,
onChange: (page, pageSize) => {
setSmartParams({ pageNum: page, pageSize });
},

View File

@@ -264,7 +264,7 @@ export default function StationManage() {
<Button icon={<BgColorsOutlined />} onClick={() => handleOpenArea(record)}>{t('systemSetting.settingsFixed2')}</Button>
<Button onClick={() => handleOpenMap(record)}>{t('systemSetting.s110')}</Button>
<Popconfirm title={t('common.confirmDelete')} onConfirm={() => handleDelete(record.id)}>
<Button danger>roles.delete</Button>
<Button danger>{t('roles.delete')}</Button>
</Popconfirm>
</Space>
)
@@ -319,7 +319,7 @@ export default function StationManage() {
{/* 场站弹窗 */}
<Modal
title={editRecord ? '编辑场站' : '新增场站'}
title={editRecord ? t('systemSetting.editSite') : t('systemSetting.addSite')}
open={modalVisible}
width={680}
onCancel={() => setModalVisible(false)}
@@ -497,9 +497,9 @@ export default function StationManage() {
footer={null}
>
<div style={{ height: 400, background: '#f5f5f5', borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'center', flexDirection: 'column' }}>{t('systemSetting.area')}<Space style={{ marginTop: 20 }}>
<Button type="primary">{t('systemSetting.s8')}</Button>
<Button>{t('systemSetting.fixed2Save')}</Button>
</Space>
<Button type="primary">{t('systemSetting.s8')}</Button>
<Button>{t('systemSetting.fixed2Save')}</Button>
</Space>
</div>
</Modal>
</div>

View File

@@ -410,7 +410,7 @@ export default function UserRolePage() {
<div style={{ marginBottom: 16, display: 'flex', justifyContent: 'space-between' }}>
{selectedUserIds.length > 0 && (
<Button danger onClick={handleBatchDeleteUsers}>
批量删除(已选 {selectedUserIds.length} 项)
{t('systemSetting.batchDelete')} {selectedUserIds.length} {t('systemSetting.deleteUnit')}
</Button>
)}
<Button type="primary" icon={<PlusOutlined />} onClick={handleAddUser}>{t('users.addUser')}</Button>
@@ -498,7 +498,7 @@ export default function UserRolePage() {
<div style={{ marginBottom: 16, display: 'flex', justifyContent: 'space-between' }}>
{selectedRoleIds.length > 0 && (
<Button danger onClick={handleBatchDeleteRoles}>
批量删除(已选 {selectedRoleIds.length} 项)
{t("systemSetting.batchDelete")}{selectedRoleIds.length}{t("systemSetting.deleteunit")}
</Button>
)}
<Button type="primary" icon={<PlusOutlined />} onClick={handleAddRole}>{t('roles.addRole')}</Button>
@@ -512,7 +512,7 @@ export default function UserRolePage() {
actions={[
<Button type="text" icon={<EditOutlined />} onClick={() => handleEditRole(r)}>{t('roles.edit')}</Button>,
<Popconfirm onConfirm={() => handleDeleteRole(r.roleId)} title={t('common.confirmDelete')}>
<Button type="text" danger>roles.delete</Button>
<Button type="text" danger>{t('roles.delete')}</Button>
</Popconfirm>
]}
>
@@ -532,8 +532,8 @@ export default function UserRolePage() {
title={<strong>{r.roleName}</strong>}
description={
<Space direction="vertical" size={2}>
<span>权限:{r.roleKey}</span>
<span>等级:{r.roleLevel || '-'}</span>
<span>{t('systemSetting.permission')}:{r.roleKey}</span>
<span>{t('systemSetting.level')}:{r.roleLevel || '-'}</span>
{/*{r.roleKey == "admin1" && <Tag color="red">{t('roles.superAdmin')}</Tag>}*/}
</Space>
}
@@ -566,7 +566,7 @@ export default function UserRolePage() {
{/* 角色弹窗 */}
<Modal
title={editRole ? '编辑角色' : t('roles.addRole')}
title={editRole ? t('roles.editRole') : t('roles.addRole')}
open={roleModalVisible}
onCancel={() => setRoleModalVisible(false)}
onOk={handleSaveRole}
@@ -600,7 +600,7 @@ export default function UserRolePage() {
{userInfo?.roleId == 23 && (
<>
<Divider>roles.menuPermissions</Divider>
<Divider>{t("roles.menuPermissions")}</Divider>
<Tree
checkable
treeData={menuTree}

View File

@@ -182,9 +182,7 @@ const VideoManagement = () => {
<div style={{ padding: '8px 0px', background: '#f5f7fa', minHeight: '100vh' }}>
<div style={{ marginBottom: 8 }}>
<Title level={4} style={{ margin: 0, fontSize: 'clamp(14px, 1.1vw, 18px)' }}>{t('router.videoManage')}</Title>
<Text type="secondary" style={{ fontSize: 12 }}>
录像通道与回放管理 · 共 {channels.length} 个通道
</Text>
</div>
<Card bordered={false} style={{ borderRadius: 10, marginBottom: 8 }} bodyStyle={{ padding: 12 }}>

View File

@@ -178,7 +178,6 @@ const WorkOrderModelManagement: React.FC = () => {
}, [stationId]);
const handleAdd = () => {
const { t } = useTranslation();
setEditingItem(null);
form.resetFields();
setSelectedDeviceType(null);

View File

@@ -474,31 +474,31 @@ export default function DeviceOverviewPage() {
title: t('devices.fixed2DroneAirportFixed2StatusFixed2'),
icon: <EnvironmentOutlined style={{ color: '#165DFF', fontSize: 24 }} />,
value: `${onlineDrones} / ${totalDrones}`,
sub: `可调度 ${onlineDrones} 架`,
sub: `${t('devices.distributable')} ${onlineDrones} ${t('devices.UnitsDrone')}`,
color: '#165DFF',
iconBg: '#E8F3FF'
},
{
title: t('home.inspectionRobot'),
icon: <RobotOutlined style={{ color: '#13c2c2', fontSize: 24 }} />,
value: `${totalRobots} 台`,
sub: `执行中 ${activeRobots}`,
value: `${totalRobots} ${t('devices.UnitsRobot')}`,
sub: `${t('devices.executing')} ${activeRobots}`,
color: '#13c2c2',
iconBg: '#E6FFFA'
},
{
title: t('devices.mowingRobot'),
icon: <CarOutlined style={{ color: '#722ED1', fontSize: 24 }} />,
value: `${totalMowers} 台`,
sub: `任务中 ${activeMowers}`,
value: `${totalMowers} ${t('devices.UnitsRobot')}`,
sub: `${t('devices.executing')} ${activeMowers}`,
color: '#722ED1',
iconBg: '#F9F0FF'
},
{
title: t('devices.washDrone'),
icon: <CloudOutlined style={{ color: '#eb2f96', fontSize: 24 }} />,
value: `${totalDrones} 架`,
sub: `待命 ${washDroneStandby}`,
value: `${totalDrones} ${t('devices.UnitsDrone')}`,
sub: `${t('devices.waiting')} ${washDroneStandby}`,
color: '#eb2f96',
iconBg: '#FFF1F3'
},
@@ -514,7 +514,7 @@ export default function DeviceOverviewPage() {
title: t('devices.todayTaskExecute'),
icon: <CheckCircleOutlined style={{ color: '#2f54eb', fontSize: 24 }} />,
value: `${completedTasks} / ${totalTasks}`,
sub: `完成率 ${completionRate}%`,
sub: `${t('devices.completionRate')} ${completionRate}%`,
color: '#2f54eb',
iconBg: '#E8F3FF'
},
@@ -779,7 +779,7 @@ export default function DeviceOverviewPage() {
<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(realtimeDevice?.capacity_percent || realtimeDevice?.lastRunningStatus?.battery || 100)}%</span>
<span style={{ fontSize: 12 }}>{t('devices.batteryLevel')}: {fix2(realtimeDevice?.capacity_percent || realtimeDevice?.lastRunningStatus?.battery || 100)}%</span>
</div>
{realtimeDevice?.environment_temperature && (
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>

View File

@@ -1,7 +1,8 @@
import React, { useEffect, useState, useRef } from 'react';
import { useTranslation } from 'react-i18next';
const XboxController = ({ onGamepadUpdate, handleControlModal, isControlled, isConnecting, hasControlRight }) => {
const { t } = useTranslation();
const [gamepadState, setGamepadState] = useState<{
buttons: boolean[];
axes: number[];
@@ -135,15 +136,15 @@ const XboxController = ({ onGamepadUpdate, handleControlModal, isControlled, isC
`}
>
{!connected ? (
'未连接设备'
t('devices.controllerNotConnected')
) : !hasControlRight ? (
'其他 Web 端已连接'
t('devices.otherWebConnected')
) : isConnecting ? (
'请求控制中...'
t('devices.control2')
) : isControlled ? (
'控制中'
t('devices.controlling')
) : (
'点击获取控制权限'
t('devices.clickToRequestControl')
)}
</div>