vue-vben-admin icon indicating copy to clipboard operation
vue-vben-admin copied to clipboard

Bug: 重置表单没有重置对应的字段

Open wild2life opened this issue 6 months ago • 3 comments

Version

Vben Admin V5

Describe the bug?

重置表单,并没有重置映射的字段。

  1. 选择筛选字段 build_platform,点击搜索按钮。
  2. 点击重置按钮,表单清空,但是formValues里面build_platform还是有值的

Reproduction

const gridOptions: VxeGridProps<TaskApi.TaskTable> = {
  ...gridSchemas,
  proxyConfig: {
    ajax: {
      query: async ({ page }, formValues) => {
        return await getTaskTable({
         ...formValues
          page: page.currentPage,
          limit: page.pageSize,
        });
      },
    },
  },
};

const [Grid, gridApi] = useVbenVxeGrid({
  formOptions: {
    ...searchFormSchemas,
    schema: [
       {
        fieldName: 'build_platform',
        label: $t('task.list.buildPlatform'),
        component: 'Select',
        componentProps: {
          allowClear: true,
          options: buildPlatformOpts,
          onChange: (value: string) => {
            filters.build_platform = value;
          },
        },
      },
    ],
    handleReset: async () => {
      gridApi.formApi.resetForm();
      gridApi.reload();
    },
  },
  gridOptions,
});

System Info

System:
    OS: Linux 6.8 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
    CPU: (16) x64 13th Gen Intel(R) Core(TM) i7-13620H
    Memory: 25.89 GB / 38.87 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.18.1 - ~/.nvm/versions/node/v20.18.1/bin/node
    npm: 10.8.2 - ~/.nvm/versions/node/v20.18.1/bin/npm
    pnpm: 9.15.9 - ~/.nvm/versions/node/v20.18.1/bin/pnpm
  Browsers:
    Chrome: 133.0.6943.141
    Chromium: 135.0.7049.84

Relevant log output


Validations

wild2life avatar Apr 16 '25 09:04 wild2life