mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 00:29:19 +08:00
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:
@@ -75,27 +75,27 @@ export async function getShopOverviewStatisticsApi(
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出店铺概览Excel
|
||||
* 店铺数据统计-按商品汇总(Excel)
|
||||
*/
|
||||
export async function exportShopOverviewApi(params: {
|
||||
export async function exportShopSummaryByProductApi(params: {
|
||||
shopId: number;
|
||||
dateRange: string[];
|
||||
exportType?: string;
|
||||
}) {
|
||||
return requestClient.post('/ec/shop/export-overview', params, {
|
||||
return requestClient.post('/ec/shop/export/summary-by-product', params, {
|
||||
responseType: 'blob',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出公司概览Excel
|
||||
* 全店概览-按店铺汇总(Excel)
|
||||
*/
|
||||
export async function exportCompanyOverviewApi(params: {
|
||||
dateRange: string[];
|
||||
shopIds?: number[];
|
||||
exportType?: string;
|
||||
}) {
|
||||
return requestClient.post('/ec/store-overview/export', params, {
|
||||
return requestClient.post('/ec/store-overview/export/by-shop', params, {
|
||||
responseType: 'blob',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@ import type { CompanyOverviewDTO, CompanyOverviewVO } from './types';
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 全店铺概览管理API
|
||||
* 全店概览 API(统计与导出)
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取全店铺概览统计数据
|
||||
* 获取全店概览统计数据
|
||||
*/
|
||||
export async function getCompanyOverviewApi(data: CompanyOverviewDTO.Query) {
|
||||
return requestClient.post<CompanyOverviewVO.Info>(
|
||||
@@ -17,27 +17,27 @@ export async function getCompanyOverviewApi(data: CompanyOverviewDTO.Query) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出品类概览Excel
|
||||
* 全店概览-按品类汇总(Excel)
|
||||
*/
|
||||
export async function exportCategoryOverviewApi(params: {
|
||||
dateRange: string[];
|
||||
categoryIds?: number[];
|
||||
taxRate: number;
|
||||
}) {
|
||||
return requestClient.post('/ec/category-overview/export', params, {
|
||||
return requestClient.post('/ec/store-overview/export/by-category', params, {
|
||||
responseType: 'blob',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出公司概览Excel
|
||||
* 全店概览-按店铺汇总(Excel)
|
||||
*/
|
||||
export async function exportCompanyOverviewApi(params: {
|
||||
dateRange: string[];
|
||||
shopIds?: number[];
|
||||
exportType?: string;
|
||||
}) {
|
||||
return requestClient.post('/ec/store-overview/export', params, {
|
||||
return requestClient.post('/ec/store-overview/export/by-shop', params, {
|
||||
responseType: 'blob',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user