增加机器数据报表

This commit is contained in:
mmc
2026-09-23 10:52:18 +08:00
parent 8a7e239bd6
commit a8c1e672eb
5 changed files with 797 additions and 384 deletions

9
src/api/machine.ts Normal file
View File

@@ -0,0 +1,9 @@
import request from './request';
export function getDeviceRunningHistoryStatistics(data) {
return request({
url: `/iot/device/runningHistoryStatistics`,
method: 'post',
data,
});
}

View File

@@ -0,0 +1,388 @@
import React, { useEffect, useState, useMemo, useCallback } from 'react';
import {
Card, Row, Col, Select, DatePicker, Button, Space, Checkbox, Table, Tag,
Typography, message, Empty, Spin
} from 'antd';
import {
RobotOutlined, SearchOutlined, DownloadOutlined, LineChartOutlined
} from '@ant-design/icons';
import dayjs from 'dayjs';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
import { RootState } from '../../store';
import { getSiteDevice } from '../../api/device';
import { getDeviceRunningHistoryStatistics } from '../../api/machine';
import { UniversalLineChart } from '../recharts';
import utils from '@/lib/utils';
const { RangePicker } = DatePicker;
const { Option } = Select;
const { Title } = Typography;
// 参数配置:i18n key + 后端字段 + 单位 + 颜色
const PARAM_CONFIG = [
{ key: 'voltage', labelKey: 'devices.rtVoltage', unit: 'V', color: '#1677ff' },
{ key: 'leftCurrent', labelKey: 'devices.rtLeftMotor', unit: 'A', color: '#52c41a' },
{ key: 'rightCurrent', labelKey: 'devices.rtRightMotor', unit: 'A', color: '#fa8c16' },
{ key: 'leftMeasureSpeed', labelKey: 'devices.rtLeftSpeed', unit: 'rpm', color: '#eb2f96' },
{ key: 'rightMeasureSpeed', labelKey: 'devices.rtRightSpeed', unit: 'rpm', color: '#722ed1' },
{ key: 'leftMotorTemp', labelKey: 'devices.rtLeftTemp', unit: '℃', color: '#13c2c2' },
{ key: 'rightMotorTemp', labelKey: 'devices.rtRightTemp', unit: '℃', color: '#f5222d' },
{ key: 'chipTemp', labelKey: 'devices.rtMainTemp', unit: '℃', color: '#2f54eb' },
];
// 默认选中全部参数
const DEFAULT_PARAM_KEYS = PARAM_CONFIG.map(p => p.key);
// 兼容多种时间字段
function getRowTime(row: any): string {
const t = row.createTime || row.ts || row.timestamp || row.time || row.recordTime || row.collectTime;
if (!t) return '';
return dayjs(typeof t === 'number' ? t : String(t)).format('YYYY-MM-DD HH:mm:ss');
}
// 兼容多种返回结构
function extractRows(res: any): any[] {
if (!res) return [];
if (Array.isArray(res)) return res;
if (Array.isArray(res.rows)) return res.rows;
if (Array.isArray(res.data)) return res.data;
if (res.data && Array.isArray(res.data.list)) return res.data.list;
if (res.data && Array.isArray(res.data.records)) return res.data.records;
return [];
}
export default function MachineDataReport() {
const { t } = useTranslation();
const { stationId, currentStation } = useSelector((state: RootState) => state.station);
const [deviceList, setDeviceList] = useState<any[]>([]);
const [deviceLoading, setDeviceLoading] = useState(false);
const [selectedDeviceSn, setSelectedDeviceSn] = useState<string | undefined>();
const [dateRange, setDateRange] = useState<[dayjs.Dayjs, dayjs.Dayjs]>([
dayjs().startOf('day'),
dayjs(),
]);
const [selectedParams, setSelectedParams] = useState<string[]>(DEFAULT_PARAM_KEYS);
const [loading, setLoading] = useState(false);
const [rawRows, setRawRows] = useState<any[]>([]);
// 获取机器人列表
const fetchDevices = useCallback(async () => {
if (!stationId) return;
setDeviceLoading(true);
try {
const res = await getSiteDevice({
siteId: stationId,
pageSize: 9999,
pageNum: 1,
orgId: currentStation?.orgId,
});
const rows = res?.code === 200 ? (res.rows || []) : [];
setDeviceList(rows);
if (rows.length > 0) {
setSelectedDeviceSn(rows[0].serialNumber);
} else {
setSelectedDeviceSn(undefined);
}
} catch (e) {
console.error('fetch devices failed', e);
} finally {
setDeviceLoading(false);
}
}, [stationId, currentStation, selectedDeviceSn]);
useEffect(() => {
fetchDevices();
}, [fetchDevices]);
// 查询报表数据
const handleQuery = useCallback(async () => {
if (!selectedDeviceSn) {
utils.message.warning(t('report.selectRobot'));
return;
}
if (selectedParams.length === 0) {
utils.message.warning(t('report.selectParameters'));
return;
}
setLoading(true);
try {
const params: any = {
deviceId: selectedDeviceSn,
startTime: dateRange[0].format('YYYY-MM-DD HH:mm:ss'),
endTime: dateRange[1].format('YYYY-MM-DD HH:mm:ss'),
};
const res = await getDeviceRunningHistoryStatistics(params);
const rows = extractRows(res);
setRawRows(rows);
if (rows.length === 0) {
utils.message.info(t('common.noData'));
}
} catch (e) {
console.error('fetch intraday data failed', e);
utils.message.error(t('common.noData'));
setRawRows([]);
} finally {
setLoading(false);
}
}, [selectedDeviceSn, dateRange, selectedParams, t]);
// 进入页面自动查询一次(如果有默认设备)
useEffect(() => {
if (selectedDeviceSn && dateRange) {
handleQuery();
}
}, [selectedDeviceSn]);
// 整理图表数据:每行 { time, [paramKey]: value }
const chartData = useMemo(() => {
return rawRows.map(row => {
const item: any = { time: getRowTime(row) };
selectedParams.forEach(k => {
const v = row[k];
item[k] = (typeof v === 'number') ? v : (v != null ? Number(v) : null);
});
return item;
}).sort((a, b) => (a.time < b.time ? -1 : a.time > b.time ? 1 : 0));
}, [rawRows, selectedParams]);
// 图表 series 配置
const chartSeries = useMemo(() => {
return PARAM_CONFIG
.filter(p => selectedParams.includes(p.key))
.map(p => ({
key: p.key,
name: `${t(p.labelKey)}(${p.unit})`,
color: p.color,
}));
}, [selectedParams, t]);
// 表格列
const tableColumns = useMemo(() => {
const cols: any[] = [
{
title: t('report.generateTime') || '时间',
dataIndex: '_time',
key: '_time',
width: 180,
fixed: 'left',
render: (v: string) => v || '-',
},
];
PARAM_CONFIG
.filter(p => selectedParams.includes(p.key))
.forEach(p => {
cols.push({
title: `${t(p.labelKey)}(${p.unit})`,
dataIndex: p.key,
key: p.key,
width: 140,
render: (v: any) => (v != null && !isNaN(Number(v))) ? Number(v).toFixed(2) : '-',
});
});
return cols;
}, [selectedParams, t]);
// 表格数据源
const tableData = useMemo(() => {
return rawRows.map((row, idx) => {
const item: any = {
key: idx,
_time: getRowTime(row),
};
PARAM_CONFIG.forEach(p => {
const v = row[p.key];
item[p.key] = (typeof v === 'number') ? v : (v != null ? Number(v) : null);
});
return item;
}).sort((a, b) => (a._time < b._time ? -1 : a._time > b._time ? 1 : 0));
}, [rawRows]);
// 导出 CSV
const handleExport = useCallback(() => {
if (tableData.length === 0) {
utils.message.warning(t('common.noData'));
return;
}
const headers = tableColumns.map((c: any) => c.title);
const keys = tableColumns.map((c: any) => c.dataIndex);
const lines = [headers.join(',')];
tableData.forEach(row => {
lines.push(keys.map(k => {
const v = row[k];
if (v == null) return '';
const s = typeof v === 'number' ? v.toFixed(2) : String(v);
return `"${s.replace(/"/g, '""')}"`;
}).join(','));
});
const csv = '\uFEFF' + lines.join('\r\n');
const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
const deviceName = deviceList.find(d => d.serialNumber === selectedDeviceSn)?.deviceAlias || selectedDeviceSn || 'machine';
a.href = url;
a.download = `machine_data_${deviceName}_${dayjs().format('YYYYMMDD_HHmmss')}.csv`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
}, [tableData, tableColumns, deviceList, selectedDeviceSn, t]);
const cardStyle = {
borderRadius: 12,
border: '1px solid #f0f0f0',
boxShadow: '0 4px 12px rgba(0,0,0,0.05)',
};
return (
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
{/* 筛选栏 */}
<Card bordered={false} style={cardStyle} bodyStyle={{ padding: '16px 20px' }}>
<div style={{ display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: 20 }}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<span style={{ fontSize: 13, color: '#86909C', marginRight: 8, whiteSpace: 'nowrap' }}>
<RobotOutlined style={{ marginRight: 4 }} />{t('report.selectRobot')}:
</span>
<Select
showSearch
value={selectedDeviceSn}
onChange={setSelectedDeviceSn}
style={{ width: 420 }}
placeholder={t('common.pleaseSelect')}
loading={deviceLoading}
optionFilterProp="children"
filterOption={(input, option) =>
String(option?.children ?? '').toLowerCase().includes(input.toLowerCase())
}
>
{deviceList.map((d) => (
<Option key={d.serialNumber} value={d.serialNumber}>
{d.deviceAlias || d.deviceName || d.serialNumber}
</Option>
))}
</Select>
</div>
<div style={{ display: 'flex', alignItems: 'center' }}>
<span style={{ fontSize: 13, color: '#86909C', marginRight: 8, whiteSpace: 'nowrap' }}>
{t('common.timeRange')}:
</span>
<RangePicker
showTime
format="YYYY-MM-DD HH:mm:ss"
value={dateRange}
onChange={(v) => v && v[0] && v[1] && setDateRange([v[0], v[1]])}
style={{ width: 380 }}
/>
</div>
<div style={{ display: 'flex', alignItems: 'center' }}>
<span style={{ fontSize: 13, color: '#86909C', marginRight: 8, whiteSpace: 'nowrap' }}>
{t('report.selectParameters')}:
</span>
<Checkbox.Group
value={selectedParams}
onChange={(v) => setSelectedParams(v as string[])}
style={{ maxWidth: 700 }}
>
<Row gutter={[8, 4]}>
{PARAM_CONFIG.map(p => (
<Col key={p.key}>
<Checkbox value={p.key}>{t(p.labelKey)}</Checkbox>
</Col>
))}
</Row>
</Checkbox.Group>
</div>
<div style={{ marginLeft: 'auto' }}>
<Space size={8}>
<Button
type="primary"
icon={<SearchOutlined />}
onClick={handleQuery}
loading={loading}
style={{ borderRadius: 6, height: 32, padding: '0 16px' }}
>
{t('report.query')}
</Button>
<Button
icon={<DownloadOutlined />}
onClick={handleExport}
disabled={tableData.length === 0}
style={{ borderRadius: 6, height: 32, color: '#00B42A', borderColor: '#00B42A' }}
>
{t('report.exportTable')}
</Button>
</Space>
</div>
</div>
</Card>
{/* 统计曲线图 */}
<Card
bordered={false}
style={cardStyle}
bodyStyle={{ padding: '20px' }}
title={
<Space>
<LineChartOutlined style={{ color: '#165DFF' }} />
<span style={{ fontSize: 15, fontWeight: 700, color: '#1D2129' }}>
{t('report.aiAnalysisStatistics')}
</span>
</Space>
}
extra={
selectedParams.length > 0 && (
<span style={{ fontSize: 12, color: '#86909C' }}>
{t('common.total', { count: chartData.length })} {t('report.unitItem')}
</span>
)
}
>
<Spin spinning={loading}>
{chartData.length > 0 && chartSeries.length > 0 ? (
<UniversalLineChart
data={chartData}
xKey="time"
series={chartSeries}
height={420}
/>
) : (
<Empty
style={{ margin: '60px 0' }}
description={loading ? '' : t('common.noData')}
/>
)}
</Spin>
</Card>
{/* 数据表格 */}
<Card
bordered={false}
style={cardStyle}
bodyStyle={{ padding: 0 }}
title={
<span style={{ fontSize: 15, fontWeight: 700, color: '#1D2129' }}>
{t('report.machineRecords')}
</span>
}
>
<Table
rowKey="key"
columns={tableColumns}
dataSource={tableData}
size="small"
loading={loading}
scroll={{ x: 'max-content', y: 400 }}
pagination={{ pageSize: 20, showSizeChanger: true, showTotal: (total) => `${total}` }}
className="compact-table"
locale={{ emptyText: t('common.noData') }}
/>
</Card>
</div>
);
}

