fix: 查询条件清空时,依旧会传递空值的请求参数

This commit is contained in:
louis 2024-02-28 15:04:31 +08:00
parent 424bde5b16
commit 8770ef36a7
4 changed files with 21 additions and 8 deletions

View File

@ -99,9 +99,15 @@ export const useTableMethods = ({ state, props, emit }: UseTableMethodsContext)
...queryFormRef.value.handleFormValues(values), ...queryFormRef.value.handleFormValues(values),
...queryParams, ...queryParams,
}; };
for (const key in queryParams) {
if (queryParams[key] !== 0 && !queryParams[key]) {
delete queryParams[key];
}
}
} }
loadingRef.value = true; loadingRef.value = true;
const res = await dataRequest(queryParams); const res = await dataRequest(queryParams);
const isArrayResult = Array.isArray(res); const isArrayResult = Array.isArray(res);

View File

@ -2,14 +2,14 @@
<div> <div>
<router-view v-slot="{ Component }"> <router-view v-slot="{ Component }">
<template v-if="Component"> <template v-if="Component">
<!-- <transition mode="out-in" :duration="100"> --> <transition mode="out-in" :duration="100">
<Suspense> <Suspense>
<component :is="Component" /> <component :is="Component" />
<template #fallback> <template #fallback>
<a-skeleton /> <a-skeleton />
</template> </template>
</Suspense> </Suspense>
<!-- </transition> --> </transition>
</template> </template>
</router-view> </router-view>
</div> </div>

View File

@ -91,6 +91,7 @@
:name="Object.is(route.meta?.transitionName, false) ? '' : 'fade-transform'" :name="Object.is(route.meta?.transitionName, false) ? '' : 'fade-transform'"
mode="out-in" mode="out-in"
appear appear
:duration="300"
> >
<keep-alive :include="keepAliveComponents"> <keep-alive :include="keepAliveComponents">
<component :is="Component" :key="route.fullPath" /> <component :is="Component" :key="route.fullPath" />

View File

@ -58,6 +58,12 @@ export const baseColumns: TableColumnItem[] = [
width: 120, width: 120,
dataIndex: 'email', dataIndex: 'email',
}, },
{
title: 'QQ',
width: 120,
hideInSearch: true,
dataIndex: 'qq',
},
{ {
title: '手机', title: '手机',
width: 120, width: 120,