From 7606b86854bf9a467ef1c2e82cdfb84f60f1da61 Mon Sep 17 00:00:00 2001 From: Netfan Date: Fri, 10 Jan 2025 11:53:06 +0800 Subject: [PATCH] fix: vxeGrid init without search form (#5342) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修复vxeGrid在未使用表单的情况下,自动加载数据失效的问题。 * 暂时将vxeGrid版本锁定在4.10.0,新版本尺寸计算尚有问题 --- packages/@core/ui-kit/form-ui/src/form-api.ts | 2 +- .../plugins/src/vxe-table/use-vxe-grid.vue | 5 +++- pnpm-lock.yaml | 23 ++++++------------- pnpm-workspace.yaml | 2 +- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/packages/@core/ui-kit/form-ui/src/form-api.ts b/packages/@core/ui-kit/form-ui/src/form-api.ts index a3c320bd0..a2877cbff 100644 --- a/packages/@core/ui-kit/form-ui/src/form-api.ts +++ b/packages/@core/ui-kit/form-ui/src/form-api.ts @@ -95,7 +95,7 @@ export class FormApi { async getValues() { const form = await this.getForm(); - return this.handleRangeTimeValue(form.values); + return form.values ? this.handleRangeTimeValue(form.values) : {}; } async isFieldValid(fieldName: string) { diff --git a/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue b/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue index cbae6f298..e50814217 100644 --- a/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue +++ b/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue @@ -248,7 +248,10 @@ async function init() { const autoLoad = defaultGridOptions.proxyConfig?.autoLoad; const enableProxyConfig = options.value.proxyConfig?.enabled; if (enableProxyConfig && autoLoad) { - props.api.grid.commitProxy?.('_init', (await formApi.getValues()) ?? {}); + props.api.grid.commitProxy?.( + '_init', + formOptions.value ? ((await formApi.getValues()) ?? {}) : {}, + ); // props.api.reload(formApi.form?.values ?? {}); } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8dbf2f0bb..d33595845 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -481,8 +481,8 @@ catalogs: specifier: ^4.3.67 version: 4.3.67 vxe-table: - specifier: ^4.10.5 - version: 4.10.5 + specifier: 4.10.0 + version: 4.10.0 watermark-js-plus: specifier: ^1.5.7 version: 1.5.7 @@ -1662,7 +1662,7 @@ importers: version: 4.3.67(vue@3.5.13(typescript@5.7.3)) vxe-table: specifier: 'catalog:' - version: 4.10.5(vue@3.5.13(typescript@5.7.3)) + version: 4.10.0(vue@3.5.13(typescript@5.7.3)) packages/effects/request: dependencies: @@ -10125,11 +10125,8 @@ packages: vxe-pc-ui@4.3.67: resolution: {integrity: sha512-RyRyxd7MUdlac5tOnWVb7V9alW+tFHTUOyXa9aIGyyMm5Nwrzdf/q4Un5KIlGaddFifgBAw82SGPfK+hQhaQDQ==} - vxe-pc-ui@4.3.68: - resolution: {integrity: sha512-uQxvZICO2XLu2FywpxQJkkCIYOhv/QqsoIJnOhyh2fBTAQjCT3zqPh/AIrB1v6r+FaFipjwyO+/4ZsNMMKbFeA==} - - vxe-table@4.10.5: - resolution: {integrity: sha512-X04AwhfZLaBy1gSiCsVd0EPurIaFwOOna9XzojF0eUr2c6rYF8u9IrhP+vSBmOj+yDiAENf8QjXFyLgNU3NTTg==} + vxe-table@4.10.0: + resolution: {integrity: sha512-HysVARZXZGgXd5tR9vpahZcLB4RuB90ZoZNFKmKc670bGD3bWFFBdBpeQshXziVSkuPi65MqfE7Wq0b2enRcYg==} warning@4.0.3: resolution: {integrity: sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==} @@ -19770,15 +19767,9 @@ snapshots: transitivePeerDependencies: - vue - vxe-pc-ui@4.3.68(vue@3.5.13(typescript@5.7.3)): + vxe-table@4.10.0(vue@3.5.13(typescript@5.7.3)): dependencies: - '@vxe-ui/core': 4.0.29(vue@3.5.13(typescript@5.7.3)) - transitivePeerDependencies: - - vue - - vxe-table@4.10.5(vue@3.5.13(typescript@5.7.3)): - dependencies: - vxe-pc-ui: 4.3.68(vue@3.5.13(typescript@5.7.3)) + vxe-pc-ui: 4.3.67(vue@3.5.13(typescript@5.7.3)) transitivePeerDependencies: - vue diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index b92cf3bed..3a054ec64 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -177,7 +177,7 @@ catalog: vue-router: ^4.5.0 vue-tsc: 2.1.10 vxe-pc-ui: ^4.3.67 - vxe-table: ^4.10.5 + vxe-table: 4.10.0 watermark-js-plus: ^1.5.7 zod: ^3.24.1 zod-defaults: ^0.1.3