refactor(ecom-dmb): 导出服务重构,ExportServiceImpl拆分为独立服务类,抽取ExportFilenameUtils统一文件名构建

This commit is contained in:
小蟑螂
2026-04-28 14:02:29 +08:00
parent 455f10beed
commit 57fe400dee
21 changed files with 979 additions and 831 deletions
@@ -69,7 +69,12 @@ const handleCategoryExport = async () => {
if (selectedExportCategoryIds.value.length > 0) {
Object.assign(params, { categoryIds: selectedExportCategoryIds.value });
}
await exportByPost('/ec/category-overview/export', params, '品类多维度经营明细.xlsx');
const [cStart, cEnd] = dateRange.value;
await exportByPost(
'/ec/category-overview/export',
params,
`品类概览_${cStart.format('YYYYMMDD')}-${cEnd.format('YYYYMMDD')}.xlsx`,
);
};
// 税率(公司/店铺概览共用持久化)
@@ -386,7 +391,7 @@ const handleExportCompanyOverview = async () => {
: undefined;
}
const filename = `公司概览_${startDate.format('YYYYMMDD')}_${endDate.format('YYYYMMDD')}.xlsx`;
const filename = `公司概览_${startDate.format('YYYYMMDD')}-${endDate.format('YYYYMMDD')}.xlsx`;
await exportByPost(
'/ec/store-overview/export',
{
@@ -427,7 +432,7 @@ const handlePlatformExport = async () => {
try {
exportLoading.value = true;
const [startDate, endDate] = dateRange.value;
const filename = `平台维度汇总_${startDate.format('YYYYMMDD')}_${endDate.format('YYYYMMDD')}.xlsx`;
const filename = `平台维度汇总_${startDate.format('YYYYMMDD')}-${endDate.format('YYYYMMDD')}.xlsx`;
await exportByPost(
'/ec/platform-overview/export',
{
@@ -232,7 +232,7 @@ const handleExportShopOverview = async () => {
exportLoading.value = true;
const shopName = overviewData.value?.shopName || `店铺${shopId.value}`;
const [startDate, endDate] = dateRange.value;
const filename = `${shopName}_概览_${startDate.format('YYYYMMDD')}_${endDate.format('YYYYMMDD')}.xlsx`;
const filename = `${shopName}_概览_${startDate.format('YYYYMMDD')}-${endDate.format('YYYYMMDD')}.xlsx`;
await exportByPost(
'/ec/shop/export-overview',
{
@@ -270,7 +270,12 @@ const handleCategoryExport = async () => {
if (selectedExportCategoryIds.value.length > 0) {
params.categoryIds = selectedExportCategoryIds.value;
}
await exportByPost('/ec/shop/export-category', params, '门店品类汇总.xlsx');
const [catStart, catEnd] = dateRange.value;
await exportByPost(
'/ec/shop/export-category',
params,
`门店品类汇总_${catStart.format('YYYYMMDD')}-${catEnd.format('YYYYMMDD')}.xlsx`,
);
} finally {
categoryExportLoading.value = false;
}