fix: 修复前端若干类型报错

This commit is contained in:
ah--desktop
2026-03-31 23:44:37 +08:00
parent 7f5803ddda
commit 6b434fbf63
38 changed files with 383 additions and 1981 deletions
@@ -471,19 +471,21 @@ const handleExportCompanyOverview = async () => {
// 优先使用已加载的 shopComparisons 数据(保持和页面一致的列顺序)
let dataToExport: CompanyOverviewVO.ShopComparison[] = [];
if (overviewData.value?.shopComparisons) {
if (selectedExportShopIds.value.length > 0) {
dataToExport = overviewData.value.shopComparisons.filter((s) =>
selectedExportShopIds.value.includes(s.shopId),
);
} else {
dataToExport = overviewData.value.shopComparisons;
}
dataToExport =
selectedExportShopIds.value.length > 0
? overviewData.value.shopComparisons.filter((s) =>
selectedExportShopIds.value.includes(s.shopId),
)
: overviewData.value.shopComparisons;
}
// 若无缓存数据,走原有接口按 shopIds 过滤
let shopIds: number[] | undefined;
if (dataToExport.length === 0) {
shopIds = selectedExportShopIds.value.length > 0 ? selectedExportShopIds.value : undefined;
shopIds =
selectedExportShopIds.value.length > 0
? selectedExportShopIds.value
: undefined;
}
const filename = `公司概览_${startDate.format('YYYYMMDD')}_${endDate.format('YYYYMMDD')}.xlsx`;
@@ -535,10 +537,12 @@ const handleExportSelectedShops = async () => {
<template #extra>
<!-- 时间选择器 - 响应式适配 -->
<div
class="flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-2 rounded-2xl border border-slate-200 bg-slate-200/50 p-1.5"
class="flex flex-col gap-2 rounded-2xl border border-slate-200 bg-slate-200/50 p-1.5 sm:flex-row sm:items-center sm:gap-2"
>
<!-- 快速选择按钮组 -->
<div class="flex items-center gap-1 rounded-xl bg-white/30 p-1 overflow-x-auto">
<div
class="flex items-center gap-1 overflow-x-auto rounded-xl bg-white/30 p-1"
>
<Button
type="text"
size="small"
@@ -596,7 +600,9 @@ const handleExportSelectedShops = async () => {
<div class="hidden h-6 w-px bg-slate-300 sm:block"></div>
<!-- 自定义日期选择器 -->
<div class="flex items-center gap-2 rounded-xl bg-white/30 px-3 py-1.5">
<span class="hidden text-xs font-bold text-slate-400 sm:inline">自定义日期</span>
<span class="hidden text-xs font-bold text-slate-400 sm:inline">
自定义日期
</span>
<DatePicker.RangePicker
v-model:value="customDateRange"
size="small"
@@ -843,12 +849,11 @@ const handleExportSelectedShops = async () => {
:indeterminate="someShopsSelected && !allShopsSelected"
@change="
(e) => {
if (
(e.target as HTMLInputElement).checked
) {
if ((e.target as HTMLInputElement).checked) {
selectedExportShopIds =
overviewData?.shopComparisons?.map(
(s: CompanyOverviewVO.ShopComparison) => s.shopId,
(s: CompanyOverviewVO.ShopComparison) =>
s.shopId,
) || [];
} else {
selectedExportShopIds = [];