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