Parcourir la source

fix: vxeGrid init without search form (#5342)

* 修复vxeGrid在未使用表单的情况下,自动加载数据失效的问题。

* 暂时将vxeGrid版本锁定在4.10.0,新版本尺寸计算尚有问题
Netfan il y a 4 mois
Parent
commit
7606b86854

+ 1 - 1
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) {

+ 4 - 1
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 ?? {});
   }
 

+ 7 - 16
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)):
-    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)):
+  vxe-table@4.10.0(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
 

+ 1 - 1
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