refactor(api): 全店概览导出接口路径统一为 RESTful 风格

- ExportController 路径改为 /ec/store-overview/export/{by-shop|by-category|by-platform}
- ExportFilenameUtils 新增 buildFullStoreOverviewXlsxName 方法
- ShopExportController 路径同步调整
- 前端 store-overview / shop apis 同步适配新接口路径
This commit is contained in:
小蟑螂
2026-05-06 01:32:52 +08:00
parent 330b6f0955
commit 157c5ae3c4
14 changed files with 149 additions and 82 deletions
@@ -71,9 +71,9 @@ const handleCategoryExport = async () => {
}
const [cStart, cEnd] = dateRange.value;
await exportByPost(
'/ec/category-overview/export',
'/ec/store-overview/export/by-category',
params,
`品类概览_${cStart.format('YYYYMMDD')}-${cEnd.format('YYYYMMDD')}.xlsx`,
`全店概览_按品类汇总_${cStart.format('YYYYMMDD')}-${cEnd.format('YYYYMMDD')}.xlsx`,
);
};
@@ -366,7 +366,7 @@ onActivated(async () => {
await refreshOverviewByCurrentParams(true);
});
// 导出公司概览
// 全店概览-按店铺汇总导出
const handleExportCompanyOverview = async () => {
try {
exportLoading.value = true;
@@ -391,9 +391,9 @@ 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',
'/ec/store-overview/export/by-shop',
{
dateRange: [
startDate.format('YYYY-MM-DD'),
@@ -427,14 +427,14 @@ const togglePlatformExportMode = (enabled: boolean) => {
}
};
// 导出平台维度汇总
// 全店概览-按平台汇总导出
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',
'/ec/store-overview/export/by-platform',
{
dateRange: [
startDate.format('YYYY-MM-DD'),
@@ -218,9 +218,10 @@ 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 safeName = String(shopName).replace(/[/\\:*?"<>|]/g, '_');
const filename = `${safeName}_按商品汇总统计_${startDate.format('YYYYMMDD')}-${endDate.format('YYYYMMDD')}.xlsx`;
await exportByPost(
'/ec/shop/export-overview',
'/ec/shop/export/summary-by-product',
{
shopId: shopId.value,
dateRange: [
@@ -249,18 +250,22 @@ const handleCategoryExport = async () => {
categoryIds?: number[];
dateRange: string[];
taxRate: number;
shopId: number;
} = {
dateRange: dateRange.value.map((d) => d.format('YYYY-MM-DD')),
taxRate: taxRate.value,
shopId: shopId.value,
};
if (selectedExportCategoryIds.value.length > 0) {
params.categoryIds = selectedExportCategoryIds.value;
}
const [catStart, catEnd] = dateRange.value;
const catShopName = overviewData.value?.shopName || `店铺${shopId.value}`;
const catSafeName = String(catShopName).replace(/[/\\:*?"<>|]/g, '_');
await exportByPost(
'/ec/shop/export-category',
'/ec/shop/export/summary-by-category',
params,
`门店品类汇总_${catStart.format('YYYYMMDD')}-${catEnd.format('YYYYMMDD')}.xlsx`,
`${catSafeName}_按品类汇总统计_${catStart.format('YYYYMMDD')}-${catEnd.format('YYYYMMDD')}.xlsx`,
);
} finally {
categoryExportLoading.value = false;