Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7d22328d
authored
Mar 18, 2023
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Table 组件:增加对字典数据的支持
parent
ba327cd8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
src/hooks/web/useCrudSchemas.ts
+10
-0
No files found.
src/hooks/web/useCrudSchemas.ts
View file @
7d22328d
...
@@ -8,6 +8,7 @@ import { FormSchema } from '@/types/form'
...
@@ -8,6 +8,7 @@ import { FormSchema } from '@/types/form'
import
{
TableColumn
}
from
'@/types/table'
import
{
TableColumn
}
from
'@/types/table'
import
{
DescriptionsSchema
}
from
'@/types/descriptions'
import
{
DescriptionsSchema
}
from
'@/types/descriptions'
import
{
ComponentOptions
,
ComponentProps
}
from
'@/types/components'
import
{
ComponentOptions
,
ComponentProps
}
from
'@/types/components'
import
{
DictTag
}
from
'@/components/DictTag'
export
type
CrudSchema
=
Omit
<
TableColumn
,
'children'
>
&
{
export
type
CrudSchema
=
Omit
<
TableColumn
,
'children'
>
&
{
isSearch
?:
boolean
// 是否在查询显示
isSearch
?:
boolean
// 是否在查询显示
...
@@ -151,6 +152,15 @@ const filterTableSchema = (crudSchema: CrudSchema[]): TableColumn[] => {
...
@@ -151,6 +152,15 @@ const filterTableSchema = (crudSchema: CrudSchema[]): TableColumn[] => {
const
tableColumns
=
treeMap
<
CrudSchema
>
(
crudSchema
,
{
const
tableColumns
=
treeMap
<
CrudSchema
>
(
crudSchema
,
{
conversion
:
(
schema
:
CrudSchema
)
=>
{
conversion
:
(
schema
:
CrudSchema
)
=>
{
if
(
schema
?.
isTable
!==
false
&&
schema
?.
table
?.
show
!==
false
)
{
if
(
schema
?.
isTable
!==
false
&&
schema
?.
table
?.
show
!==
false
)
{
// add by 芋艿:增加对 dict 字典数据的支持
if
(
!
schema
.
formatter
&&
schema
.
dictType
)
{
schema
.
formatter
=
(
_
:
Recordable
,
__
:
TableColumn
,
cellValue
:
any
)
=>
{
return
h
(
DictTag
,
{
type
:
schema
.
dictType
!
,
// ! 表示一定不为空
value
:
cellValue
})
}
}
return
{
return
{
...
schema
.
table
,
...
schema
.
table
,
...
schema
...
schema
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment