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
Unverified
Commit
067f89f1
authored
Sep 03, 2023
by
芋道源码
Committed by
Gitee
Sep 03, 2023
Browse files
Options
Browse Files
Download
Plain Diff
!226 update src/hooks/web/useCrudSchemas.ts.
Merge pull request !226 from AKING/N/A
parents
5c7b2c8c
3e67f3bc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
18 deletions
+26
-18
src/hooks/web/useCrudSchemas.ts
+26
-18
No files found.
src/hooks/web/useCrudSchemas.ts
View file @
067f89f1
...
...
@@ -9,7 +9,7 @@ import { TableColumn } from '@/types/table'
import
{
DescriptionsSchema
}
from
'@/types/descriptions'
import
{
ComponentOptions
,
ComponentProps
}
from
'@/types/components'
import
{
DictTag
}
from
'@/components/DictTag'
import
{
cloneDeep
}
from
'lodash-es'
import
{
cloneDeep
,
merge
}
from
'lodash-es'
export
type
CrudSchema
=
Omit
<
TableColumn
,
'children'
>
&
{
isSearch
?:
boolean
// 是否在查询显示
...
...
@@ -117,14 +117,18 @@ const filterSearchSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): F
}
if
(
!
schemaItem
.
search
?.
component
)
component
=
'Select'
}
const
searchSchemaItem
=
{
// 默认为 input
component
:
component
,
componentProps
:
comonentProps
,
...
schemaItem
.
search
,
field
:
schemaItem
.
field
,
label
:
schemaItem
.
search
?.
label
||
schemaItem
.
label
}
// updated by AKing: 解决了当使用默认的dict选项时,form中事件不能触发的问题
const
searchSchemaItem
=
merge
(
{
// 默认为 input
component
,
...
schemaItem
.
search
,
field
:
schemaItem
.
field
,
label
:
schemaItem
.
search
?.
label
||
schemaItem
.
label
},
{
componentProps
:
comonentProps
}
)
if
(
searchSchemaItem
.
api
)
{
searchRequestTask
.
push
(
async
()
=>
{
const
res
=
await
(
searchSchemaItem
.
api
as
()
=>
AxiosPromise
)()
...
...
@@ -224,15 +228,19 @@ const filterFormSchema = (crudSchema: CrudSchema[], allSchemas: AllSchemas): For
}
if
(
!
(
schemaItem
.
form
&&
schemaItem
.
form
.
component
))
component
=
'Select'
}
const
formSchemaItem
=
{
// 默认为 input
component
:
component
,
componentProps
:
comonentProps
,
value
:
defaultValue
,
...
schemaItem
.
form
,
field
:
schemaItem
.
field
,
label
:
schemaItem
.
form
?.
label
||
schemaItem
.
label
}
// updated by AKing: 解决了当使用默认的dict选项时,form中事件不能触发的问题
const
formSchemaItem
=
merge
(
{
// 默认为 input
component
,
value
:
defaultValue
,
...
schemaItem
.
form
,
field
:
schemaItem
.
field
,
label
:
schemaItem
.
form
?.
label
||
schemaItem
.
label
},
{
componentProps
:
comonentProps
}
)
if
(
formSchemaItem
.
api
)
{
formRequestTask
.
push
(
async
()
=>
{
...
...
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