|
|
@@ -0,0 +1,96 @@
|
|
|
+
|
|
|
+interface DebtRatioData {
|
|
|
+ id: number;
|
|
|
+ year: number;
|
|
|
+ assetLiabilityRatio: number;
|
|
|
+ dataDeadline: string;
|
|
|
+ createTime: string;
|
|
|
+ updateTime: string;
|
|
|
+}
|
|
|
+
|
|
|
+interface DebtRatioMetricsProps {
|
|
|
+ data: DebtRatioData[];
|
|
|
+}
|
|
|
+
|
|
|
+export function DebtRatioMetrics({ data }: DebtRatioMetricsProps) {
|
|
|
+ // 如果没有数据,显示空状态
|
|
|
+ if (!data || data.length === 0) {
|
|
|
+ return (
|
|
|
+ <div className="h-full flex items-center justify-center">
|
|
|
+ <div className="text-center text-slate-400">
|
|
|
+ <div className="text-2xl mb-2">📊</div>
|
|
|
+ <p>暂无资产负债率数据</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // 将数据转换为显示格式
|
|
|
+ const displayData = data.map(item => ({
|
|
|
+ year: `${item.year}年`,
|
|
|
+ ratio: item.assetLiabilityRatio, // 百分比数据,不需要转换
|
|
|
+ }));
|
|
|
+
|
|
|
+ const maxValue = Math.max(...displayData.map(d => d.ratio));
|
|
|
+
|
|
|
+ return (
|
|
|
+ <div className="h-full">
|
|
|
+ {/* 模块标题 */}
|
|
|
+ <div className="flex justify-between items-center mb-6">
|
|
|
+ <div className="flex items-center gap-2">
|
|
|
+ <div className="w-3 h-3 bg-red-500 rounded-sm"></div>
|
|
|
+ <span className="text-lg text-white">资产负债率</span>
|
|
|
+ </div>
|
|
|
+ <span className="text-sm text-slate-400">*数据截止至2025年9月</span>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {/* 单位 */}
|
|
|
+ <div className="text-sm text-slate-400 mb-4">单位:%</div>
|
|
|
+
|
|
|
+ {/* 图表区域 */}
|
|
|
+ <div className="relative h-64">
|
|
|
+ {/* Y轴刻度 */}
|
|
|
+ <div className="absolute left-0 top-0 bottom-0 w-12 flex flex-col justify-between text-sm text-slate-400">
|
|
|
+ {[100, 80, 60, 40, 20, 0].map((value) => (
|
|
|
+ <div key={value} className="text-right pr-2">
|
|
|
+ {value}
|
|
|
+ </div>
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {/* 图表内容 */}
|
|
|
+ <div className="ml-12 h-full relative">
|
|
|
+ {/* 网格线 */}
|
|
|
+ <div className="absolute inset-0 flex flex-col justify-between">
|
|
|
+ {[...Array(6)].map((_, i) => (
|
|
|
+ <div key={i} className="border-t border-slate-600/30"></div>
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {/* 数据条 */}
|
|
|
+ <div className="flex items-end justify-between h-full px-4">
|
|
|
+ {displayData.map((item) => (
|
|
|
+ <div key={item.year} className="flex flex-col items-center gap-2">
|
|
|
+ {/* 数据标签 */}
|
|
|
+ <div className="bg-gradient-to-b from-red-500 to-red-700 border border-red-400 backdrop-blur-sm px-3 py-2 rounded text-center shadow-lg">
|
|
|
+ <div className="text-sm font-medium text-white">{item.ratio.toFixed(1)}%</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {/* 数据条 */}
|
|
|
+ <div className="flex flex-col items-center">
|
|
|
+ <div
|
|
|
+ className="w-12 bg-gradient-to-b from-red-500 to-red-700 rounded-t-lg"
|
|
|
+ style={{ height: `${(item.ratio / maxValue) * 80}%` }}
|
|
|
+ ></div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {/* 年份标签 */}
|
|
|
+ <div className="text-sm text-slate-400 mt-2">{item.year}</div>
|
|
|
+ </div>
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+}
|