feat: 年度价值报告增加员工维度规避损失明细
- 后端按员工汇总已解决风险明细,含风险标题、法律依据、预估损失 - 前端新增员工规避损失明细表格,展示每员工的原始损失、规避率(30%)、打折后损失 - 表格含合计行,与总价值计算逻辑一致 - 修复RISK_AVOIDANCE_RATE重复声明
This commit is contained in:
@@ -220,6 +220,62 @@ export default function AnnualValueReport() {
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
{/* 员工规避损失明细 */}
|
||||
{report.employeeDetails && report.employeeDetails.length > 0 && (
|
||||
<Card>
|
||||
<h2 className="text-sm font-medium mb-3">员工规避损失明细</h2>
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full text-xs">
|
||||
<thead>
|
||||
<tr className="border-b border-gray-200 text-gray-500">
|
||||
<th className="text-left py-2 px-2 font-medium">员工</th>
|
||||
<th className="text-left py-2 px-2 font-medium">部门</th>
|
||||
<th className="text-center py-2 px-2 font-medium">风险数</th>
|
||||
<th className="text-right py-2 px-2 font-medium">原始损失</th>
|
||||
<th className="text-right py-2 px-2 font-medium">规避率</th>
|
||||
<th className="text-right py-2 px-2 font-medium">规避损失(×30%)</th>
|
||||
<th className="text-left py-2 px-2 font-medium">风险明细</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{report.employeeDetails.map((emp: any, idx: number) => (
|
||||
<tr key={emp.employeeId || idx} className="border-b border-gray-50">
|
||||
<td className="py-2 px-2 font-medium">{emp.name}</td>
|
||||
<td className="py-2 px-2 text-gray-600">{emp.department}</td>
|
||||
<td className="py-2 px-2 text-center">{emp.riskCount}</td>
|
||||
<td className="py-2 px-2 text-right text-gray-600">¥{emp.lossAvoided.toLocaleString()}</td>
|
||||
<td className="py-2 px-2 text-right text-gray-400">30%</td>
|
||||
<td className="py-2 px-2 text-right font-bold text-safe">¥{emp.adjustedLoss.toLocaleString()}</td>
|
||||
<td className="py-2 px-2">
|
||||
<div className="space-y-0.5">
|
||||
{emp.details.map((d: any, i: number) => (
|
||||
<div key={i} className="flex items-center gap-1.5">
|
||||
<span className="text-gray-700">{d.title}</span>
|
||||
<span className="text-gray-400">·</span>
|
||||
<span className="text-gray-500">{d.legalBasis}</span>
|
||||
<span className="text-gray-400">·</span>
|
||||
<span className="text-gray-600">¥{d.estimatedLoss.toLocaleString()}</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr className="border-t-2 border-gray-200 font-bold">
|
||||
<td className="py-2 px-2" colSpan={3}>合计</td>
|
||||
<td className="py-2 px-2 text-right">¥{(report.lossAvoided || 0).toLocaleString()}</td>
|
||||
<td className="py-2 px-2"></td>
|
||||
<td className="py-2 px-2 text-right text-safe">¥{(report.adjustedLossAvoided || 0).toLocaleString()}</td>
|
||||
<td className="py-2 px-2"></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{/* 价值计算说明 */}
|
||||
<Card className="bg-gray-50">
|
||||
<h2 className="text-sm font-medium mb-2">价值计算说明</h2>
|
||||
|
||||
Reference in New Issue
Block a user