feat(ecom-dmb): 新增平台维度汇总功能

后端:
- CompanyOverviewVO 新增 platformSummary 平台维度汇总数据
- CompanyOverviewServiceImpl 新增 calculatePlatformSummary() 方法,按平台聚合数据
- PlatformExportDTO 导出参数 DTO
- ExportService/ExportServiceImpl 新增 exportPlatformOverview 导出方法
- ExportController 新增 POST /ec/platform-overview/export 接口

前端:
- PlatformSummaryCard 组件显示各平台多维度经营明细对比
- 支持指定平台导出和导出全部两种模式
- 组件优先使用动态数据,无数据时降级到 mock 数据
- types.vo.ts 新增 PlatformSummary 类型定义
- index.vue 集成平台导出功能
This commit is contained in:
小蟑螂
2026-04-23 11:58:59 +08:00
parent 1dac4de215
commit cfc0078aba
9 changed files with 1132 additions and 3 deletions
@@ -26,6 +26,7 @@ import { exportByPost } from '#/utils/export';
import CategoryComparisonTable from './components/CategoryComparisonTable.vue';
import KpiCards from './components/KpiCards.vue';
import ShopCharts from './components/ShopCharts.vue';
import PlatformSummaryCard from './components/PlatformSummaryCard.vue';
import ShopComparisonTable from './components/ShopComparisonTable.vue';
defineOptions({ name: 'CompanyOverview' });
@@ -44,6 +45,10 @@ const shopCount = ref(0);
const shopExportMode = ref(false);
const selectedExportShopIds = ref<number[]>([]);
// 指定平台导出模式
const platformExportMode = ref(false);
const selectedExportPlatformIds = ref<number[]>([]);
// 日期范围
const dateRange = ref<[dayjs.Dayjs, dayjs.Dayjs]>([
dayjs().subtract(30, 'day'),
@@ -406,6 +411,40 @@ const toggleShopExportMode = (enabled: boolean) => {
}
};
// 切换平台导出模式
const togglePlatformExportMode = (enabled: boolean) => {
platformExportMode.value = enabled;
if (!enabled) {
selectedExportPlatformIds.value = [];
}
};
// 导出平台维度汇总
const handlePlatformExport = async () => {
try {
exportLoading.value = true;
const [startDate, endDate] = dateRange.value;
const filename = `平台维度汇总_${startDate.format('YYYYMMDD')}_${endDate.format('YYYYMMDD')}.xlsx`;
await exportByPost(
'/ec/platform-overview/export',
{
dateRange: [
startDate.format('YYYY-MM-DD'),
endDate.format('YYYY-MM-DD'),
],
platformIds: selectedExportPlatformIds.value.length > 0
? selectedExportPlatformIds.value
: undefined,
taxRate: taxRate.value,
},
filename,
);
platformExportMode.value = false;
} finally {
exportLoading.value = false;
}
};
// 跳转到店铺详情页
const navigateToShopOverview = (shopId: number) => {
router.push({
@@ -539,7 +578,18 @@ const navigateToShopOverview = (shopId: number) => {
:shop-efficiency-quadrants="overviewData?.shopEfficiencyQuadrants"
/>
<!-- 第三层:横向对比大表 -->
<!-- 第三层:平台维度汇总 -->
<PlatformSummaryCard
:platform-summary="overviewData?.platformSummary"
:tax-rate="taxRate"
:platform-export-mode="platformExportMode"
:selected-export-platform-ids="selectedExportPlatformIds"
@update:selected-export-platform-ids="(ids) => (selectedExportPlatformIds = ids)"
@toggle-platform-export-mode="togglePlatformExportMode"
@export="handlePlatformExport"
/>
<!-- 第四层:横向对比大表 -->
<ShopComparisonTable
:shop-comparisons="overviewData?.shopComparisons"
:tax-rate="taxRate"
@@ -551,7 +601,7 @@ const navigateToShopOverview = (shopId: number) => {
@navigate="navigateToShopOverview"
/>
<!-- 第四层:品类多维度经营明细对比 -->
<!-- 第五层:品类多维度经营明细对比 -->
<CategoryComparisonTable
:category-comparisons="overviewData?.categoryComparisons"
:tax-rate="taxRate"