中英文切换
This commit is contained in:
@@ -112,7 +112,7 @@ export default function Agri() {
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
utils.message.error('获取模型列表失败');
|
||||
utils.message.error(t('page.listFixed2FailedFixed2'));
|
||||
} finally {
|
||||
setLoadingModels(false);
|
||||
}
|
||||
@@ -185,7 +185,7 @@ export default function Agri() {
|
||||
|
||||
const handleSubmitDetect = async () => {
|
||||
if (detectFiles.length === 0) {
|
||||
utils.message.warning('请先上传图片或视频');
|
||||
utils.message.warning(t('page.uploadImageVideoFixed2'));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ export default function Agri() {
|
||||
addToHistory('detect', res.jobId);
|
||||
}
|
||||
} catch (err) {
|
||||
utils.message.error('提交任务失败');
|
||||
utils.message.error(t('aiAnalysis.submitTaskFailed'));
|
||||
setDetectStatus(null);
|
||||
}
|
||||
};
|
||||
@@ -4372,7 +4372,7 @@ export default function Agri() {
|
||||
setHotLoading(false);
|
||||
|
||||
setSegResult(res);
|
||||
utils.message.success('热成像分析完成');
|
||||
utils.message.success(t('aiAnalysis.thermalAnalysisComplete'));
|
||||
addToHistory('segmentation', res.analysisId || 'seg-' + Date.now());
|
||||
|
||||
}).catch(err => { })
|
||||
@@ -4389,7 +4389,7 @@ export default function Agri() {
|
||||
setPolling(false);
|
||||
const resultRes = await getDetectJobResult(jobId);
|
||||
setDetectResult(resultRes);
|
||||
utils.message.success('任务执行成功');
|
||||
utils.message.success(t('devices.taskExecSuccess'));
|
||||
} else if (['failed', 'cancelled'].includes(statusRes.status)) {
|
||||
clearInterval(pollTimer.current);
|
||||
setPolling(false);
|
||||
@@ -4405,7 +4405,7 @@ export default function Agri() {
|
||||
|
||||
const handleSubmitSeg = async () => {
|
||||
if (!thermalFile) {
|
||||
utils.message.warning('请先上传热成像文件');
|
||||
utils.message.warning(t('page.uploadThermal2'));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4422,10 +4422,10 @@ export default function Agri() {
|
||||
try {
|
||||
const res = await submitSegmentationAnalyze(formData);
|
||||
setSegResult(res);
|
||||
utils.message.success('热成像分析完成');
|
||||
utils.message.success(t('aiAnalysis.thermalAnalysisComplete'));
|
||||
addToHistory('segmentation', res.analysisId || 'seg-' + Date.now());
|
||||
} catch (err) {
|
||||
utils.message.error('热成像分析失败');
|
||||
utils.message.error(t('aiAnalysis.thermalAnalysisFailed'));
|
||||
} finally {
|
||||
setSegLoading(false);
|
||||
}
|
||||
@@ -4447,7 +4447,7 @@ export default function Agri() {
|
||||
<Row gutter={[8, 8]} style={{ marginBottom: 8 }}>
|
||||
{[
|
||||
{
|
||||
title: '算法数量',
|
||||
title: t('aiAnalysis.algoCount'),
|
||||
value: '2',
|
||||
unit: '检测 + 分割',
|
||||
icon: <AppstoreOutlined />,
|
||||
@@ -4455,7 +4455,7 @@ export default function Agri() {
|
||||
bg: '#E8F3FF',
|
||||
},
|
||||
{
|
||||
title: '在线服务',
|
||||
title: t('aiAnalysis.onlineServices'),
|
||||
value: '2',
|
||||
unit: 'health 实时检查',
|
||||
icon: <CloudOutlined />,
|
||||
@@ -4463,7 +4463,7 @@ export default function Agri() {
|
||||
bg: '#E8FFEA',
|
||||
},
|
||||
{
|
||||
title: '模型数量',
|
||||
title: t('aiAnalysis.modelCount'),
|
||||
value: models.length || 3,
|
||||
unit: '检测模型 registry',
|
||||
icon: <DatabaseOutlined />,
|
||||
@@ -4471,7 +4471,7 @@ export default function Agri() {
|
||||
bg: '#E8F3FF',
|
||||
},
|
||||
{
|
||||
title: '历史记录',
|
||||
title: t('aiAnalysis.historyRecords'),
|
||||
value: history.length,
|
||||
unit: '本页联调记录',
|
||||
icon: <HistoryOutlined />,
|
||||
@@ -4555,7 +4555,7 @@ export default function Agri() {
|
||||
const renderDetectWorkspace = () => (
|
||||
<div style={{ padding: '0 8px' }}>
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<Text strong style={{ fontSize: 15 }}>检测模型</Text>
|
||||
<Text strong style={{ fontSize: 15 }}>{t('aiAnalysis.detectModel')}</Text>
|
||||
<Select
|
||||
style={{ width: '100%', marginTop: 8 }}
|
||||
value={detectForm.modelAlias}
|
||||
@@ -4570,25 +4570,25 @@ export default function Agri() {
|
||||
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col span={12}>
|
||||
<Text strong style={{ fontSize: 13, display: 'block', marginBottom: 8 }}>输入类型</Text>
|
||||
<Text strong style={{ fontSize: 13, display: 'block', marginBottom: 8 }}>{t('aiAnalysis.inputType')}</Text>
|
||||
<Radio.Group
|
||||
value={detectForm.inputType}
|
||||
onChange={e => setDetectForm(prev => ({ ...prev, inputType: e.target.value }))}
|
||||
buttonStyle="solid"
|
||||
size="small"
|
||||
>
|
||||
<Radio.Button value="image">图片</Radio.Button>
|
||||
<Radio.Button value="image">{t('aiAnalysis.image')}</Radio.Button>
|
||||
<Radio.Button value="video">{t('constants.sourceVideo')}</Radio.Button>
|
||||
</Radio.Group>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Text strong style={{ fontSize: 13, display: 'block', marginBottom: 8 }}>推理预设</Text>
|
||||
<Text strong style={{ fontSize: 13, display: 'block', marginBottom: 8 }}>{t('aiAnalysis.inferencePreset')}</Text>
|
||||
<Radio.Group
|
||||
value={detectForm.speedPreset}
|
||||
onChange={e => setDetectForm(prev => ({ ...prev, speedPreset: e.target.value }))}
|
||||
size="small"
|
||||
>
|
||||
<Radio.Button value="quality">质量</Radio.Button>
|
||||
<Radio.Button value="quality">{t('aiAnalysis.quality')}</Radio.Button>
|
||||
<Radio.Button value="speed">{t('devices.speed')}</Radio.Button>
|
||||
</Radio.Group>
|
||||
</Col>
|
||||
@@ -4681,8 +4681,8 @@ export default function Agri() {
|
||||
<p className="ant-upload-drag-icon">
|
||||
<InboxOutlined style={{ color: '#1677ff' }} />
|
||||
</p>
|
||||
<p className="ant-upload-text">拖拽文件到此处,或点击选择</p>
|
||||
<p className="ant-upload-hint">支持 jpg/png/webp/mp4 等格式</p>
|
||||
<p className="ant-upload-text">{t('page.fixed2DragFile')}</p>
|
||||
<p className="ant-upload-hint">{t('page.jpgPngWebpMp4')}</p>
|
||||
</Dragger>
|
||||
</div>
|
||||
|
||||
@@ -4699,9 +4699,7 @@ export default function Agri() {
|
||||
icon={<PlayCircleOutlined />}
|
||||
onClick={handleGetTargetDemo}
|
||||
loading={targetLoading}
|
||||
>
|
||||
调用服务器样例
|
||||
</Button> <Button icon={<SyncOutlined />} onClick={fetchModels}>刷新模型</Button>
|
||||
>{t('page.s7')}</Button> <Button icon={<SyncOutlined />} onClick={fetchModels}>{t('aiAnalysis.refreshModels')}</Button>
|
||||
</Space>
|
||||
</div>
|
||||
);
|
||||
@@ -4748,7 +4746,7 @@ export default function Agri() {
|
||||
</Row>
|
||||
|
||||
<div style={{ marginTop: 24 }}>
|
||||
<Text strong style={{ fontSize: 13, display: 'block', marginBottom: 8 }}>热成像文件 thermal_file</Text>
|
||||
<Text strong style={{ fontSize: 13, display: 'block', marginBottom: 8 }}>{t('page.thermalFile')}</Text>
|
||||
<Dragger
|
||||
fileList={thermalFile ? [thermalFile] : []}
|
||||
onChange={info => setThermalFile(info.fileList[0])}
|
||||
@@ -4759,7 +4757,7 @@ export default function Agri() {
|
||||
<p className="ant-upload-drag-icon" style={{ fontSize: 24 }}>
|
||||
<CloudOutlined style={{ color: '#1677ff' }} />
|
||||
</p>
|
||||
<p style={{ fontSize: 12 }}>上传 TIFF / PNG / JPG 热成像文件</p>
|
||||
<p style={{ fontSize: 12 }}>{t('page.fixed2UploadTiffPngJpg')}</p>
|
||||
</Dragger>
|
||||
</div>
|
||||
|
||||
@@ -4770,7 +4768,7 @@ export default function Agri() {
|
||||
beforeUpload={() => false}
|
||||
maxCount={1}
|
||||
>
|
||||
<Button size="small">阵列 mask</Button>
|
||||
<Button size="small">{t('page.mask')}</Button>
|
||||
</Upload>
|
||||
<Upload
|
||||
fileList={geojsonFile ? [geojsonFile] : []}
|
||||
@@ -4778,7 +4776,7 @@ export default function Agri() {
|
||||
beforeUpload={() => false}
|
||||
maxCount={1}
|
||||
>
|
||||
<Button size="small">面板 GeoJSON</Button>
|
||||
<Button size="small">{t('page.geojson')}</Button>
|
||||
</Upload>
|
||||
</Space>
|
||||
|
||||
@@ -4788,16 +4786,12 @@ export default function Agri() {
|
||||
icon={segLoading ? <LoadingOutlined /> : <CheckOutlined />}
|
||||
onClick={handleSubmitSeg}
|
||||
loading={segLoading}
|
||||
>
|
||||
提交热成像分析
|
||||
</Button>
|
||||
>{t('aiAnalysis.submitThermalAnalysis')}</Button>
|
||||
<Button
|
||||
icon={<PlayCircleOutlined />}
|
||||
onClick={handleGetDemo}
|
||||
loading={hotLoading}
|
||||
>
|
||||
调用服务器样例
|
||||
</Button> <Button icon={<HistoryOutlined />}>读取服务器历史</Button>
|
||||
>{t('page.s7')}</Button> <Button icon={<HistoryOutlined />}>{t('aiAnalysis.readServerHistory')}</Button>
|
||||
</Space>
|
||||
</div>
|
||||
);
|
||||
@@ -4809,18 +4803,16 @@ export default function Agri() {
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={<Text strong style={{ fontSize: 14 }}>结果展示</Text>}
|
||||
title={<Text strong style={{ fontSize: 14 }}>{t('page.s15')}</Text>}
|
||||
bordered={false}
|
||||
style={{ marginTop: 12, borderRadius: 8 }}
|
||||
bodyStyle={{ padding: '12px' }}
|
||||
>
|
||||
<Text type="secondary" style={{ fontSize: 11, display: 'block', marginBottom: 12 }}>
|
||||
原始预览、结果图与完整 JSON 同屏查看
|
||||
</Text>
|
||||
<Text type="secondary" style={{ fontSize: 11, display: 'block', marginBottom: 12 }}>{t('page.jsonViewFixed2')}</Text>
|
||||
<Row gutter={12}>
|
||||
{/* 输入预览 */}
|
||||
<Col span={8}>
|
||||
<Card size="small" title="输入预览" style={{ height: 480 }}>
|
||||
<Card size="small" title={t('aiAnalysis.inputPreview')} style={{ height: 480 }}>
|
||||
<div style={{ height: 400, background: '#001529', display: 'flex', alignItems: 'center', justifyContent: 'center', overflow: 'hidden' }}>
|
||||
{inputFile && (
|
||||
detectForm.inputType === 'image' ? (
|
||||
@@ -4843,7 +4835,7 @@ export default function Agri() {
|
||||
|
||||
{/* 结果图/视频 */}
|
||||
<Col span={8}>
|
||||
<Card size="small" title="结果图 / 视频" style={{ height: 480 }}>
|
||||
<Card size="small" title={t('page.videoFixed2')} style={{ height: 480 }}>
|
||||
|
||||
<div style={{ height: 400, display: 'flex', alignItems: 'center', justifyContent: 'center', background: '#fafafa' }}>
|
||||
{hasResult ? (
|
||||
@@ -4861,7 +4853,7 @@ export default function Agri() {
|
||||
/>
|
||||
)
|
||||
) : (
|
||||
<Text type="secondary">任务完成后显示结果</Text>
|
||||
<Text type="secondary">{t('page.fixed2TaskSuspended2Fixed2Complete')}</Text>
|
||||
)}
|
||||
</div>
|
||||
</Card>
|
||||
@@ -4869,12 +4861,12 @@ export default function Agri() {
|
||||
|
||||
{/* 结果JSON */}
|
||||
<Col span={8}>
|
||||
<Card size="small" title="结果 JSON" style={{ height: 480 }}>
|
||||
<Card size="small" title={t('page.json')} style={{ height: 480 }}>
|
||||
<div style={{ height: 400, overflowY: 'auto', background: '#fafafa', padding: 8 }}>
|
||||
{hasResult ? (
|
||||
<pre style={{ fontSize: 10, margin: 0 }}>{JSON.stringify(detectResult, null, 2)}</pre>
|
||||
) : (
|
||||
<Text type="secondary">暂无结果</Text>
|
||||
<Text type="secondary">{t('page.noResultFixed2')}</Text>
|
||||
)}
|
||||
</div>
|
||||
</Card>
|
||||
@@ -4899,19 +4891,17 @@ export default function Agri() {
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={<Text strong style={{ fontSize: 14 }}>结果展示</Text>}
|
||||
title={<Text strong style={{ fontSize: 14 }}>{t('page.s15')}</Text>}
|
||||
bordered={false}
|
||||
style={{ marginTop: 12, borderRadius: 8 }}
|
||||
bodyStyle={{ padding: '12px' }}
|
||||
>
|
||||
<Text type="secondary" style={{ fontSize: 11, display: 'block', marginBottom: 12 }}>
|
||||
原始预览、结果图与完整 JSON 同屏查看
|
||||
</Text>
|
||||
<Text type="secondary" style={{ fontSize: 11, display: 'block', marginBottom: 12 }}>{t('page.jsonViewFixed2')}</Text>
|
||||
|
||||
{/* 顶部统计卡片 */}
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<Text strong style={{ fontSize: 13, display: 'block', marginBottom: 8 }}>热成像交互分析视图</Text>
|
||||
<Text type="secondary" style={{ fontSize: 11, marginBottom: 12 }}>点击热点或面板查看温度、块号、GPS 与像素溯源信息</Text>
|
||||
<Text strong style={{ fontSize: 13, display: 'block', marginBottom: 8 }}>{t('page.s19')}</Text>
|
||||
<Text type="secondary" style={{ fontSize: 11, marginBottom: 12 }}>{t('page.viewFixed2TemperatureGpsInfoFixed2')}</Text>
|
||||
<Row gutter={8}>
|
||||
<Col span={6}>
|
||||
<Card
|
||||
@@ -4925,7 +4915,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('page.quantityFixed2')}</span>}
|
||||
value={segResult?.summary?.panel_hotspot_count || 0}
|
||||
|
||||
valueStyle={{ fontSize: 18, fontWeight: 600, color: '#FF4D4F' }}
|
||||
@@ -4945,7 +4935,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.panelArea')}</span>}
|
||||
value={segResult?.summary?.panel_polygon_count || 0}
|
||||
titleStyle={{ fontSize: 12, color: '#333', marginBottom: 4 }}
|
||||
valueStyle={{ fontSize: 18, fontWeight: 600, color: '#1677FF' }}
|
||||
@@ -4985,7 +4975,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('page.s23')}</span>}
|
||||
value={segResult?.analysis_id?.substring(0, 8) || '-'}
|
||||
titleStyle={{ fontSize: 12, color: '#333', marginBottom: 4 }}
|
||||
valueStyle={{ fontSize: 18, fontWeight: 600, color: '#722ED1' }}
|
||||
@@ -5021,7 +5011,7 @@ export default function Agri() {
|
||||
/>
|
||||
)}
|
||||
{/*{!inputFile && (
|
||||
<Empty description={<span style={{ color: '#fff' }}>请上传热成像文件</span>} image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
||||
<Empty description={<span style={{ color: '#fff' }}>{t('page.uploadThermal')}</span>} image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
||||
)}*/}
|
||||
|
||||
{/* 热点标记点 */}
|
||||
@@ -5070,8 +5060,8 @@ export default function Agri() {
|
||||
<Col span={12}>
|
||||
<Card
|
||||
size="small"
|
||||
title="点位详情"
|
||||
extra={<Text type="secondary" style={{ fontSize: 11 }}>请选择热点或面板</Text>}
|
||||
title={t('page.detailFixed2')}
|
||||
extra={<Text type="secondary" style={{ fontSize: 11 }}>{t('page.fixed2PleaseSelect')}</Text>}
|
||||
style={{ height: 400 }}
|
||||
bodyStyle={{ height: 350 }}
|
||||
>
|
||||
@@ -5099,17 +5089,17 @@ export default function Agri() {
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<Space>
|
||||
<Text strong style={{ fontSize: 14 }}>热点 {selectedPoint.hotspot_id}</Text>
|
||||
<Tag color="red">热点</Tag>
|
||||
<Tag color="red">{t('page.s26')}</Tag>
|
||||
</Space>
|
||||
</div>
|
||||
|
||||
{[
|
||||
{ label: t('home.temperature'), value: `${selectedPoint.peak_temp_c}℃` },
|
||||
{ label: '块号', value: selectedPoint.panel_id || '-' },
|
||||
{ label: t('page.s49'), value: selectedPoint.panel_id || '-' },
|
||||
{ label: 'GPS', value: selectedPoint.gps?.text || '-' },
|
||||
{ label: '原图像素', value: `${selectedPoint.peak_x}, ${selectedPoint.peak_y}` },
|
||||
{ label: '叠加图像素', value: `${selectedPoint.peak_x}, ${selectedPoint.peak_y}` },
|
||||
{ label: '面积', value: `${selectedPoint.area_px} px` }
|
||||
{ label: t('page.s50'), value: `${selectedPoint.peak_x}, ${selectedPoint.peak_y}` },
|
||||
{ label: t('page.s51'), value: `${selectedPoint.peak_x}, ${selectedPoint.peak_y}` },
|
||||
{ label: t('page.s52'), value: `${selectedPoint.area_px} px` }
|
||||
].map((item, i) => (
|
||||
<div key={i} style={{
|
||||
display: 'flex',
|
||||
@@ -5123,9 +5113,7 @@ export default function Agri() {
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<Text type="secondary" style={{ fontSize: 12, display: 'block' }}>
|
||||
等待分割结果,完成后可点击热点/面板查看详情
|
||||
</Text>
|
||||
<Text type="secondary" style={{ fontSize: 12, display: 'block' }}>{t('page.completeViewDetailsFixed2')}</Text>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -5145,7 +5133,7 @@ export default function Agri() {
|
||||
paddingRight: 4,
|
||||
boxSizing: 'border-box'
|
||||
}}>
|
||||
<Text strong style={{ fontSize: 13, display: 'block', marginBottom: 8 }}>热点/面板列表</Text>
|
||||
<Text strong style={{ fontSize: 13, display: 'block', marginBottom: 8 }}>{t('page.listFixed2')}</Text>
|
||||
{panels.map((p, i) => (
|
||||
<div
|
||||
key={i}
|
||||
@@ -5189,9 +5177,7 @@ export default function Agri() {
|
||||
return (
|
||||
<div style={{ padding: '8px', background: '#f4f7f9', minHeight: '100vh' }}>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', paddingBottom: "16px" }}>
|
||||
<Typography.Title level={4} style={{ margin: 0, fontSize: 'clamp(18px, 1.5vw, 24px)', color: '#1D2129' }}>
|
||||
算法分析中心
|
||||
</Typography.Title>
|
||||
<Typography.Title level={4} style={{ margin: 0, fontSize: 'clamp(18px, 1.5vw, 24px)', color: '#1D2129' }}>{t('page.s29')}</Typography.Title>
|
||||
</div>
|
||||
{renderStats()}
|
||||
|
||||
@@ -5199,11 +5185,11 @@ export default function Agri() {
|
||||
{/* 左侧:算法列表 */}
|
||||
<Col xs={24} sm={12} md={12} lg={4}>
|
||||
<Card
|
||||
title={<Text strong style={{ fontSize: 14 }}>算法列表</Text>}
|
||||
title={<Text strong style={{ fontSize: 14 }}>{t('aiAnalysis.algorithmList')}</Text>}
|
||||
bordered={false}
|
||||
bodyStyle={{ padding: '8px' }}
|
||||
style={{ borderRadius: 8, height: '100%' }}
|
||||
extra={<Text type="secondary" style={{ fontSize: 11 }}>已接入 2 套</Text>}
|
||||
extra={<Text type="secondary" style={{ fontSize: 11 }}>{t('page.2')}</Text>}
|
||||
>
|
||||
{algorithmList.map(algo => (
|
||||
<div
|
||||
@@ -5265,14 +5251,14 @@ export default function Agri() {
|
||||
{/* 右侧:历史记录 */}
|
||||
<Col xs={24} sm={12} md={12} lg={6}>
|
||||
<Card
|
||||
title={<Text strong style={{ fontSize: 14 }}>历史分析记录</Text>}
|
||||
title={<Text strong style={{ fontSize: 14 }}>{t('page.fixed2HistoryAnalysis')}</Text>}
|
||||
bordered={false}
|
||||
bodyStyle={{ padding: '8px' }}
|
||||
style={{ borderRadius: 8, height: '100%' }}
|
||||
extra={<Text type="secondary" style={{ fontSize: 11 }}>{history.length} 条</Text>}
|
||||
>
|
||||
{history.length === 0 ? (
|
||||
<Empty description="暂无历史" image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
||||
<Empty description={t('page.noHistoryFixed2')} image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
||||
) : (
|
||||
history.map(item => (
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user