File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { FormSchema } from '@/types/form'
8
8
import { TableColumn } from '@/types/table'
9
9
import { DescriptionsSchema } from '@/types/descriptions'
10
10
import { ComponentOptions , ComponentProps } from '@/types/components'
11
+ import { DictTag } from '@/components/DictTag'
11
12
12
13
export type CrudSchema = Omit < TableColumn , 'children' > & {
13
14
isSearch ?: boolean // 是否在查询显示
@@ -151,6 +152,15 @@ const filterTableSchema = (crudSchema: CrudSchema[]): TableColumn[] => {
151
152
const tableColumns = treeMap < CrudSchema > ( crudSchema , {
152
153
conversion : ( schema : CrudSchema ) => {
153
154
if ( schema ?. isTable !== false && schema ?. table ?. show !== false ) {
155
+ // add by 芋艿:增加对 dict 字典数据的支持
156
+ if ( ! schema . formatter && schema . dictType ) {
157
+ schema . formatter = ( _ : Recordable , __ : TableColumn , cellValue : any ) => {
158
+ return h ( DictTag , {
159
+ type : schema . dictType ! , // ! 表示一定不为空
160
+ value : cellValue
161
+ } )
162
+ }
163
+ }
154
164
return {
155
165
...schema . table ,
156
166
...schema
You can’t perform that action at this time.
0 commit comments