Przeglądaj źródła

fix: 修复表格与搜索框字段不能不一致的问题

SOWhat 2 lat temu
rodzic
commit
5c1cd298de
1 zmienionych plików z 3 dodań i 1 usunięć
  1. 3 1
      src/hooks/web/useCrudSchemas.ts

+ 3 - 1
src/hooks/web/useCrudSchemas.ts

@@ -23,6 +23,8 @@ type CrudSearchParams = {
   dictName?: string
   // 接口
   api?: () => Promise<any>
+  // 搜索字段
+  field?: string
 } & Omit<FormSchema, 'field'>
 
 type CrudTableParams = {
@@ -101,7 +103,7 @@ const filterSearchSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): F
         component: schemaItem.search.component || 'Input',
         componentProps: {},
         ...schemaItem.search,
-        field: schemaItem.field,
+        field: schemaItem?.search?.field || schemaItem.field,
         label: schemaItem.search?.label || schemaItem.label
       }