Skip to content

Commit

Permalink
fix: resolve issue with grid reload parameter not working (#4888)
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Nov 13, 2024
1 parent 8cc73cf commit 5b07947
Show file tree
Hide file tree
Showing 4 changed files with 361 additions and 120 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"node": ">=20.10.0",
"pnpm": ">=9.12.0"
},
"packageManager": "pnpm@9.12.3",
"packageManager": "pnpm@9.13.0",
"pnpm": {
"peerDependencyRules": {
"allowedVersions": {
Expand Down
22 changes: 17 additions & 5 deletions packages/effects/plugins/src/vxe-table/extends.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Recordable } from '@vben/types';
import type { VxeGridProps, VxeUIExport } from 'vxe-table';

import type { VxeGridApi } from './api';
Expand All @@ -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',
Expand All @@ -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({
Expand Down
Loading

0 comments on commit 5b07947

Please sign in to comment.