@@ -9,7 +9,7 @@ import { TableColumn } from '@/types/table'
9
9
import { DescriptionsSchema } from '@/types/descriptions'
10
10
import { ComponentOptions , ComponentProps } from '@/types/components'
11
11
import { DictTag } from '@/components/DictTag'
12
- import { cloneDeep } from 'lodash-es'
12
+ import { cloneDeep , merge } from 'lodash-es'
13
13
14
14
export type CrudSchema = Omit < TableColumn , 'children' > & {
15
15
isSearch ?: boolean // 是否在查询显示
@@ -117,14 +117,18 @@ const filterSearchSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): F
117
117
}
118
118
if ( ! schemaItem . search ?. component ) component = 'Select'
119
119
}
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
+ )
128
132
if ( searchSchemaItem . api ) {
129
133
searchRequestTask . push ( async ( ) => {
130
134
const res = await ( searchSchemaItem . api as ( ) => AxiosPromise ) ( )
@@ -224,15 +228,19 @@ const filterFormSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): For
224
228
}
225
229
if ( ! ( schemaItem . form && schemaItem . form . component ) ) component = 'Select'
226
230
}
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
+ )
236
244
237
245
if ( formSchemaItem . api ) {
238
246
formRequestTask . push ( async ( ) => {
0 commit comments