mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 02:29:19 +08:00
feat: 公司概览导出改为横向透视格式,支持按店铺筛选
Backend: - 店铺明细 Sheet 改为横向对比格式:指标为行,店铺为列 - 支持按 shopIds 筛选,不选则导出全部店铺 - 添加 MetricDef 内部类简化字段定义 Frontend: - Dashboard 导出按钮前加店铺多选 Select - 不选则默认导出全部店铺
This commit is contained in:
@@ -12,7 +12,7 @@ import { useRoute, useRouter } from 'vue-router';
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
|
||||
|
||||
import { Button, DatePicker, message, Spin } from 'ant-design-vue';
|
||||
import { Button, DatePicker, message, Select, Spin } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { getCompanyOverviewApi } from '#/api/ecommerce/company-overview';
|
||||
@@ -31,6 +31,11 @@ const exportLoading = ref(false);
|
||||
const overviewData = ref<CompanyOverviewVO.Info | null>(null);
|
||||
const shopCount = ref(0);
|
||||
|
||||
// 店铺多选
|
||||
interface ShopOption { label: string; value: number; }
|
||||
const shopList = ref<ShopOption[]>([]);
|
||||
const selectedShopIds = ref<number[]>([]);
|
||||
|
||||
// 日期范围
|
||||
const dateRange = ref<[dayjs.Dayjs, dayjs.Dayjs]>([
|
||||
dayjs().subtract(30, 'day'),
|
||||
@@ -231,6 +236,19 @@ const loadShopCount = async () => {
|
||||
filters: {},
|
||||
});
|
||||
shopCount.value = response.total || 0;
|
||||
|
||||
// 加载店铺列表供导出选择
|
||||
if (response.total > 0) {
|
||||
const shopRes = await getShopPageApi({
|
||||
page: 1,
|
||||
pageSize: response.total,
|
||||
filters: {},
|
||||
});
|
||||
shopList.value = (shopRes.records || []).map((s: { id: number; name: string }) => ({
|
||||
label: s.name,
|
||||
value: s.id,
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取店铺数量失败:', error);
|
||||
}
|
||||
@@ -462,6 +480,7 @@ const handleExportCompanyOverview = async () => {
|
||||
startDate.format('YYYY-MM-DD'),
|
||||
endDate.format('YYYY-MM-DD'),
|
||||
],
|
||||
shopIds: selectedShopIds.value.length > 0 ? selectedShopIds.value : undefined,
|
||||
},
|
||||
filename,
|
||||
);
|
||||
@@ -733,14 +752,25 @@ const handleExportCompanyOverview = async () => {
|
||||
包含:目标达成、规模、成本及最终损益所有维度
|
||||
</p>
|
||||
</div>
|
||||
<Button
|
||||
type="primary"
|
||||
class="!h-auto !rounded-2xl !border-none !bg-slate-900 !px-8 !py-3 !text-sm !font-bold !shadow-xl !shadow-slate-200 !transition-all hover:!scale-105 active:!scale-95"
|
||||
:loading="exportLoading"
|
||||
@click="handleExportCompanyOverview"
|
||||
>
|
||||
导出财务分析报表
|
||||
</Button>
|
||||
<div class="flex items-center gap-3">
|
||||
<Select
|
||||
v-model:value="selectedShopIds"
|
||||
mode="multiple"
|
||||
placeholder="选择店铺(默认全部)"
|
||||
:options="shopList"
|
||||
:max-tag-count="2"
|
||||
allow-clear
|
||||
class="!min-w-48"
|
||||
/>
|
||||
<Button
|
||||
type="primary"
|
||||
class="!h-auto !rounded-2xl !border-none !bg-slate-900 !px-8 !py-3 !text-sm !font-bold !shadow-xl !shadow-slate-200 !transition-all hover:!scale-105 active:!scale-95"
|
||||
:loading="exportLoading"
|
||||
@click="handleExportCompanyOverview"
|
||||
>
|
||||
导出财务分析报表
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-container overflow-x-auto">
|
||||
|
||||
Reference in New Issue
Block a user