import { useRef, useEffect } from 'react'; import * as echarts from 'echarts'; import { ContentPage } from './ContentPage'; import type { BarChartCompareItem } from '../types/data'; interface ExportTaxBarProps { title: string; data: BarChartCompareItem[]; description?: string; } export const ExportTaxBar = ({ title, data = [], description }: ExportTaxBarProps) => { const chartRef = useRef(null); useEffect(() => { if (!chartRef.current) return; const myChart = echarts.init(chartRef.current); const option: echarts.EChartsOption = { animation: false, silent: true, tooltip: { show: false }, legend: { data: ['本机构', '全量客户'], right: 10, top: 0, textStyle: { fontSize: 9, color: '#666' }, itemWidth: 10, itemHeight: 10, itemGap: 12 }, grid: { top: 30, bottom: 75, left: 35, right: 15, containLabel: true }, xAxis: { type: 'category', data: data.map(d => d.label), axisLabel: { fontSize: 8, color: '#666', interval: 0, rotate: 0, margin: 8, formatter: (value: string) => { if (value.includes('出口免抵退税额')) { return value.replace('额', '额\n'); } if (value.includes('出口退税额')) { return value.replace('额', '额\n'); } if (value.includes('关联企业数量')) { return value.replace('数量', '数量\n'); } return value; } }, axisLine: { lineStyle: { color: '#F0F0F0' } }, axisTick: { show: false } }, yAxis: { type: 'value', min: 0, max: 100, interval: 20, axisLabel: { fontSize: 9, color: '#666', formatter: '{value}%' }, axisLine: { show: false }, axisTick: { show: false }, splitLine: { show: true, lineStyle: { type: 'dashed', color: '#F0F0F0' } } }, series: [ { name: '本机构', type: 'bar', data: data.map(d => d.customerValue), barGap: '10%', barWidth: 22, itemStyle: { color: '#45dad1', borderRadius: [2, 2, 0, 0] }, label: { show: true, position: 'top', fontSize: 8, color: '#666', formatter: '{c}%' } }, { name: '全量客户', type: 'bar', data: data.map(d => d.marketValue), barGap: '10%', barWidth: 22, itemStyle: { color: '#40a9ff', borderRadius: [2, 2, 0, 0] }, label: { show: true, position: 'top', fontSize: 8, color: '#666', formatter: '{c}%' } } ] }; myChart.setOption(option); const handleResize = () => myChart.resize(); window.addEventListener('resize', handleResize); return () => { window.removeEventListener('resize', handleResize); myChart.dispose(); }; }, [data]); return (

{title}

{description && (

{description}

)}
); }; interface Page06ExportTaxProps { exportFreeTaxRebate: BarChartCompareItem[]; exportTaxRebate: BarChartCompareItem[]; chartDescriptions?: { exportFreeTaxRebate?: string; exportTaxRebate?: string }; } export const Page06ExportTax = ({ exportFreeTaxRebate = [], exportTaxRebate = [], chartDescriptions }: Page06ExportTaxProps) => { return (
); };