diff --git a/src/layout/FullOther/RiskControl.js b/src/layout/FullOther/RiskControl.js index f07baae..6dee6d4 100644 --- a/src/layout/FullOther/RiskControl.js +++ b/src/layout/FullOther/RiskControl.js @@ -46,7 +46,7 @@ class RiskControl extends React.Component { this.echartsInstances.stackBarChart = echarts.init(chartDom); const { riskSubData } = this.props; - const riskList = riskSubData?.riskList || []; + const riskList = riskSubData?.riskList.filter((item) => item.companyName !== '小计') || []; if (riskList.length === 0) { this.echartsInstances.stackBarChart.setOption({ @@ -324,6 +324,8 @@ class RiskControl extends React.Component { this.setupResizeHandler('typeBarChart', this.renderTypeBarChart); }; + // 表格: 各公司风险统计明细表 + // 表格: 各公司风险统计明细表 // 表格: 各公司风险统计明细表 renderRiskTable = () => { const { riskSubData } = this.props; @@ -333,100 +335,238 @@ class RiskControl extends React.Component { return
暂无风险数据
; } - // 表格列配置(与 trainingContent 样式保持一致) - const columns = [ - { - title: '公司名称', - dataIndex: 'companyName', - key: 'companyName', - align: 'center', - width: 120, - render: (text) => {text}, - }, - { - title: '重大风险', - dataIndex: 'majorCount', - key: 'majorCount', - align: 'center', - width: 100, - render: (text) => {text}, - }, - { - title: '较大风险', - dataIndex: 'largerCount', - key: 'largerCount', - align: 'center', - width: 100, - render: (text) => {text}, - }, - { - title: '一般风险', - dataIndex: 'generalCount', - key: 'generalCount', - align: 'center', - width: 100, - render: (text) => {text}, - }, - { - title: '低风险', - dataIndex: 'lowCount', - key: 'lowCount', - align: 'center', - width: 100, - render: (text) => {text}, - }, - { - title: '小计', - dataIndex: 'totalCount', - key: 'totalCount', - align: 'center', - width: 100, - render: (text) => {text}, - }, - ]; + const filteredRiskList = riskList.filter((item) => item.companyName !== '小计'); - const tableData = riskList.map((item, index) => ({ - key: index, - companyName: item.companyName, - majorCount: item.majorCount, - largerCount: item.largerCount, - generalCount: item.generalCount, - lowCount: item.lowCount, - totalCount: item.totalCount, - })); - - // 合计行 const summary = { - majorTotal: riskList.reduce((sum, item) => sum + (item.majorCount || 0), 0), - largerTotal: riskList.reduce((sum, item) => sum + (item.largerCount || 0), 0), - generalTotal: riskList.reduce((sum, item) => sum + (item.generalCount || 0), 0), - lowTotal: riskList.reduce((sum, item) => sum + (item.lowCount || 0), 0), - totalAll: riskList.reduce((sum, item) => sum + (item.totalCount || 0), 0), + majorTotal: filteredRiskList.reduce((sum, item) => sum + (item.majorCount || 0), 0), + largerTotal: filteredRiskList.reduce((sum, item) => sum + (item.largerCount || 0), 0), + generalTotal: filteredRiskList.reduce((sum, item) => sum + (item.generalCount || 0), 0), + lowTotal: filteredRiskList.reduce((sum, item) => sum + (item.lowCount || 0), 0), + totalAll: filteredRiskList.reduce((sum, item) => sum + (item.totalCount || 0), 0), }; - const scrollConfig = columns.length > 10 ? { x: columns.length * 100, y: 360 } : { y: 360 }; + + const totalWidth = 620; + return ( -
+
各家公司的风险统计情况
-
- + + {/* 表格滚动区域 */} +
+
+ {/* 表头 - 使用 sticky 固定 */} + + + + + + + + + + + + + {filteredRiskList.map((item, index) => ( + + + + + + + + + ))} + + + {/* 合计行 - 使用 sticky 固定在底部 */} + + + + + + + + + + +
+ 公司名称 + + 重大风险 + + 较大风险 + + 一般风险 + + 低风险 + + 小计 +
+ {item.companyName} + + {item.majorCount} + + {item.largerCount} + + {item.generalCount} + + {item.lowCount} + + {item.totalCount} +
+ 合计 + + {summary.majorTotal} + + {summary.largerTotal} + + {summary.generalTotal} + + {summary.lowTotal} + + {summary.totalAll} +
);