This commit is contained in:
dap
2024-11-14 07:58:37 +08:00
16 changed files with 1232 additions and 28 deletions

View File

@@ -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({

View File

@@ -81,7 +81,8 @@
}
.vxe-tools--operate {
@apply ml-3;
margin-right: 0.25rem;
margin-left: 0.75rem;
}
.vxe-table-custom--checkbox-option:hover {

View File

@@ -32,7 +32,7 @@ import { useTableForm } from './init';
import 'vxe-table/styles/cssvar.scss';
import 'vxe-pc-ui/styles/cssvar.scss';
import './theme.css';
import './style.css';
interface Props extends VxeGridProps {
api: ExtendedVxeGridApi;
@@ -278,7 +278,7 @@ onUnmounted(() => {
ref="gridRef"
:class="
cn(
'p-2',
'p-2 pt-0',
{
'pt-0': showToolbar && !formOptions,
},