@@ -9,7 +9,7 @@ import { TableColumn } from '@/types/table'
99import { DescriptionsSchema } from '@/types/descriptions'
1010import { ComponentOptions , ComponentProps } from '@/types/components'
1111import { DictTag } from '@/components/DictTag'
12- import { cloneDeep } from 'lodash-es'
12+ import { cloneDeep , merge } from 'lodash-es'
1313
1414export type CrudSchema = Omit < TableColumn , 'children' > & {
1515 isSearch ?: boolean // 是否在查询显示
@@ -117,14 +117,18 @@ const filterSearchSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): F
117117 }
118118 if ( ! schemaItem . search ?. component ) component = 'Select'
119119 }
120- const searchSchemaItem = {
121- // 默认为 input
122- component : component ,
123- componentProps : comonentProps ,
124- ...schemaItem . search ,
125- field : schemaItem . field ,
126- label : schemaItem . search ?. label || schemaItem . label
127- }
120+
121+ // updated by AKing: 解决了当使用默认的dict选项时,form中事件不能触发的问题
122+ const searchSchemaItem = merge (
123+ {
124+ // 默认为 input
125+ component,
126+ ...schemaItem . search ,
127+ field : schemaItem . field ,
128+ label : schemaItem . search ?. label || schemaItem . label
129+ } ,
130+ { componentProps : comonentProps }
131+ )
128132 if ( searchSchemaItem . api ) {
129133 searchRequestTask . push ( async ( ) => {
130134 const res = await ( searchSchemaItem . api as ( ) => AxiosPromise ) ( )
@@ -224,15 +228,19 @@ const filterFormSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): For
224228 }
225229 if ( ! ( schemaItem . form && schemaItem . form . component ) ) component = 'Select'
226230 }
227- const formSchemaItem = {
228- // 默认为 input
229- component : component ,
230- componentProps : comonentProps ,
231- value : defaultValue ,
232- ...schemaItem . form ,
233- field : schemaItem . field ,
234- label : schemaItem . form ?. label || schemaItem . label
235- }
231+
232+ // updated by AKing: 解决了当使用默认的dict选项时,form中事件不能触发的问题
233+ const formSchemaItem = merge (
234+ {
235+ // 默认为 input
236+ component,
237+ value : defaultValue ,
238+ ...schemaItem . form ,
239+ field : schemaItem . field ,
240+ label : schemaItem . form ?. label || schemaItem . label
241+ } ,
242+ { componentProps : comonentProps }
243+ )
236244
237245 if ( formSchemaItem . api ) {
238246 formRequestTask . push ( async ( ) => {
0 commit comments