@@ -119,7 +119,7 @@ import { computed, reactive, ref, watch } from 'vue'
119119import EditAvatarDialog from ' @/views/tool/component/EditAvatarDialog.vue'
120120import type { toolData } from ' @/api/type/tool'
121121import type { FormInstance } from ' element-plus'
122- import { MsgConfirm , MsgSuccess } from ' @/utils/message'
122+ import { MsgConfirm , MsgError , MsgSuccess } from ' @/utils/message'
123123import { cloneDeep } from ' lodash'
124124import { t } from ' @/locales'
125125import { isAppIcon } from ' @/utils/common'
@@ -245,9 +245,16 @@ const submit = async (formEl: FormInstance | undefined) => {
245245 if (! formEl ) return
246246 await formEl .validate ((valid : any ) => {
247247 if (valid ) {
248+ try {
249+ JSON .parse (form .value .code as string )
250+ } catch (e ) {
251+ MsgError (t (' views.applicationWorkflow.nodes.mcpNode.mcpServerTip' ))
252+ return
253+ }
254+ loading .value = true
248255 if (isEdit .value ) {
249256 loadSharedApi ({ type: ' tool' , systemType: apiType .value })
250- .putTool (form .value ?.id as string , form .value , loading )
257+ .putTool (form .value ?.id as string , form .value )
251258 .then ((res : any ) => {
252259 MsgSuccess (t (' common.editSuccess' ))
253260 emit (' refresh' , res .data )
@@ -256,13 +263,16 @@ const submit = async (formEl: FormInstance | undefined) => {
256263 .then (() => {
257264 visible .value = false
258265 })
266+ .finally (() => {
267+ loading .value = false
268+ })
259269 } else {
260270 const obj = {
261271 folder_id: folder .currentFolder ?.id ,
262272 ... form .value ,
263273 }
264274 loadSharedApi ({ type: ' tool' , systemType: apiType .value })
265- .postTool (obj , loading )
275+ .postTool (obj )
266276 .then ((res : any ) => {
267277 MsgSuccess (t (' common.createSuccess' ))
268278 emit (' refresh' )
@@ -271,6 +281,9 @@ const submit = async (formEl: FormInstance | undefined) => {
271281 .then (() => {
272282 visible .value = false
273283 })
284+ .finally (() => {
285+ loading .value = false
286+ })
274287 }
275288 }
276289 })
0 commit comments