diff --git a/apps/web-antd/src/views/thingmodelinfo/deviceThingModelManagement/index.vue b/apps/web-antd/src/views/thingmodelinfo/deviceThingModelManagement/index.vue index acd0507..225e337 100644 --- a/apps/web-antd/src/views/thingmodelinfo/deviceThingModelManagement/index.vue +++ b/apps/web-antd/src/views/thingmodelinfo/deviceThingModelManagement/index.vue @@ -400,18 +400,17 @@ async function buildAndOpenTestScript(record: any) { console.log('函数构建接口返回:', resp.data); - // 无论返回什么,只要接口调用成功就打开弹窗 - // 将构建结果填充到测试表单中 + // 先通过统一的方法打开弹窗(与工具栏按钮保持一致) + openTestScriptModal(); + + // 等待弹窗和表单渲染完成后再回填数据 + await nextTick(); await testScriptFormApi.setValues({ functionName: resp.data?.functionName || '', functionCode: resp.data?.functionCode || '', parameters: '', // 参数需要手动输入 }); - testResult.value = ''; // 清空之前的测试结果 - - // 使用 nextTick 确保表单设置完成后再打开弹窗 - await nextTick(); - testScriptModalApi.open(); + Message.success('函数构建成功'); } catch (error) { console.error('函数构建失败:', error);