View File

@@ -2327,7 +2327,12 @@ const en = {
totalWorkOrders: 'Total Work Orders', totalWorkOrders: 'Total Work Orders',
completionRate: 'Completion Rate', completionRate: 'Completion Rate',
averageEfficiency: 'Average Efficiency', averageEfficiency: 'Average Efficiency',
aiAnalysisReport: 'ai Analysis Report', machineAnalysisReport: 'Machine Data Report',
selectRobot: 'Select Robot',
selectParameters: 'Select Parameters',
query: 'Query',
exportTable: 'Export Table',
machineRecords: 'Machine Records',
aiAnalysisStatistics: 'ai Analysis Statistics', aiAnalysisStatistics: 'ai Analysis Statistics',
aiDiagnosisDaily: 'ai Diagnosis Daily', aiDiagnosisDaily: 'ai Diagnosis Daily',
alarmCount: 'Alarm Count', alarmCount: 'Alarm Count',

View File

@@ -2360,7 +2360,13 @@ const zh = {
totalWorkOrders: '工单总数', totalWorkOrders: '工单总数',
completionRate: '完成率', completionRate: '完成率',
averageEfficiency: '平均效率', averageEfficiency: '平均效率',
aiAnalysisReport: 'AI分析报表', machineAnalysisReport: '机器数据报表',
selectRobot: '机器人',
selectParameters: '选择参数',
query: '查询',
exportTable: '导出表格',
machineRecords: '机器记录',
aiAnalysisStatistics: 'AI分析统计', aiAnalysisStatistics: 'AI分析统计',
aiDiagnosisDaily: 'AI诊断每日', aiDiagnosisDaily: 'AI诊断每日',
alarmCount: '告警数量', alarmCount: '告警数量',

View File

@@ -20,6 +20,7 @@ import dayjs from 'dayjs';
import { ChevronRight } from 'lucide-react'; import { ChevronRight } from 'lucide-react';
import { UniversalBarChart, UniversalLineChart, UniversalPieChart } from '../components/recharts'; import { UniversalBarChart, UniversalLineChart, UniversalPieChart } from '../components/recharts';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import MachineDataReport from '../components/reports/MachineDataReport';
const { TabPane } = Tabs; const { TabPane } = Tabs;
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
@@ -207,405 +208,409 @@ export default function ReportCenterPage() {
<TabPane tab={t('report.generationReport')} key="power" /> <TabPane tab={t('report.generationReport')} key="power" />
<TabPane tab={t('report.operationReport')} key="operation" /> <TabPane tab={t('report.operationReport')} key="operation" />
<TabPane tab={t('report.alertReport')} key="alarm" /> <TabPane tab={t('report.alertReport')} key="alarm" />
<TabPane tab={t('report.aiAnalysisReport')} key="ai" /> <TabPane tab={t('report.machineAnalysisReport')} key="ai" />
</Tabs> </Tabs>
</div> </div>
{activeTab === 'ai' ? (
<MachineDataReport />
<Row ) : (
gutter={[12, 12]} <>
style={{ <Row
marginBottom: 8, gutter={[12, 12]}
flexWrap: 'wrap', style={{
}} marginBottom: 8,
> flexWrap: 'wrap',
{overviewCards.map((card, idx) => ( }}
<Col key={idx} style={{ minWidth: '180px', flex: '1 0 auto', }}> >
<Card {overviewCards.map((card, idx) => (
variant="borderless" <Col key={idx} style={{ minWidth: '180px', flex: '1 0 auto', }}>
styles={{ body: { padding: '20px 20px', display: 'flex', alignItems: 'center', justifyContent: 'space-between' } }} <Card
style={{ borderRadius: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)' }} bordered={false}
> bodyStyle={{ padding: '20px 20px', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}
{/* 左侧文字区域 */} style={{ borderRadius: 8, boxShadow: '0 2px 8px rgba(0,0,0,0.06)' }}
<div style={{ flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'flex-start' }}> >
<div style={{ fontSize: 14, color: '#86909C', marginBottom: 8, fontWeight: 500 }}> {/* 左侧文字区域 */}
{card.title} <div style={{ flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'flex-start' }}>
</div> <div style={{ fontSize: 14, color: '#86909C', marginBottom: 8, fontWeight: 500 }}>
<div style={{ fontSize: 28, fontWeight: 700, color: card.color, lineHeight: 1, marginBottom: 8 }}> {card.title}
{card.value} </div>
<span style={{ fontSize: 14, fontWeight: 500, marginLeft: 2, color: '#1D2129' }}>{card.unit}</span> <div style={{ fontSize: 28, fontWeight: 700, color: card.color, lineHeight: 1, marginBottom: 8 }}>
</div> {card.value}
{/* 底部环比/备注 */} <span style={{ fontSize: 14, fontWeight: 500, marginLeft: 2, color: '#1D2129' }}>{card.unit}</span>
<div style={{ fontSize: 12, color: '#86909C', fontWeight: 500 }}> </div>
{card.trend} {/* 底部环比/备注 */}
</div> <div style={{ fontSize: 12, color: '#86909C', fontWeight: 500 }}>
</div> {card.trend}
</div>
{/* 右侧圆形图标区域 */}
<div
style={{
width: 48,
height: 48,
borderRadius: '50%',
backgroundColor: card.iconBg || '#f0f7ff',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
flexShrink: 0,
marginLeft: 8
}}
>
{card.icon}
</div>
</Card>
</Col>
))}
</Row>
{/* 筛选栏 */}
<div style={{ display: 'flex', alignItems: 'center', marginBottom: 8, gap: 20, flexWrap: 'wrap' }}>
<div style={{ display: 'flex', alignItems: 'center' }}>
<span className="filter-label">{t('report.reportCycle')}:</span>
<Select value={reportCycle} onChange={setReportCycle} style={{ width: 100 }} size="small">
<Option value="day">{t('report.daily')}</Option>
<Option value="week">{t('report.weekly')}</Option>
<Option value="month">{t('report.monthly')}</Option>
</Select>
</div>
<div style={{ display: 'flex', alignItems: 'center' }}>
<span className="filter-label">{t('report.reportType')}:</span>
<Select value={reportType} onChange={setReportType} style={{ width: 120 }} size="small">
<Option value="all">{t('common.all')}</Option>
<Option value="power">{t('report.generationReport')}</Option>
<Option value="operation">{t('report.operationReport')}</Option>
<Option value="alarm">{t('report.alertReport')}</Option>
<Option value="ai">{t('report.aiAnalysisReport')}</Option>
</Select>
</div>
<div style={{ display: 'flex', alignItems: 'center' }}>
<span className="filter-label">{t('report.dateRange')}:</span>
<RangePicker
value={dateRange}
onChange={setDateRange}
style={{ width: 260 }}
size="small"
/>
</div>
<div style={{ marginLeft: 'auto' }}>
<Space size={12}>
<Button type="primary" icon={<FileTextOutlined />} size="small" style={{ borderRadius: 6, height: 32, padding: '0 16px' }}>{t('report.generateReport')}</Button>
<Button icon={<FilePdfOutlined />} size="small" style={{ borderRadius: 6, height: 32, color: '#F53F3F', borderColor: '#F53F3F' }}>{t('report.exportPdf')}</Button>
<Button icon={<FileExcelOutlined />} size="small" style={{ borderRadius: 6, height: 32, color: '#00B42A', borderColor: '#00B42A' }}>{t('report.exportExcel')}</Button>
</Space>
</div>
</div>
<Row gutter={[8, 8]}>
{/* 左侧主内容区 */}
<Col xs={24} xl={16} >
{/* 月度综合经营分析 */}
<Card variant="borderless" style={cardStyle} styles={{ body: { padding: '20px' } }} title={<span style={{ fontSize: 15, fontWeight: 700, color: '#1D2129' }}>{t('report.monthlyOperationAnalysis')}</span>}>
<Row gutter={24}>
<Col span={17}>
<div style={{ fontSize: 11, color: '#86909C', marginBottom: 16, display: 'flex', justifyContent: 'flex-start', gap: 20 }}>
<Space size={4}><div style={{ width: 10, height: 3, background: '#00B42A' }}></div>{t('report.generation')} (MWh)</Space>
<Space size={4}><div style={{ width: 10, height: 1, borderTop: '1.5px dashed #165DFF' }}></div>{t('report.predictedGeneration')} (MWh)</Space>
<Space size={4}><div style={{ width: 10, height: 1, borderTop: '1.5px solid #FF7D00' }}></div>PR (%)</Space>
</div>
<UniversalLineChart
data={monthlyPowerData}
xKey="date"
height={260}
series={[
{
key: 'generation',
name: t('report.generation') + '(MWh)',
color: '#52c41a',
},
{
key: 'predicted',
name: t('report.predictedGeneration') + '(MWh)',
color: '#1890ff',
dashed: true,
},
{
key: 'pr',
name: 'PR(%)',
color: '#fa8c16',
strokeWidth: 2,
},
]}
/>
</Col>
<Col span={7}>
<div style={{ background: '#f8fafc', padding: '16px', borderRadius: 12, height: '100%' }}>
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
{[
{ label: t('report.monthlyAccumulatedGeneration'), value: '138.6', unit: 'MWh' },
{ label: t('report.theoreticalGeneration'), value: '166.8', unit: 'MWh' },
{ label: t('report.prAverage'), value: '82.8', unit: '%' },
{ label: t('report.generationDeviation'), value: '-3.4', unit: '%', color: '#F53F3F' },
{ label: t('report.averageIrradiance'), value: '5.3', unit: t('report.unitIrradiancePerDay') },
].map((item, idx) => (
<div key={idx} style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<span style={{ fontSize: 12, color: '#4E5969' }}>{item.label}</span>
<span style={{ fontSize: 14, fontWeight: 700, color: item.color || '#1D2129' }}>{item.value} <span style={{ fontSize: 10, fontWeight: 400, color: '#86909C' }}>{item.unit}</span></span>
</div>
))}
</div> </div>
</div>
{/* 右侧圆形图标区域 */}
<div
style={{
width: 48,
height: 48,
borderRadius: '50%',
backgroundColor: card.iconBg || '#f0f7ff',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
flexShrink: 0,
marginLeft: 8
}}
>
{card.icon}
</div>
</Card>
</Col> </Col>
</Row> ))}
</Card> </Row>
{/* 第二排:三个图表 */} {/* 筛选栏 */}
<Row gutter={[8, 8]} style={{ marginTop: 8 }}> <div style={{ display: 'flex', alignItems: 'center', marginBottom: 8, gap: 20, flexWrap: 'wrap' }}>
<Col span={8}> <div style={{ display: 'flex', alignItems: 'center' }}>
<Card <span className="filter-label">{t('report.reportCycle')}:</span>
variant="borderless" <Select value={reportCycle} onChange={setReportCycle} style={{ width: 100 }} size="small">
style={{ ...cardStyle, height: "100%" }} <Option value="day">{t('report.daily')}</Option>
styles={{ body: { padding: '16px' } }} <Option value="week">{t('report.weekly')}</Option>
title={<span style={{ fontSize: 14, fontWeight: 700 }}>{t('report.generationMeteorology')}</span>} <Option value="month">{t('report.monthly')}</Option>
> </Select>
<div style={{ fontSize: 10, color: '#86909C', marginBottom: 12 }}> </div>
<Space size={8} wrap> <div style={{ display: 'flex', alignItems: 'center' }}>
<Badge color="#165DFF" text={`${t('report.generation')} (MWh)`} style={{ fontSize: 10 }} /> <span className="filter-label">{t('report.reportType')}:</span>
<Badge color="#00B42A" text={`${t('home.irradiance')} (kWh/㎡)`} style={{ fontSize: 10 }} /> <Select value={reportType} onChange={setReportType} style={{ width: 120 }} size="small">
<Badge color="#FF7D00" text={`${t('home.temperature')} (℃)`} style={{ fontSize: 10 }} /> <Option value="all">{t('common.all')}</Option>
</Space> <Option value="power">{t('report.generationReport')}</Option>
</div> <Option value="operation">{t('report.operationReport')}</Option>
<UniversalBarChart <Option value="alarm">{t('report.alertReport')}</Option>
data={powerMeteorologyData} <Option value="ai">{t('report.machineAnalysisReport')}</Option>
xKey="date" </Select>
height={200} </div>
series={[ <div style={{ display: 'flex', alignItems: 'center' }}>
{ key: 'generation', name: t('report.generation'), color: '#1890ff' }, <span className="filter-label">{t('report.dateRange')}:</span>
{ key: 'irradiance', name: t('home.irradiance'), color: '#52c41a' }, <RangePicker
{ key: 'temp', name: t('home.temperature'), color: '#fa8c16' }, value={dateRange}
]} onChange={setDateRange}
/> style={{ width: 260 }}
size="small"
/>
</div>
<div style={{ marginLeft: 'auto' }}>
<Space size={12}>
<Button type="primary" icon={<FileTextOutlined />} size="small" style={{ borderRadius: 6, height: 32, padding: '0 16px' }}>{t('report.generateReport')}</Button>
<Button icon={<FilePdfOutlined />} size="small" style={{ borderRadius: 6, height: 32, color: '#F53F3F', borderColor: '#F53F3F' }}>{t('report.exportPdf')}</Button>
<Button icon={<FileExcelOutlined />} size="small" style={{ borderRadius: 6, height: 32, color: '#00B42A', borderColor: '#00B42A' }}>{t('report.exportExcel')}</Button>
</Space>
</div>
</div>
<Row gutter={[8, 8]}>
{/* 左侧主内容区 */}
<Col xs={24} xl={16} >
{/* 月度综合经营分析 */}
<Card bordered={false} style={cardStyle} bodyStyle={{ padding: '20px' }} title={<span style={{ fontSize: 15, fontWeight: 700, color: '#1D2129' }}>{t('report.monthlyOperationAnalysis')}</span>}>
<Row gutter={24}>
<Col span={17}>
<div style={{ fontSize: 11, color: '#86909C', marginBottom: 16, display: 'flex', justifyContent: 'flex-start', gap: 20 }}>
<Space size={4}><div style={{ width: 10, height: 3, background: '#00B42A' }}></div>{t('report.generation')} (MWh)</Space>
<Space size={4}><div style={{ width: 10, height: 1, borderTop: '1.5px dashed #165DFF' }}></div>{t('report.predictedGeneration')} (MWh)</Space>
<Space size={4}><div style={{ width: 10, height: 1, borderTop: '1.5px solid #FF7D00' }}></div>PR (%)</Space>
</div>
<UniversalLineChart
data={monthlyPowerData}
xKey="date"
height={260}
series={[
{
key: 'generation',
name: t('report.generation') + '(MWh)',
color: '#52c41a',
},
{
key: 'predicted',
name: t('report.predictedGeneration') + '(MWh)',
color: '#1890ff',
dashed: true,
},
{
key: 'pr',
name: 'PR(%)',
color: '#fa8c16',
strokeWidth: 2,
},
]}
/>
</Col>
<Col span={7}>
<div style={{ background: '#f8fafc', padding: '16px', borderRadius: 12, height: '100%' }}>
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
{[
{ label: t('report.monthlyAccumulatedGeneration'), value: '138.6', unit: 'MWh' },
{ label: t('report.theoreticalGeneration'), value: '166.8', unit: 'MWh' },
{ label: t('report.prAverage'), value: '82.8', unit: '%' },
{ label: t('report.generationDeviation'), value: '-3.4', unit: '%', color: '#F53F3F' },
{ label: t('report.averageIrradiance'), value: '5.3', unit: t('report.unitIrradiancePerDay') },
].map((item, idx) => (
<div key={idx} style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<span style={{ fontSize: 12, color: '#4E5969' }}>{item.label}</span>
<span style={{ fontSize: 14, fontWeight: 700, color: item.color || '#1D2129' }}>{item.value} <span style={{ fontSize: 10, fontWeight: 400, color: '#86909C' }}>{item.unit}</span></span>
</div>
))}
</div>
</div>
</Col>
</Row>
</Card> </Card>
</Col>
<Col span={8}> {/* 第二排:三个图表 */}
<Card <Row gutter={[8, 8]} style={{ marginTop: 8 }}>
variant="borderless" <Col span={8}>
style={{ ...cardStyle, height: "100%" }} <Card
styles={{ body: { padding: '16px' } }} bordered={false}
title={<span style={{ fontSize: 14, fontWeight: 700 }}>{t('report.workOrderAlertClosure')}</span>} style={{ ...cardStyle, height: "100%" }}
> bodyStyle={{ padding: '16px' }}
<div style={{ fontSize: 10, color: '#86909C', marginBottom: 12 }}> title={<span style={{ fontSize: 14, fontWeight: 700 }}>{t('report.generationMeteorology')}</span>}
<Space size={8} wrap> >
<Badge color="#165DFF" text={t('workOrder.newOrders')} style={{ fontSize: 10 }} /> <div style={{ fontSize: 10, color: '#86909C', marginBottom: 12 }}>
<Badge color="#00B42A" text={t('workOrder.completeOrder')} style={{ fontSize: 10 }} /> <Space size={8} wrap>
<Badge color="#722ED1" text={`${t('report.closureRate')} (%)`} style={{ fontSize: 10 }} /> <Badge color="#165DFF" text={`${t('report.generation')} (MWh)`} style={{ fontSize: 10 }} />
</Space> <Badge color="#00B42A" text={`${t('home.irradiance')} (kWh/㎡)`} style={{ fontSize: 10 }} />
</div> <Badge color="#FF7D00" text={`${t('home.temperature')} (℃)`} style={{ fontSize: 10 }} />
<UniversalBarChart </Space>
data={orderAlarmData} </div>
xKey="date" <UniversalBarChart
height={200} data={powerMeteorologyData}
series={[ xKey="date"
{ key: 'newOrder', name: t('workOrder.newOrders'), color: '#1890ff' }, height={200}
{ key: 'completed', name: t('workOrder.completeOrder'), color: '#52c41a' }, series={[
{ key: 'alarmCount', name: t('report.alarmCount'), color: '#fa8c16' }, { key: 'generation', name: t('report.generation'), color: '#1890ff' },
{ key: 'closedRate', name: t('report.closureRate'), color: '#722ed1' }, { key: 'irradiance', name: t('home.irradiance'), color: '#52c41a' },
]} { key: 'temp', name: t('home.temperature'), color: '#fa8c16' },
/> ]}
</Card> />
</Col> </Card>
</Col>
<Col span={8}> <Col span={8}>
<Card <Card
variant="borderless" bordered={false}
style={{ ...cardStyle, height: "100%" }} style={{ ...cardStyle, height: "100%" }}
styles={{ body: { padding: '16px' } }} bodyStyle={{ padding: '16px' }}
title={<span style={{ fontSize: 14, fontWeight: 700 }}>{t('report.aiAnalysisStatistics')}</span>} title={<span style={{ fontSize: 14, fontWeight: 700 }}>{t('report.workOrderAlertClosure')}</span>}
> >
<div style={{ width: '100%', boxSizing: 'border-box' }}> <div style={{ fontSize: 10, color: '#86909C', marginBottom: 12 }}>
<UniversalPieChart <Space size={8} wrap>
data={aiPieData} <Badge color="#165DFF" text={t('workOrder.newOrders')} style={{ fontSize: 10 }} />
width={220} <Badge color="#00B42A" text={t('workOrder.completeOrder')} style={{ fontSize: 10 }} />
height={220} <Badge color="#722ED1" text={`${t('report.closureRate')} (%)`} style={{ fontSize: 10 }} />
innerRadius={40} </Space>
outerRadius={65} </div>
style={{ padding: 0 }} <UniversalBarChart
/> data={orderAlarmData}
xKey="date"
height={200}
series={[
{ key: 'newOrder', name: t('workOrder.newOrders'), color: '#1890ff' },
{ key: 'completed', name: t('workOrder.completeOrder'), color: '#52c41a' },
{ key: 'alarmCount', name: t('report.alarmCount'), color: '#fa8c16' },
{ key: 'closedRate', name: t('report.closureRate'), color: '#722ed1' },
]}
/>
</Card>
</Col>
<div style={{ <Col span={8}>
display: 'flex', <Card
flexDirection: 'column', bordered={false}
gap: 10, style={{ ...cardStyle, height: "100%" }}
paddingLeft: 8, bodyStyle={{ padding: '16px' }}
width: '100%', title={<span style={{ fontSize: 14, fontWeight: 700 }}>{t('report.aiAnalysisStatistics')}</span>}
boxSizing: 'border-box' >
}}> <div style={{ width: '100%', boxSizing: 'border-box' }}>
{aiAnalysisData.map((item, idx) => ( <UniversalPieChart
<div key={idx} style={{ data={aiPieData}
width={220}
height={220}
innerRadius={40}
outerRadius={65}
style={{ padding: 0 }}
/>
<div style={{
display: 'flex', display: 'flex',
justifyContent: 'space-between', flexDirection: 'column',
alignItems: 'center', gap: 10,
paddingLeft: 8,
width: '100%', width: '100%',
flexWrap: 'wrap', boxSizing: 'border-box'
wordBreak: 'break-all',
whiteSpace: 'normal'
}}> }}>
<Space size={6} style={{ {aiAnalysisData.map((item, idx) => (
fontSize: 11, <div key={idx} style={{
color: '#4E5969', display: 'flex',
flex: 1, justifyContent: 'space-between',
minWidth: '60%', alignItems: 'center',
display: 'flex', width: '100%',
alignItems: 'center', flexWrap: 'wrap',
flexWrap: 'wrap' wordBreak: 'break-all',
}}> whiteSpace: 'normal'
<div style={{ width: 6, height: 6, borderRadius: '50%', background: item.color, flexShrink: 0 }}></div> }}>
<span style={{ wordBreak: 'break-all', whiteSpace: 'normal' }}>{item.type}</span> <Space size={6} style={{
</Space> fontSize: 11,
<span style={{ color: '#4E5969',
fontSize: 12, flex: 1,
fontWeight: 700, minWidth: '60%',
whiteSpace: 'nowrap', display: 'flex',
flexShrink: 0 alignItems: 'center',
}}> flexWrap: 'wrap'
{item.value} <Text type="secondary" style={{ fontSize: 10, fontWeight: 400 }}>{t('report.unitItem')}</Text> }}>
</span> <div style={{ width: 6, height: 6, borderRadius: '50%', background: item.color, flexShrink: 0 }}></div>
<span style={{ wordBreak: 'break-all', whiteSpace: 'normal' }}>{item.type}</span>
</Space>
<span style={{
fontSize: 12,
fontWeight: 700,
whiteSpace: 'nowrap',
flexShrink: 0
}}>
{item.value} <Text type="secondary" style={{ fontSize: 10, fontWeight: 400 }}>{t('report.unitItem')}</Text>
</span>
</div>
))}
</div> </div>
))} </div>
</div> </Card>
</div> </Col>
</Row>
{/* 订阅与分发 */}
<Card bordered={false} style={{ ...cardStyle, marginTop: 8 }} bodyStyle={{ padding: '20px' }} title={<span style={{ fontSize: 15, fontWeight: 700, color: '#1D2129' }}>{t('report.subscriptionDispatch')}</span>}>
<Row gutter={[16, 16]} wrap>
<Col xs={24} sm={12} md={8}>
<div style={{ fontSize: 12, color: '#86909C', marginBottom: 12 }}>{t('report.subscribers', { count: 6 })}</div>
<div style={{ display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap' }}>
{[
{ name: '张运维', role: t('report.roleOmSupervisor'), img: 'https://img.icons8.com/fluency/48/user-male-circle.png' },
{ name: '李工程师', role: t('report.roleStationEngineer'), img: 'https://img.icons8.com/fluency/48/user-male-circle.png' },
{ name: '王运维', role: t('report.roleDeviceOm'), img: 'https://img.icons8.com/fluency/48/user-male-circle.png' },
{ name: '陈经理', role: t('report.roleOmManager'), img: 'https://img.icons8.com/fluency/48/user-male-circle.png' },
].map((p, idx) => (
<Tooltip title={`${p.name} - ${p.role}`} key={idx}>
<Avatar src={p.img} size={32} style={{ border: '2px solid #fff' }} />
</Tooltip>
))}
<Avatar size={32} style={{ background: '#F2F3F5', color: '#165DFF', fontSize: 12, fontWeight: 700, border: '2px solid #fff' }}>+2</Avatar>
</div>
</Col>
<Col xs={24} sm={12} md={8}>
<div style={{ fontSize: 12, color: '#86909C', marginBottom: 12 }}>{t('report.dispatchChannels')}</div>
<Space size={12} wrap>
<Button size="small" icon={<MailOutlined />} style={{ borderRadius: 6, background: '#E8F3FF', border: 'none', color: '#165DFF' }}>{t('report.email')} <CheckCircleFilled style={{ fontSize: 10, marginLeft: 4 }} /></Button>
<Button size="small" style={{ borderRadius: 6, background: '#E8F3FF', border: 'none', color: '#165DFF' }}>Telegram <CheckCircleFilled style={{ fontSize: 10, marginLeft: 4 }} /></Button>
<Button size="small" icon={<BellOutlined />} style={{ borderRadius: 6, background: '#E8F3FF', border: 'none', color: '#165DFF' }}>{t('report.systemNotification')} <CheckCircleFilled style={{ fontSize: 10, marginLeft: 4 }} /></Button>
</Space>
</Col>
<Col xs={24} sm={24} md={8}>
<div style={{ fontSize: 12, color: '#86909C', marginBottom: 12 }}>{t('report.sendPlan')}</div>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', background: '#f8fafc', padding: '8px 12px', borderRadius: 8, gap: 8 }}>
<Space size={8} wrap>
<CalendarOutlined style={{ color: '#165DFF' }} />
<span style={{ fontSize: 13, fontWeight: 700 }}>{t('report.weeklyAutoSend')}</span>
</Space>
<Button type="link" size="small" icon={<EditOutlined />} style={{ fontSize: 12, whiteSpace: 'nowrap' }}>{t('roles.edit')}</Button>
</div>
</Col>
</Row>
</Card>
</Col>
{/* 右侧边栏 */}
<Col xs={24} xl={8}>
{/* 报表目录 / 快捷下载 */}
<Card bordered={false} style={cardStyle} bodyStyle={{ padding: 0 }} title={<span style={{ fontSize: 15, fontWeight: 700 }}>{t('report.reportDirectory')}</span>} extra={<Button type="link" size="small">{t('common.more')} <ChevronRight size={14} /></Button>}>
<Table
rowKey="name"
columns={[
{
title: t('report.reportName'), dataIndex: 'name',
render: (text) => <Space size={8}><FilePdfOutlined style={{ color: '#F53F3F' }} />{text}</Space>
},
{
title: t('roles.status'), dataIndex: 'status', width: 80,
render: (v) => <Tag color={v === t('report.generated') ? 'success' : 'warning'} style={{ borderRadius: 4, fontSize: 10, margin: 0 }}>{v}</Tag>
},
{
title: t('roles.actions'), width: 120,
render: () => (
<Space split={<Divider type="vertical" />}>
<Button type="link" size="small" icon={<EyeOutlined />} style={{ fontSize: 12, padding: 0 }}>{t('common.view')}</Button>
<Button type="link" size="small" icon={<DownloadOutlined />} style={{ fontSize: 12, padding: 0 }}>{t('common.download')}</Button>
</Space>
)
}
]}
dataSource={reportFileList}
pagination={false}
size="small"
className="compact-table"
/>
</Card>
{/* 模板中心 */}
<Card bordered={false} style={{ ...cardStyle, marginTop: 8 }} bodyStyle={{ padding: '16px' }} title={<span style={{ fontSize: 15, fontWeight: 700 }}>{t('report.templateCenter')}</span>} extra={<Button type="link" size="small">{t('common.more')} <ChevronRight size={14} /></Button>}>
<Row gutter={[12, 12]}>
{reportTemplates.map((tpl, idx) => (
<Col span={12} key={idx}>
<div style={{ background: '#f8fafc', padding: '12px', borderRadius: 10, height: '100%', border: '1px solid #f0f0f0' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 8 }}>
<div style={{ width: 32, height: 32, borderRadius: 8, background: tpl.bg, color: tpl.color, display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 16 }}>
{tpl.icon}
</div>
<div style={{ fontSize: 13, fontWeight: 700, color: '#1D2129' }}>{tpl.name}</div>
</div>
<div style={{ fontSize: 11, color: '#86909C', lineHeight: 1.4 }}>{tpl.desc}</div>
</div>
</Col>
))}
</Row>
</Card>
{/* 报表生成记录 */}
<Card bordered={false} style={{ ...cardStyle, marginTop: 8 }} bodyStyle={{ padding: 0 }} title={<span style={{ fontSize: 15, fontWeight: 700 }}>{t('report.generationRecords')}</span>} extra={<Button type="link" size="small">{t('common.more')} <ChevronRight size={14} /></Button>}>
<Table
rowKey="name"
columns={[
{ title: t('report.reportName'), dataIndex: 'name', width: 100, ellipsis: true },
{ title: t('report.generateTime'), dataIndex: 'time', width: 130 },
{ title: t('report.generator'), dataIndex: 'operator', width: 80 },
{ title: t('common.type'), dataIndex: 'type', width: 80 },
{
title: t('roles.status'), dataIndex: 'status', width: 70,
render: (v) => <Tag color={v === t('report.generated') ? 'success' : 'warning'} style={{ borderRadius: 4, fontSize: 10, margin: 0 }}>{v}</Tag>
},
{
title: t('roles.actions'), width: 90,
render: () => (
<Space size={8}>
<Button type="text" icon={<EyeOutlined />} size="small" />
<Button type="text" icon={<DownloadOutlined />} size="small" />
</Space>
)
}
]}
dataSource={generationRecord}
pagination={false}
size="small"
className="compact-table"
scroll={{ y: 240 }}
/>
</Card> </Card>
</Col> </Col>
</Row> </Row>
{/* 订阅与分发 */} </>
<Card variant="borderless" style={{ ...cardStyle, marginTop: 8 }} styles={{ body: { padding: '20px' } }} title={<span style={{ fontSize: 15, fontWeight: 700, color: '#1D2129' }}>{t('report.subscriptionDispatch')}</span>}> )}
<Row gutter={[16, 16]} wrap>
<Col xs={24} sm={12} md={8}>
<div style={{ fontSize: 12, color: '#86909C', marginBottom: 12 }}>{t('report.subscribers', { count: 6 })}</div>
<div style={{ display: 'flex', alignItems: 'center', gap: 8, flexWrap: 'wrap' }}>
{[
{ name: '张运维', role: t('report.roleOmSupervisor'), img: 'https://img.icons8.com/fluency/48/user-male-circle.png' },
{ name: '李工程师', role: t('report.roleStationEngineer'), img: 'https://img.icons8.com/fluency/48/user-male-circle.png' },
{ name: '王运维', role: t('report.roleDeviceOm'), img: 'https://img.icons8.com/fluency/48/user-male-circle.png' },
{ name: '陈经理', role: t('report.roleOmManager'), img: 'https://img.icons8.com/fluency/48/user-male-circle.png' },
].map((p, idx) => (
<Tooltip title={`${p.name} - ${p.role}`} key={idx}>
<Avatar src={p.img} size={32} style={{ border: '2px solid #fff' }} />
</Tooltip>
))}
<Avatar size={32} style={{ background: '#F2F3F5', color: '#165DFF', fontSize: 12, fontWeight: 700, border: '2px solid #fff' }}>+2</Avatar>
</div>
</Col>
<Col xs={24} sm={12} md={8}>
<div style={{ fontSize: 12, color: '#86909C', marginBottom: 12 }}>{t('report.dispatchChannels')}</div>
<Space size={12} wrap>
<Button size="small" icon={<MailOutlined />} style={{ borderRadius: 6, background: '#E8F3FF', border: 'none', color: '#165DFF' }}>{t('report.email')} <CheckCircleFilled style={{ fontSize: 10, marginLeft: 4 }} /></Button>
<Button size="small" style={{ borderRadius: 6, background: '#E8F3FF', border: 'none', color: '#165DFF' }}>Telegram <CheckCircleFilled style={{ fontSize: 10, marginLeft: 4 }} /></Button>
<Button size="small" icon={<BellOutlined />} style={{ borderRadius: 6, background: '#E8F3FF', border: 'none', color: '#165DFF' }}>{t('report.systemNotification')} <CheckCircleFilled style={{ fontSize: 10, marginLeft: 4 }} /></Button>
</Space>
</Col>
<Col xs={24} sm={24} md={8}>
<div style={{ fontSize: 12, color: '#86909C', marginBottom: 12 }}>{t('report.sendPlan')}</div>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', background: '#f8fafc', padding: '8px 12px', borderRadius: 8, gap: 8 }}>
<Space size={8} wrap>
<CalendarOutlined style={{ color: '#165DFF' }} />
<span style={{ fontSize: 13, fontWeight: 700 }}>{t('report.weeklyAutoSend')}</span>
</Space>
<Button type="link" size="small" icon={<EditOutlined />} style={{ fontSize: 12, whiteSpace: 'nowrap' }}>{t('roles.edit')}</Button>
</div>
</Col>
</Row>
</Card>
</Col>
{/* 右侧边栏 */}
<Col xs={24} xl={8}>
{/* 报表目录 / 快捷下载 */}
<Card variant="borderless" style={cardStyle} styles={{ body: { padding: 0 } }} title={<span style={{ fontSize: 15, fontWeight: 700 }}>{t('report.reportDirectory')}</span>} extra={<Button type="link" size="small">{t('common.more')} <ChevronRight size={14} /></Button>}>
<Table
rowKey="name"
columns={[
{
title: t('report.reportName'), dataIndex: 'name',
render: (text) => <Space size={8}><FilePdfOutlined style={{ color: '#F53F3F' }} />{text}</Space>
},
{
title: t('roles.status'), dataIndex: 'status', width: 80,
render: (v) => <Tag color={v === t('report.generated') ? 'success' : 'warning'} style={{ borderRadius: 4, fontSize: 10, margin: 0 }}>{v}</Tag>
},
{
title: t('roles.actions'), width: 120,
render: () => (
<Space split={<Divider type="vertical" />}>
<Button type="link" size="small" icon={<EyeOutlined />} style={{ fontSize: 12, padding: 0 }}>{t('common.view')}</Button>
<Button type="link" size="small" icon={<DownloadOutlined />} style={{ fontSize: 12, padding: 0 }}>{t('common.download')}</Button>
</Space>
)
}
]}
dataSource={reportFileList}
pagination={false}
size="small"
className="compact-table"
/>
</Card>
{/* 模板中心 */}
<Card variant="borderless" style={{ ...cardStyle, marginTop: 8 }} styles={{ body: { padding: '16px' } }} title={<span style={{ fontSize: 15, fontWeight: 700 }}>{t('report.templateCenter')}</span>} extra={<Button type="link" size="small">{t('common.more')} <ChevronRight size={14} /></Button>}>
<Row gutter={[12, 12]}>
{reportTemplates.map((tpl, idx) => (
<Col span={12} key={idx}>
<div style={{ background: '#f8fafc', padding: '12px', borderRadius: 10, height: '100%', border: '1px solid #f0f0f0' }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 10, marginBottom: 8 }}>
<div style={{ width: 32, height: 32, borderRadius: 8, background: tpl.bg, color: tpl.color, display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 16 }}>
{tpl.icon}
</div>
<div style={{ fontSize: 13, fontWeight: 700, color: '#1D2129' }}>{tpl.name}</div>
</div>
<div style={{ fontSize: 11, color: '#86909C', lineHeight: 1.4 }}>{tpl.desc}</div>
</div>
</Col>
))}
</Row>
</Card>
{/* 报表生成记录 */}
<Card variant="borderless" style={{ ...cardStyle, marginTop: 8 }} styles={{ body: { padding: 0 } }} title={<span style={{ fontSize: 15, fontWeight: 700 }}>{t('report.generationRecords')}</span>} extra={<Button type="link" size="small">{t('common.more')} <ChevronRight size={14} /></Button>}>
<Table
rowKey="name"
columns={[
{ title: t('report.reportName'), dataIndex: 'name', width: 100, ellipsis: true },
{ title: t('report.generateTime'), dataIndex: 'time', width: 130 },
{ title: t('report.generator'), dataIndex: 'operator', width: 80 },
{ title: t('common.type'), dataIndex: 'type', width: 80 },
{
title: t('roles.status'), dataIndex: 'status', width: 70,
render: (v) => <Tag color={v === t('report.generated') ? 'success' : 'warning'} style={{ borderRadius: 4, fontSize: 10, margin: 0 }}>{v}</Tag>
},
{
title: t('roles.actions'), width: 90,
render: () => (
<Space size={8}>
<Button type="text" icon={<EyeOutlined />} size="small" />
<Button type="text" icon={<DownloadOutlined />} size="small" />
</Space>
)
}
]}
dataSource={generationRecord}
pagination={false}
size="small"
className="compact-table"
scroll={{ y: 240 }}
/>
</Card>
</Col>
</Row>
</div> </div>
); );
} }