feat: 短信服务
This commit is contained in:
@@ -42,6 +42,18 @@ const MaritimeDashboard: React.FC = () => {
|
||||
const [taskStatDate, setTaskStatDate] = useState(dayjs());
|
||||
const [tenantId, setTenantId] = useState<string | undefined>();
|
||||
const [includeChildren, setIncludeChildren] = useState<boolean>(true);
|
||||
const [compactLevel, setCompactLevel] = useState<0 | 1 | 2>(0);
|
||||
|
||||
useEffect(() => {
|
||||
const calc = () => {
|
||||
const height = window?.innerHeight || 0;
|
||||
const next: 0 | 1 | 2 = height <= 760 ? 2 : height <= 900 ? 1 : 0;
|
||||
setCompactLevel(next);
|
||||
};
|
||||
calc();
|
||||
window.addEventListener('resize', calc);
|
||||
return () => window.removeEventListener('resize', calc);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
// 模拟年度数据
|
||||
@@ -167,6 +179,40 @@ const MaritimeDashboard: React.FC = () => {
|
||||
}));
|
||||
}, [taskTrend]);
|
||||
|
||||
const chartHeights = useMemo(() => {
|
||||
if (compactLevel === 2) {
|
||||
return {
|
||||
taskTrend: 140,
|
||||
pie: 160,
|
||||
column: 140,
|
||||
taskComplete: 120,
|
||||
area: 170,
|
||||
rose: 160,
|
||||
taskStatus: 150,
|
||||
};
|
||||
}
|
||||
if (compactLevel === 1) {
|
||||
return {
|
||||
taskTrend: 160,
|
||||
pie: 180,
|
||||
column: 160,
|
||||
taskComplete: 140,
|
||||
area: 190,
|
||||
rose: 180,
|
||||
taskStatus: 170,
|
||||
};
|
||||
}
|
||||
return {
|
||||
taskTrend: 180,
|
||||
pie: 200,
|
||||
column: 180,
|
||||
taskComplete: 160,
|
||||
area: 220,
|
||||
rose: 200,
|
||||
taskStatus: 190,
|
||||
};
|
||||
}, [compactLevel]);
|
||||
|
||||
const taskTrendConfig: any = {
|
||||
data: taskTrendSeriesData,
|
||||
xField: 'date',
|
||||
@@ -181,7 +227,7 @@ const MaritimeDashboard: React.FC = () => {
|
||||
xAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } }, grid: null },
|
||||
yAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } }, grid: { line: { style: { stroke: 'rgba(0,150,200,0.1)' } } } },
|
||||
tooltip: { showMarkers: true },
|
||||
height: 180,
|
||||
height: chartHeights.taskTrend,
|
||||
};
|
||||
|
||||
// 设备类型分布 - 模拟数据
|
||||
@@ -213,7 +259,7 @@ const MaritimeDashboard: React.FC = () => {
|
||||
style: { fill: 'rgba(200,230,255,0.65)' },
|
||||
},
|
||||
legend: { position: 'bottom', itemValue: { style: { fill: 'rgba(200,230,255,0.65)' } }, itemName: { style: { fill: 'rgba(200,230,255,0.65)' } } },
|
||||
height: 200,
|
||||
height: chartHeights.pie,
|
||||
};
|
||||
|
||||
const columnConfig: any = {
|
||||
@@ -233,7 +279,7 @@ const MaritimeDashboard: React.FC = () => {
|
||||
xAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } } },
|
||||
yAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } }, grid: { line: { style: { stroke: 'rgba(0,150,200,0.1)' } } } },
|
||||
legend: false,
|
||||
height: 180,
|
||||
height: chartHeights.column,
|
||||
};
|
||||
|
||||
const taskCompleteTrendConfig: any = {
|
||||
@@ -249,7 +295,7 @@ const MaritimeDashboard: React.FC = () => {
|
||||
grid: { line: { style: { stroke: 'rgba(0,150,200,0.08)' } } },
|
||||
},
|
||||
tooltip: { showMarkers: true },
|
||||
height: 160,
|
||||
height: chartHeights.taskComplete,
|
||||
};
|
||||
|
||||
const areaConfig: any = {
|
||||
@@ -263,7 +309,7 @@ const MaritimeDashboard: React.FC = () => {
|
||||
yAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } }, grid: { line: { style: { stroke: 'rgba(0,150,200,0.1)' } } } },
|
||||
legend: { position: 'top-right', itemName: { style: { fill: 'rgba(200,230,255,0.8)' } } },
|
||||
smooth: true,
|
||||
height: 220,
|
||||
height: chartHeights.area,
|
||||
};
|
||||
|
||||
const roseConfig: any = {
|
||||
@@ -278,7 +324,7 @@ const MaritimeDashboard: React.FC = () => {
|
||||
style: { fill: '#fff', fontSize: 10 },
|
||||
},
|
||||
legend: { position: 'bottom', itemName: { style: { fill: 'rgba(200,230,255,0.65)' } } },
|
||||
height: 200,
|
||||
height: chartHeights.rose,
|
||||
};
|
||||
|
||||
const taskStatusPieConfig: any = {
|
||||
@@ -304,7 +350,7 @@ const MaritimeDashboard: React.FC = () => {
|
||||
style: { fill: 'rgba(200,230,255,0.65)' },
|
||||
},
|
||||
legend: { position: 'bottom', itemValue: { style: { fill: 'rgba(200,230,255,0.65)' } }, itemName: { style: { fill: 'rgba(200,230,255,0.65)' } } },
|
||||
height: 190,
|
||||
height: chartHeights.taskStatus,
|
||||
};
|
||||
|
||||
const getAlertColor = (level: string) => {
|
||||
@@ -335,11 +381,12 @@ const MaritimeDashboard: React.FC = () => {
|
||||
}, [taskStatType]);
|
||||
|
||||
return (
|
||||
<div className="maritime-dashboard">
|
||||
<div className={`maritime-dashboard maritime-dashboard--compact-${compactLevel}`}>
|
||||
<div className="wave-bg-animation"></div>
|
||||
<div className="wave-layer"></div>
|
||||
<div className="wave-layer-2"></div>
|
||||
<div className="wave-layer-3"></div>
|
||||
<div className="maritime-bottom-frame" aria-hidden="true" />
|
||||
|
||||
<Spin spinning={loading} wrapperClassName="maritime-spin">
|
||||
<div className="maritime-content">
|
||||
|
||||
Reference in New Issue
Block a user