中英文切换 初始化

This commit is contained in:
mmc
2026-08-12 11:29:44 +08:00
parent 541e16f742
commit a8af55a856
76 changed files with 5847 additions and 1962 deletions

View File

@@ -23,36 +23,39 @@ import {
getTargetDemo
} from '../api/aiAnalysis';
import utils from '../lib/utils';
import { useTranslation } from 'react-i18next';
const { Title, Text } = Typography;
const { Dragger } = Upload;
const { Option } = Select;
// 算法列表定义
const algorithmList = [
{
id: 'detect',
name: '目标检测',
alias: 'waterway-trt',
desc: '图片/视频检测,创建任务后轮询结果。',
icon: <AimOutlined />,
status: '运行中'
},
{
id: 'segmentation',
name: '热成像分割',
alias: 'v1.0.0',
desc: '热成像热点、面板分区和温度统计。',
icon: <FireOutlined />,
status: '运行中'
}
];
export default function Agri() {
const { t } = useTranslation();
const [activeAlgo, setActiveAlgo] = useState('detect');
const [models, setModels] = useState([]);
const [loadingModels, setLoadingModels] = useState(false);
const [history, setHistory] = useState([]);
const algorithmList = [
{
id: 'detect',
name: '目标检测',
alias: 'waterway-trt',
desc: '图片/视频检测,创建任务后轮询结果。',
icon: <AimOutlined />,
status: t('devices.running')
},
{
id: 'segmentation',
name: '热成像分割',
alias: 'v1.0.0',
desc: '热成像热点、面板分区和温度统计。',
icon: <FireOutlined />,
status: t('devices.running')
}
];
// 检测任务状态
const [detectForm, setDetectForm] = useState({
@@ -4390,7 +4393,7 @@ export default function Agri() {
} else if (['failed', 'cancelled'].includes(statusRes.status)) {
clearInterval(pollTimer.current);
setPolling(false);
utils.message.error(`任务执行${statusRes.status === 'failed' ? '失败' : '被取消'}`);
utils.message.error(`任务执行${statusRes.status === 'failed' ? t('common.failure') : '被取消'}`);
}
} catch (err) {
console.error('轮询失败', err);
@@ -4575,7 +4578,7 @@ export default function Agri() {
size="small"
>
<Radio.Button value="image">图片</Radio.Button>
<Radio.Button value="video">视频</Radio.Button>
<Radio.Button value="video">{t('constants.sourceVideo')}</Radio.Button>
</Radio.Group>
</Col>
<Col span={12}>
@@ -4586,7 +4589,7 @@ export default function Agri() {
size="small"
>
<Radio.Button value="quality">质量</Radio.Button>
<Radio.Button value="speed">速度</Radio.Button>
<Radio.Button value="speed">{t('devices.speed')}</Radio.Button>
</Radio.Group>
</Col>
</Row>
@@ -4962,7 +4965,7 @@ export default function Agri() {
bodyStyle={{ padding: '12px 8px' }}
>
<Statistic
title={<span style={{ fontSize: 15, color: '#86909C' }}>最高温度</span>}
title={<span style={{ fontSize: 15, color: '#86909C' }}>{t('aiAnalysis.maxTemperature')}</span>}
value={hasResult ? `${segResult.summary?.max_temp_c || 0}℃` : '-'}
titleStyle={{ fontSize: 12, color: '#333', marginBottom: 4 }}
valueStyle={{ fontSize: 18, fontWeight: 600, color: '#FF7D00' }}
@@ -5101,7 +5104,7 @@ export default function Agri() {
</div>
{[
{ label: '温度', value: `${selectedPoint.peak_temp_c}℃` },
{ label: t('home.temperature'), value: `${selectedPoint.peak_temp_c}℃` },
{ label: '块号', value: selectedPoint.panel_id || '-' },
{ label: 'GPS', value: selectedPoint.gps?.text || '-' },
{ label: '原图像素', value: `${selectedPoint.peak_x}, ${selectedPoint.peak_y}` },