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
aa197a6f
authored
Apr 09, 2025
by
宿命的风
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口选择器新增事件配置功能
parent
5fe16b42
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
3 deletions
+24
-3
src/components/FormCreate/src/components/useApiSelect.tsx
+19
-1
src/components/FormCreate/src/config/useSelectRule.ts
+1
-0
src/components/FormCreate/src/type/index.ts
+2
-1
src/components/FormCreate/src/useFormCreateDesigner.ts
+2
-1
No files found.
src/components/FormCreate/src/components/useApiSelect.tsx
View file @
aa197a6f
...
@@ -69,11 +69,24 @@ export const useApiSelect = (option: ApiSelectProps) => {
...
@@ -69,11 +69,24 @@ export const useApiSelect = (option: ApiSelectProps) => {
if
(
isEmpty
(
props
.
url
))
{
if
(
isEmpty
(
props
.
url
))
{
return
return
}
}
switch
(
props
.
method
)
{
switch
(
props
.
method
)
{
case
'GET'
:
case
'GET'
:
let
url
:
string
=
props
.
url
let
url
:
string
=
props
.
url
if
(
props
.
remote
)
{
if
(
props
.
remote
)
{
url
=
`
${
url
}
?
${
props
.
remoteField
}
=
${
queryParam
.
value
}
`
if
(
queryParam
.
value
!=
undefined
)
{
if
(
checkUrl
(
url
))
{
url
=
`
${
url
}
&
${
props
.
remoteField
}
=
${
queryParam
.
value
}
`
}
else
{
url
=
`
${
url
}
?
${
props
.
remoteField
}
=
${
queryParam
.
value
}
`
}
}
else
{
url
=
`
${
url
}
`
}
}
}
parseOptions
(
await
request
.
get
({
url
:
url
}))
parseOptions
(
await
request
.
get
({
url
:
url
}))
break
break
...
@@ -87,6 +100,11 @@ export const useApiSelect = (option: ApiSelectProps) => {
...
@@ -87,6 +100,11 @@ export const useApiSelect = (option: ApiSelectProps) => {
}
}
}
}
function
checkUrl
(
url
)
{
return
url
.
includes
(
'?'
)
}
function
parseOptions
(
data
:
any
)
{
function
parseOptions
(
data
:
any
)
{
// 情况一:如果有自定义解析函数优先使用自定义解析
// 情况一:如果有自定义解析函数优先使用自定义解析
if
(
!
isEmpty
(
props
.
parseFunc
))
{
if
(
!
isEmpty
(
props
.
parseFunc
))
{
...
...
src/components/FormCreate/src/config/useSelectRule.ts
View file @
aa197a6f
...
@@ -17,6 +17,7 @@ export const useSelectRule = (option: SelectRuleOption) => {
...
@@ -17,6 +17,7 @@ export const useSelectRule = (option: SelectRuleOption) => {
icon
:
option
.
icon
,
icon
:
option
.
icon
,
label
,
label
,
name
,
name
,
event
:
option
.
event
,
rule
()
{
rule
()
{
return
{
return
{
type
:
name
,
type
:
name
,
...
...
src/components/FormCreate/src/type/index.ts
View file @
aa197a6f
...
@@ -46,5 +46,6 @@ export interface SelectRuleOption {
...
@@ -46,5 +46,6 @@ export interface SelectRuleOption {
label
:
string
// label 名称
label
:
string
// label 名称
name
:
string
// 组件名称
name
:
string
// 组件名称
icon
:
string
// 组件图标
icon
:
string
// 组件图标
props
?:
any
[]
// 组件规则
props
?:
any
[],
// 组件规则
event
?:
any
[]
// 事件
}
}
src/components/FormCreate/src/useFormCreateDesigner.ts
View file @
aa197a6f
...
@@ -63,7 +63,8 @@ export const useFormCreateDesigner = async (designer: Ref) => {
...
@@ -63,7 +63,8 @@ export const useFormCreateDesigner = async (designer: Ref) => {
name
:
'ApiSelect'
,
name
:
'ApiSelect'
,
label
:
'接口选择器'
,
label
:
'接口选择器'
,
icon
:
'icon-server'
,
icon
:
'icon-server'
,
props
:
[...
apiSelectRule
]
props
:
[...
apiSelectRule
],
event
:[
'click'
,
'change'
,
'visibleChange'
,
'clear'
,
'blur'
,
'focus'
]
})
})
/**
/**
...
...
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