fix: resolve issue with grid reload parameter not working (#4888)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import type { Recordable } from '@vben/types';
|
||||
import type { VxeGridProps, VxeUIExport } from 'vxe-table';
|
||||
|
||||
import type { VxeGridApi } from './api';
|
||||
@@ -7,7 +8,7 @@ import { formatDate, formatDateTime, isFunction } from '@vben/utils';
|
||||
export function extendProxyOptions(
|
||||
api: VxeGridApi,
|
||||
options: VxeGridProps,
|
||||
getFormValues: () => Record<string, any>,
|
||||
getFormValues: () => Recordable<any>,
|
||||
) {
|
||||
[
|
||||
'query',
|
||||
@@ -25,17 +26,28 @@ function extendProxyOption(
|
||||
key: string,
|
||||
api: VxeGridApi,
|
||||
options: VxeGridProps,
|
||||
getFormValues: () => Record<string, any>,
|
||||
getFormValues: () => Recordable<any>,
|
||||
) {
|
||||
const { proxyConfig } = options;
|
||||
const configFn = (proxyConfig?.ajax as any)?.[key];
|
||||
const configFn = (proxyConfig?.ajax as Recordable<any>)?.[key];
|
||||
if (!isFunction(configFn)) {
|
||||
return options;
|
||||
}
|
||||
|
||||
const wrapperFn = async (params: any, _formValues: any, ...args: any[]) => {
|
||||
const wrapperFn = async (
|
||||
params: Recordable<any>,
|
||||
customValues: Recordable<any>,
|
||||
...args: Recordable<any>[]
|
||||
) => {
|
||||
const formValues = getFormValues();
|
||||
const data = await configFn(params, formValues, ...args);
|
||||
const data = await configFn(
|
||||
params,
|
||||
{
|
||||
...customValues,
|
||||
...formValues,
|
||||
},
|
||||
...args,
|
||||
);
|
||||
return data;
|
||||
};
|
||||
api.setState({
|
||||
|
Reference in New Issue
Block a user