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
586834b8
authored
Nov 03, 2025
by
lijinqi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口上架,不受是否绑定app约束
parent
251609ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
22 deletions
+23
-22
src/views/apihub/apiendpoint/ApiEndpointForm.vue
+23
-22
No files found.
src/views/apihub/apiendpoint/ApiEndpointForm.vue
View file @
586834b8
...
@@ -160,29 +160,30 @@ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成
...
@@ -160,29 +160,30 @@ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成
const
submitForm
=
async
()
=>
{
const
submitForm
=
async
()
=>
{
// 校验表单
// 校验表单
await
formRef
.
value
.
validate
()
await
formRef
.
value
.
validate
()
//
// // 如果处于上架状态,检查是否被API关联(适用于创建和修改)
// if (formData.value.isShelf) {
// // 对于修改操作,需要检查是否有API关联
// if (formData.value.id) {
// try {
// const relatedApis = await ApiEndpointRelApi.getApisByEndpointId(formData.value.id)
// if (!relatedApis || relatedApis.length === 0) {
// // 若不满足条件,给出错误提示并终止提交
// message.error('上架状态下,接口必须被至少一个API关联')
// return
// }
// } catch (e) {
// console.error('检查API关联失败', e)
// message.error('检查API关联失败,请稍后再试')
// return
// }
// } else {
// // 对于新建操作,不允许直接上架,因为新建的接口还没有被API关联
// message.error('新建接口不能直接上架,请先创建接口并关联到API后再上架')
// return
// }
// }
// 如果处于上架状态,检查是否被API关联(适用于创建和修改)
if
(
formData
.
value
.
isShelf
)
{
// 对于修改操作,需要检查是否有API关联
if
(
formData
.
value
.
id
)
{
try
{
const
relatedApis
=
await
ApiEndpointRelApi
.
getApisByEndpointId
(
formData
.
value
.
id
)
if
(
!
relatedApis
||
relatedApis
.
length
===
0
)
{
// 若不满足条件,给出错误提示并终止提交
message
.
error
(
'上架状态下,接口必须被至少一个API关联'
)
return
}
}
catch
(
e
)
{
console
.
error
(
'检查API关联失败'
,
e
)
message
.
error
(
'检查API关联失败,请稍后再试'
)
return
}
}
else
{
// 对于新建操作,不允许直接上架,因为新建的接口还没有被API关联
message
.
error
(
'新建接口不能直接上架,请先创建接口并关联到API后再上架'
)
return
}
}
// 提交请求
// 提交请求
formLoading
.
value
=
true
formLoading
.
value
=
true
...
...
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