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
@@ -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;